Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] static libgcc_s
@ 2007-02-28 15:51 Piotr Adam Zolnierczuk
  2007-02-28 18:37 ` Thomas Lundquist
  2007-02-28 21:45 ` Erik Andersen
  0 siblings, 2 replies; 10+ messages in thread
From: Piotr Adam Zolnierczuk @ 2007-02-28 15:51 UTC (permalink / raw)
  To: buildroot

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] static libgcc_s
  2007-02-28 15:51 [Buildroot] static libgcc_s Piotr Adam Zolnierczuk
@ 2007-02-28 18:37 ` Thomas Lundquist
  2007-02-28 21:45 ` Erik Andersen
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas Lundquist @ 2007-02-28 18:37 UTC (permalink / raw)
  To: buildroot

On Wed, Feb 28, 2007 at 10:51:02AM -0500, Piotr Adam Zolnierczuk wrote:
> 
> Hi,
> I am trying to compile a flash bootloader for a AT91SAM9260EK board on 
> my Linux box.

U-Boot?

> 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.)

> 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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] static libgcc_s
       [not found] <mailman.1.1172692802.12481.buildroot@uclibc.org>
@ 2007-02-28 20:41 ` Zolnierczuk, Piotr
  0 siblings, 0 replies; 10+ messages in thread
From: Zolnierczuk, Piotr @ 2007-02-28 20:41 UTC (permalink / raw)
  To: buildroot

Hi Thomas: 
Thanks for prompt reply.
1. U-Boot compiles fine (I use NOSOFTFLAG=yes). I would like to compile
AT91bootstrap
(http://www.atmel.com/dyn/resources/prod_documents/AT91Bootstrap1.2.zip)

2. AFAIK divsi3 is integer division not FP. 
When I do 
nm -B $PATH_TO_TOOLCHAIN/lib/libc.a 
I can see undefined references to __divsi3. The functions are defined in
libgcc_s.so, but I need a static one (-Bstatic) ... hence catch 22 :(

BTW: is there a simple way to convert a shared lib into a static one.
Back in the dark days I used to manipulate static libs with ar (e.g. ar
x libmylib.a would produce a set of *.o files). But I do not know how to
"disassemble" a *.so


Piotr

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] static libgcc_s
  2007-02-28 15:51 [Buildroot] static libgcc_s Piotr Adam Zolnierczuk
  2007-02-28 18:37 ` Thomas Lundquist
@ 2007-02-28 21:45 ` Erik Andersen
  2007-03-01  0:48   ` Piotr Adam Zolnierczuk
  1 sibling, 1 reply; 10+ messages in thread
From: Erik Andersen @ 2007-02-28 21:45 UTC (permalink / raw)
  To: buildroot

On Wed Feb 28, 2007 at 10:51:02AM -0500, Piotr Adam Zolnierczuk wrote:
> 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--

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] static libgcc_s
  2007-02-28 21:45 ` Erik Andersen
@ 2007-03-01  0:48   ` Piotr Adam Zolnierczuk
  2007-03-01  6:13     ` Ulf Samuelsson
  0 siblings, 1 reply; 10+ messages in thread
From: Piotr Adam Zolnierczuk @ 2007-03-01  0:48 UTC (permalink / raw)
  To: buildroot

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

Erik Andersen wrote:
> On Wed Feb 28, 2007 at 10:51:02AM -0500, Piotr Adam Zolnierczuk wrote:
>   
>> 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--
>   


-- 
 __________________________________________________________________
 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 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] static libgcc_s
  2007-03-01  0:48   ` Piotr Adam Zolnierczuk
@ 2007-03-01  6:13     ` Ulf Samuelsson
  2007-03-01 14:42       ` Zolnierczuk, Piotr
  0 siblings, 1 reply; 10+ messages in thread
From: Ulf Samuelsson @ 2007-03-01  6:13 UTC (permalink / raw)
  To: buildroot

> 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.

> 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] static libgcc_s
  2007-03-01  6:13     ` Ulf Samuelsson
@ 2007-03-01 14:42       ` Zolnierczuk, Piotr
  2007-03-01 15:58         ` Ulf Samuelsson
  0 siblings, 1 reply; 10+ messages in thread
From: Zolnierczuk, Piotr @ 2007-03-01 14:42 UTC (permalink / raw)
  To: buildroot

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

> 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.

> 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] static libgcc_s
  2007-03-01 14:42       ` Zolnierczuk, Piotr
@ 2007-03-01 15:58         ` Ulf Samuelsson
  2007-03-01 16:20           ` Piotr Adam Zolnierczuk
  0 siblings, 1 reply; 10+ messages in thread
From: Ulf Samuelsson @ 2007-03-01 15:58 UTC (permalink / raw)
  To: buildroot

> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] static libgcc_s
  2007-03-01 15:58         ` Ulf Samuelsson
@ 2007-03-01 16:20           ` Piotr Adam Zolnierczuk
  2007-03-01 16:55             ` Ulf Samuelsson
  0 siblings, 1 reply; 10+ messages in thread
From: Piotr Adam Zolnierczuk @ 2007-03-01 16:20 UTC (permalink / raw)
  To: buildroot

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  

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] static libgcc_s
  2007-03-01 16:20           ` Piotr Adam Zolnierczuk
@ 2007-03-01 16:55             ` Ulf Samuelsson
  0 siblings, 0 replies; 10+ messages in thread
From: Ulf Samuelsson @ 2007-03-01 16:55 UTC (permalink / raw)
  To: buildroot

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" <pzolnier@indiana.edu>
To: <buildroot@uclibc.org>
Cc: <ulf@atmel.com>; <pzolnier@indiana.edu>
Sent: Thursday, March 01, 2007 5:20 PM
Subject: RE: [Buildroot] static libgcc_s


> 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  
> 
> 
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-03-01 16:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-28 15:51 [Buildroot] static libgcc_s Piotr Adam Zolnierczuk
2007-02-28 18:37 ` Thomas Lundquist
2007-02-28 21:45 ` Erik Andersen
2007-03-01  0:48   ` Piotr Adam Zolnierczuk
2007-03-01  6:13     ` Ulf Samuelsson
2007-03-01 14:42       ` Zolnierczuk, Piotr
2007-03-01 15:58         ` Ulf Samuelsson
2007-03-01 16:20           ` Piotr Adam Zolnierczuk
2007-03-01 16:55             ` Ulf Samuelsson
     [not found] <mailman.1.1172692802.12481.buildroot@uclibc.org>
2007-02-28 20:41 ` Zolnierczuk, Piotr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox