Skip to contentSkip to conversation

static libgcc_s

Buildroot Piotr Adam Zolnierczuk 5 participants 9 messages Feb 28, 2007 – Mar 1, 2007

lore
Share & tools
lore
#0 lore raw

Hi,
I am trying to compile a flash bootloader for a AT91SAM9260EK board on my Linux box.

When I use gnuarm.org precompiled toolchain (gcc-3.4.3) it works fine, but when I use my own toolchain
(build by buildroot rev 17875, gcc-4.1.1) it complains about missing gcc_s (the bootloader wants to use __divsi3 routine).

My toolchain properly builds libgcc_s.so, but for some reasons it does not build libgcc_s.a. Otherwise the toolchain is fine: builds kernel, rootfs etc.

Any ideas how can I "force" buildroot to build a static version of libgcc_s?

Thanks
Piotr

#1 lore raw
Quoted 4 lines · Piotr Adam Zolnierczuk

Hi,
I am trying to compile a flash bootloader for a AT91SAM9260EK board on my Linux box.

U-Boot?

Quoted 4 lines

When I use gnuarm.org precompiled toolchain (gcc-3.4.3) it works fine, but when I use my own toolchain
(build by buildroot rev 17875, gcc-4.1.1) it complains about missing gcc_s (the bootloader wants to use __divsi3 routine).

either build a toolchain with soft float or remove -msoft-float from the makefiles in the U-Boot source.

(but the only real option you have is to turn on soft-float when building, using the kernels FPU-emulation is horribly slow.)

Quoted 5 lines

My toolchain properly builds libgcc_s.so, but for some reasons it does not build libgcc_s.a. Otherwise the toolchain is fine: builds kernel, rootfs etc.

Any ideas how can I "force" buildroot to build a static version of libgcc_s?

I don't think you need to do that.

Thomas.

#3 lore raw

Thanks Eric
It's a good thought. I will certainly give it a try.

It still, though, leaves me with two toolchains:
one 'static' for dataflash and u-boot and a second 'dynamic' for kernel and applications (for space considerations)

I am still curious if one could have just one toolchain that rules them all ... :)

Piotr

Quoted 14 lines · Erik Andersen
Quoted 2 lines · Piotr Adam Zolnierczuk

Any ideas how can I "force" buildroot to build a static version of libgcc_s?

disable BR2_GCC_SHARED_LIBGCC in your buildroot .config and rebuild your toolchain. No more shared libgcc_s...

-Erik

--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

Signature · 17 lines
 __________________________________________________________________
 Piotr Adam Zolnierczuk
 Indiana University                          phone:  (812) 855-3613
 Cyclotron Facility                          fax:    (812) 855-6645
 2401 Milo B Sampson Ln               e-mail:  pzolnier at indiana.edu
 Bloomington,IN 47408, USA   http://www.iucf.indiana.edu/u/pzolnier
 __________________________________________________________________
                   written on recycled electrons                 	


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pzolnier.vcf
Type: text/x-vcard
Size: 317 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/buildroot/attachments/20070228/5deb8137/attachment-0002.vcf 
#4 lore raw
Quoted 9 lines

Thanks Eric
It's a good thought. I will certainly give it a try.

It still, though, leaves me with two toolchains:
one 'static' for dataflash and u-boot and a second 'dynamic' for kernel and applications (for space considerations)

I am still curious if one could have just one toolchain that rules them all ... :)

I removed the -msoftfloat from the
cpu/arm920t/config.mk and
from
cpu/arm920t/at91rm9200/config.mk

After this I have a single toolchain which allows me to build:

* dataflashboot.bin (for AT91RM9200)
* U-Boot
* Linux
* Root File System

It does not allow me to build at91-bootstrap.

Quoted 3 lines

Piotr

Best Regards
Ulf Samuelsson ulf at atmel.com
Atmel Nordic AB

Mail:  Box 2033, 174 02 Sundbyberg, Sweden
Visit:  Kavalleriv?gen 24, 174 58 Sundbyberg, Sweden

Phone +46 (8) 441 54 22 Fax +46 (8) 441 54 29
GSM +46 (706) 22 44 57

Technical support when I am not available:
AT89 C51 Applications Group: mailto:micro.hotline at nto.atmel.com AT90 AVR Applications Group: mailto:avr at atmel.com AT91 ARM Applications Group: mailto:at91support at atmel.com FPSLIC Application Group: mailto:fpslic at atmel.com Best AVR link: www.avrfreaks.net

#5 lore raw

Hi Ulf,
Yes: you are right I can compile U-Boot with NOSOFTFLOAT=yes with the "default" toolchain (i.e. the one with shared gcc enabled), but I cannot compile AT91 bootstrap for that I have (following Eric's tip) a static-only toolchain that compiles bootstrap.

So for now: two toolchains.

Thank you all for help

Piotr

Piotr Adam Zolnierczuk

Indiana University               phone:  (812) 855-3613
Cyclotron Facility               fax:    (812) 855-6645

2401 Milo B Sampson Ln e-mail: pzolnier at indiana.edu
Bloomington, http://www.iucf.indiana.edu/u/pzolnier
IN 47408
USA
________________________________________________
written on recycled electrons
-----Original Message-----
From: Ulf Samuelsson [mailto:ulf at atmel.com]
Sent: Thursday, March 01, 2007 1:14 AM
To: Zolnierczuk, Piotr; buildroot at uclibc.org
Subject: Re: [Buildroot] static libgcc_s

Quoted 9 lines

Thanks Eric
It's a good thought. I will certainly give it a try.

It still, though, leaves me with two toolchains:
one 'static' for dataflash and u-boot and a second 'dynamic' for kernel and applications (for space considerations)

I am still curious if one could have just one toolchain that rules them all ... :)

I removed the -msoftfloat from the
cpu/arm920t/config.mk and
from
cpu/arm920t/at91rm9200/config.mk

After this I have a single toolchain which allows me to build:

* dataflashboot.bin (for AT91RM9200)
* U-Boot
* Linux
* Root File System

It does not allow me to build at91-bootstrap.

Quoted 3 lines

Piotr

Best Regards
Ulf Samuelsson ulf at atmel.com
Atmel Nordic AB

Mail:  Box 2033, 174 02 Sundbyberg, Sweden
Visit:  Kavalleriv?gen 24, 174 58 Sundbyberg, Sweden

Phone +46 (8) 441 54 22 Fax +46 (8) 441 54 29
GSM +46 (706) 22 44 57

Technical support when I am not available:
AT89 C51 Applications Group: mailto:micro.hotline at nto.atmel.com AT90 AVR Applications Group: mailto:avr at atmel.com AT91 ARM Applications Group: mailto:at91support at atmel.com FPSLIC Application Group: mailto:fpslic at atmel.com Best AVR link: www.avrfreaks.net

#6 lore raw
Quoted 2 lines

Hi Ulf,
Yes: you are right I can compile U-Boot with NOSOFTFLOAT=yes with the "default" toolchain (i.e. the one with shared gcc enabled), but I cannot compile AT91 > bootstrap for that I have (following Eric's tip) a static-only toolchain that compiles bootstrap.

Can you pinpoint exactly what causes the static only toolchain to be needed? I find it highly irritating to have to use this toolchain.

Best Regards
Ulf Samuelsson

#7 lore raw

Ulf:

thanks for your input

The source of the problem is that AT91Bootstrap needs div - integer division, see
Function df_send_command in <PathToAT91Bootstrap>/driver/dataflash.c

Now by default buildroot generates only a shared version of libgcc_s.so.

Here's make output from buildroot generated toolchain (gcc-4.1.1/binutils-2.17)

[muon:/data/zolnie/EtherDAQ/sw/bsp/bootstrap]$ make 
CROSS_COMPILE=/opt/arm/bin/arm-linux-
cd board/at91sam9260ek/dataflash &&  make
make[1]: Entering directory 
`/data/zolnie/EtherDAQ/sw/at91sam9260ek/bootstrap/board/at91sam9260ek/dataflash'
rm -f *.o *.bin *.elf *.map
/opt/arm/bin/arm-linux-gcc -g -mcpu=arm9 -c -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash -DTOP_OF_MEM=0x301000 
../../../crt0_gnu.S -o crt0_gnu.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  
../../../board/at91sam9260ek/at91sam9260ek.c -o at91sam9260ek.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../main.c -o main.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/gpio.c -o gpio.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/pmc.c -o pmc.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/debug.c -o 
debug.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/sdramc.c -o 
sdramc.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/dataflash.c 
-o dataflash.o
/opt/arm/bin/arm-linux-gcc -nostartfiles 
-Wl,-Map=dataflash_at91sam9260ek.map,--cref ../../../libmygcc.a -T 
../../../elf32-littlearm.lds -Ttext 0x200000 -n -o 
dataflash_at91sam9260ek.elf crt0_gnu.o at91sam9260ek.o main.o gpio.o 
pmc.o debug.o sdramc.o dataflash.o
/opt/arm/lib/gcc/arm-linux-uclibc/4.1.1/../../../../arm-linux-uclibc/bin/ld: 
cannot find -lgcc_s
collect2: ld returned 1 exit status
make[1]: *** [dataflash_at91sam9260ek] Error 1
make[1]: Leaving directory 
`/data/zolnie/EtherDAQ/sw/at91sam9260ek/bootstrap/board/at91sam9260ek/dataflash'
make: *** [all] Error 2

When I use the static version (gcc-3.4.6/binutils-2.16.1) - compiles, loads and boots ok.

Piotr

Piotr Adam Zolnierczuk

Indiana University               phone:  (812) 855-3613
Cyclotron Facility               fax:    (812) 855-6645

2401 Milo B Sampson Ln e-mail: pzolnier at indiana.edu
Bloomington, http://www.iucf.indiana.edu/u/pzolnier
IN 47408
USA
________________________________________________
written on recycled electrons

#8 lore raw

I think that:

  div_t result = div(dAddress, AT91C_PAGE_SIZE(pDataFlash));

can be replaced by:
div_t result = 0;
unsigned int dAddr = dAddress;
unsigned int page_size = AT91C_PAGE_SIZE(pDataFlash); while(dAddr >= page_size) {
result ++;
dAddr -= page_size;
}

Possbibly you can have a table which is

{
1 * AT91C_PAGE_SIZE(pDataFlash) ,
2 * AT91C_PAGE_SIZE(pDataFlash),
4 * AT91C_PAGE_SIZE(pDataFlash),
8 * AT91C_PAGE_SIZE(pDataFlash),
16 * AT91C_PAGE_SIZE(pDataFlash),
32 * AT91C_PAGE_SIZE(pDataFlash),
64 * AT91C_PAGE_SIZE(pDataFlash),
128 * AT91C_PAGE_SIZE(pDataFlash),
256 * AT91C_PAGE_SIZE(pDataFlash),
512 * AT91C_PAGE_SIZE(pDataFlash),
1024 * AT91C_PAGE_SIZE(pDataFlash),
2048 * AT91C_PAGE_SIZE(pDataFlash),
4096 * AT91C_PAGE_SIZE(pDataFlash)
}
and do a search, but I think it will still be so fast that it is not neccessary.
at91-bootstrap will only access the lower 256 kB and maybe as small as 128 kB and I am not at all sure that the command sent is not a continuous read in which case only 0x8000 is used which can be compuated once running 32 times thorugh the loop.

Please try if you are interested.

Best Regards
Ulf Samuelsson

----- Original Message -----
From: "Piotr Adam Zolnierczuk" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>; <[email protected]>
Sent: Thursday, March 01, 2007 5:20 PM
Subject: RE: [Buildroot] static libgcc_s

Quoted 70 lines

Ulf:

thanks for your input

The source of the problem is that AT91Bootstrap needs div - integer division, see
Function df_send_command in <PathToAT91Bootstrap>/driver/dataflash.c

Now by default buildroot generates only a shared version of libgcc_s.so.

Here's make output from buildroot generated toolchain (gcc-4.1.1/binutils-2.17)

[muon:/data/zolnie/EtherDAQ/sw/bsp/bootstrap]$ make 
CROSS_COMPILE=/opt/arm/bin/arm-linux-
cd board/at91sam9260ek/dataflash &&  make
make[1]: Entering directory 
`/data/zolnie/EtherDAQ/sw/at91sam9260ek/bootstrap/board/at91sam9260ek/dataflash'
rm -f *.o *.bin *.elf *.map
/opt/arm/bin/arm-linux-gcc -g -mcpu=arm9 -c -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash -DTOP_OF_MEM=0x301000 
../../../crt0_gnu.S -o crt0_gnu.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  
../../../board/at91sam9260ek/at91sam9260ek.c -o at91sam9260ek.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../main.c -o main.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/gpio.c -o gpio.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/pmc.c -o pmc.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/debug.c -o 
debug.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/sdramc.c -o 
sdramc.o
/opt/arm/bin/arm-linux-gcc -c -g -mcpu=arm9 -Os -Wall -DAT91SAM9260 
(quoted diff) +0 -2
-I./../../../board/at91sam9260ek/dataflash  ../../../driver/dataflash.c 
-o dataflash.o

/opt/arm/bin/arm-linux-gcc -nostartfiles -Wl,-Map=dataflash_at91sam9260ek.map,--cref ../../../libmygcc.a -T ../../../elf32-littlearm.lds -Ttext 0x200000 -n -o dataflash_at91sam9260ek.elf crt0_gnu.o at91sam9260ek.o main.o gpio.o pmc.o debug.o sdramc.o dataflash.o /opt/arm/lib/gcc/arm-linux-uclibc/4.1.1/../../../../arm-linux-uclibc/bin/ld:
cannot find -lgcc_s
collect2: ld returned 1 exit status
make[1]: *** [dataflash_at91sam9260ek] Error 1
make[1]: Leaving directory `/data/zolnie/EtherDAQ/sw/at91sam9260ek/bootstrap/board/at91sam9260ek/dataflash'
make: *** [all] Error 2

When I use the static version (gcc-3.4.6/binutils-2.16.1) - compiles, loads and boots ok.

Piotr

Piotr Adam Zolnierczuk

Indiana University               phone:  (812) 855-3613
Cyclotron Facility               fax:    (812) 855-6645

2401 Milo B Sampson Ln e-mail: pzolnier at indiana.edu
Bloomington, http://www.iucf.indiana.edu/u/pzolnier
IN 47408
USA
________________________________________________
written on recycled electrons