diff mbox

[U-Boot,2/2] at91sam9261ek: make operational again

Message ID 4D485AE0.5090600@gandalf.sssup.it
State Superseded
Delegated to: Reinhard Meyer
Headers show

Commit Message

michael Feb. 1, 2011, 7:11 p.m. UTC
Hi

On 02/01/2011 01:16 PM, Albert ARIBAUD wrote:
> Le 01/02/2011 11:45, Michael Trimarchi a écrit :
>
>> Hi
>>
>> /home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld  -pie -r -o libat91.o  lowlevel_init.o clock.o cpu.o reset.o timer.o
>> /home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: -r and -shared may not be used together
>>
>> I have tried this patch but this a problem releated to linking option. Do you have this problem?
>>
>> Michael
>
> Read up recent posts on the list: this was detected and is fixed in the 
> master branch of the u-boot-arm repository.
>
> Amicalement,
I see, but I see but I have other little problem. I have fixed the compilation, but I have a segmentation fault.

Starting program: /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld -pie -Bstatic -T u-boot.lds -Ttext 0x23e00000 arch/arm/cpu/arm926ejs/start.o --start-group api/libapi.o arch/arm/cpu/arm926ejs/at91/libat91.o arch/arm/cpu/arm926ejs/libarm926ejs.o arch/arm/lib/libarm.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/gadget/libusb_gadget.o
drivers/usb/host/libusb_host.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o drivers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o net/libnet.o post/libpost.o board/atmel/at91sam9261ek/libat91sam9261ek.o --end-group /home/michael/u-boot/arch/arm/lib/eabi_compat.o -L /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.2 -lgcc -Map u-boot.map -o u-boot
/opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: u-boot: warning: allocated section `.bss' not in segment

Program received signal SIGSEGV, Segmentation fault.
0x08081ebd in elf32_arm_finish_dynamic_sections ()
(gdb) bt
#0  0x08081ebd in elf32_arm_finish_dynamic_sections ()
#1  0x0809cc2b in bfd_elf_final_link ()
#2  0x0807b525 in elf32_arm_bfd_final_link ()
#3  0x0805bfce in ldwrite ()
#4  0x0805a0be in main ()

Michael

Comments

Remy Bohmer Feb. 1, 2011, 7:31 p.m. UTC | #1
Hi,

2011/2/1 Michael Trimarchi <trimarchi@gandalf.sssup.it>:
> Hi
>
> On 02/01/2011 01:16 PM, Albert ARIBAUD wrote:
>> Le 01/02/2011 11:45, Michael Trimarchi a écrit :
>>
>>> Hi
>>>
>>> /home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld  -pie -r -o libat91.o  lowlevel_init.o clock.o cpu.o reset.o timer.o
>>> /home/toolchain/bin/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: -r and -shared may not be used together
>>>
>>> I have tried this patch but this a problem releated to linking option. Do you have this problem?
>>>
>>> Michael
>>
>> Read up recent posts on the list: this was detected and is fixed in the
>> master branch of the u-boot-arm repository.

I mentioned this as well directly after posting this patch for the first time.
But anyway, if you look at 'cdc-at91' branch of u-boot-usb you can see
all the other patches that are required to make it compile properly.
Including the timer fix for the at91 family.

>>
>> Amicalement,
> I see, but I see but I have other little problem. I have fixed the compilation, but I have a segmentation fault.
>
> Starting program: /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld -pie -Bstatic -T u-boot.lds -Ttext 0x23e00000 arch/arm/cpu/arm926ejs/start.o --start-group api/libapi.o arch/arm/cpu/arm926ejs/at91/libat91.o arch/arm/cpu/arm926ejs/libarm926ejs.o arch/arm/lib/libarm.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/gadget/libusb_gadget.o
> drivers/usb/host/libusb_host.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o drivers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o net/libnet.o post/libpost.o board/atmel/at91sam9261ek/libat91sam9261ek.o --end-group /home/michael/u-boot/arch/arm/lib/eabi_compat.o -L /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.2 -lgcc -Map u-boot.map -o u-boot
> /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: u-boot: warning: allocated section `.bss' not in segment
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x08081ebd in elf32_arm_finish_dynamic_sections ()
> (gdb) bt
> #0  0x08081ebd in elf32_arm_finish_dynamic_sections ()
> #1  0x0809cc2b in bfd_elf_final_link ()
> #2  0x0807b525 in elf32_arm_bfd_final_link ()
> #3  0x0805bfce in ldwrite ()
> #4  0x0805a0be in main ()
>
> Michael

I see you use a rather old compiler.
I tested with a GCC 4.3.4 (CodeSourcery 2009q1) compiler which works
okay. I also noticed that the current make structure of U-boot is more
picky on linker usage, and even unresolved externals result in
crashing linkers. This has nothing to do with this patch though.

Kind regards,

Remy
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c
index 82b8d7e..b140893 100644
--- a/arch/arm/cpu/arm926ejs/at91/timer.c
+++ b/arch/arm/cpu/arm926ejs/at91/timer.c
@@ -122,11 +122,21 @@  void __udelay(unsigned long usec)
  *
  * The time is used in CONFIG_SYS_HZ units!
  */
-void reset_timer(void)
+void reset_timer_masked(void)
 {
 	gd->timer_reset_value = get_ticks();
 }
 
+void reset_timer(void)
+{
+	reset_timer_masked();
+}
+
+ulong get_timer_masked(void)
+{
+        return tick_to_time(get_ticks() - gd->timer_reset_value);
+}
+
 ulong get_timer(ulong base)
 {
 	return tick_to_time(get_ticks() - gd->timer_reset_value) - base;