[U-Boot-Users] Alignment of bss section in hello world standalone application on ARM

Christian Eggers christian.eggers at kathrein.de
Thu Mar 22 16:54:04 CET 2007


some builds of the example hello_world application causes a data abort in 
This seems to be caused by an unligned memory access to __bss_start 

 173 extern unsigned long __bss_start, _end;
 175 void app_startup(char **argv)
 176 {
 177         unsigned long * cp = &__bss_start;
 179         /* Zero out BSS */
 180         while (cp < &_end) {
 181                 *cp++ = 0;
 182         }
 189 }

There's no explicit linker script for ARM platform. The implicit default 
script seems not to
aling __bss_start to a multiple of 4 (required for unsigned long access). 

Solution 1:
The data type could be changed to "unsigned char". This may drop some 
if really large amounts of uninitialised data used.

Unfortunately I don't know whether this will work on all platforms.

Solution 2:
Create a suitable linker file. I've attached a slightly modified "default" 
script generated
ld --verbose. Perhaps this file might be more complex then necessary or 
may not run
on different gcc versions. Unfortunately I'dont know how to create a more 


Christian Eggers
Dipl. Ing. (FH)
Development Software
Mobile Communication Networks, EMA

Anton-Kathrein-Straße 1-3
P.O. Box 100 444
83004 Rosenheim, Germany

Tel.: +49 8031 184-5857
Fax: +49 8031 184-951

E-Mail: christian.eggers at kathrein.de
Internet: http://www.kathrein.de

Anton-Kathrein-Straße 1-3
P.O. Box 100 444
83004 Rosenheim, Germany

Registergericht: Amtsgericht Traunstein, HRA 460
Geschäftsführender persönlich haftender Gesellschafter Prof. Dr. Dr. h.c. Anton Kathrein, Dipl.-Betriebswirt
Erfüllungsort und Gerichtsstand: Rosenheim

Register court: local court Traunstein, certificate of registration no. 460
Personally liable managing partner Prof. Dr. Dr. h.c. Anton Kathrein, Dipl.-Betriebswirt (MBA-equivalent)
Place of performance and place of jurisdiction: Rosenheim

This e-mail is confidential and may contain privileged information. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20070322/27818da7/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: default.ld
Type: application/octet-stream
Size: 6992 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070322/27818da7/attachment.obj 

More information about the U-Boot mailing list