bugAVR C Runtime Library - Bugs: bug #36124, Improve documentation on .bss...


You are not allowed to post comments on this tracker with your current authentication level.

bug #36124: Improve documentation on .bss clear when used in assembler

Submitter:  Jan Waclawek <wek>
Submitted:  Sat 07 Apr 2012 02:02:23 PM UTC
Category:  Documentation Severity:  3 - Normal
Priority:  9 - Immediate Item Group:  Documentation
Status:  None Percent Complete:  0%
Assigned to:  None Open/Closed:  Open
Release:  Any Fixed Release:  None

Tue 20 Nov 2012 06:02:09 PM UTC, comment #1: 

Since GCC 3.4, the respective bits of startup code are hosted with GCC (namely as part of libgcc) and not in AVR Libc.

It's highly recommended that any user who updates or downgrades or changes vendor / distributor of the toolchain reads all the relevent release notes.

This includes the GCC release notes, of course.

If you change the distributor, it's also strongly recommended to get informed about differences in the binary interface (ABI), because some private ports like Atmel use different ABI.

Bottom line: I think a pointer to the GCC release notes in the AVR Libc documentation is reasonable, but I don't think it makes much sense to copy paste the GCC release notes to the AVR Libc docs...

For the GCC 4.7 release notes, see

For the GCC 4.6 release notes, see

For the avr-gcc ABI, see http://gcc.gnu.org/wiki/avr-gcc

For vendor-specific release notes and changes to the ABI please consult respective document of your vendor.

Georg-Johann Lay <gjlayde>
Sat 07 Apr 2012 02:02:23 PM UTC, original submission:  

Newer builds of the avr-gcc toolchain, such as WinAVR20100110, or builds including the PR18145 fixup (4.7+), contain a patch which results in conditional linking of the .bss cleanup loop only if it is needed for the C source (similarly for the initialized .data). This may lead to surprising behaviour when such variables are defined only in assembler parts of a project.

It is therefore suggested to add something like the following text to http://www.nongnu.org/avr-libc/user-manual/assembler.html after "For devices that have RAM, initializing the RAM variables can also be utilized.", or http://www.nongnu.org/avr-libc/user-manual/mem_sections.html#sec_dot_init into the chapters dealing with .data and .bss sections, or both as appropriate:

Note: To ensure that variables in .bss section are zeroed upon startup, add the following line to the assembler source:
.global __do_clear_bss

To ensure that variables in .data section are initialized from FLASH during startup, add the following line to the assembler source:
.global __do_copy_data

(This submission is result of discussion on AVRFreaks http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=119131&highlight= )

Jan Waclawek <wek>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by gjlayde (Posted a comment)
  • -email is unavailable- added by arcanum (Updated the item)
  • -email is unavailable- added by wek (Submitted the item)



    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-11-16 arcanum Priority5 - Normal 9 - Immediate

    Back to the top

    Powered by Savane 3.9