bugAVR C Runtime Library - Bugs: bug #45701, redundant stack initialization in...

 
 

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

bug #45701: redundant stack initialization in crt1.o

Submitter:  None
Submitted:  Wed 05 Aug 2015 04:03:13 PM UTC
   
 
Category:  Library Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Startup code
Status:  None Assigned to:  None
Percent Complete:  0% Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  1.8.0
Fixed Release:  None

Mon 18 Jul 2016 07:14:15 PM UTC, comment #2: 

Acutally a bootloader just jumping to 0x0 would not only be uncommon, it would be shitty coding.  All the bootloaders I have written ensure the registers are in their reset state before jumping to the start of the application code.  Another option is to use a WDT reset like Optiboot.

Anonymous
Mon 11 Jul 2016 07:16:05 PM UTC, comment #1: 

The current startup code allows a custom value for SP init by defining symbol __stack , for example: -Wl,--defsym,__stack=0x123 or by defining that symbol in a custom linker description file.

Moreover it is not uncommon to (re)start an application by jumping to 0x0, e.g. from a bootloader.  If the startup code was "optimized" as proposed, that code will no more work as expected.

Georg-Johann Lay <gjlayde>
Wed 05 Aug 2015 04:03:13 PM UTC, original submission:  

It appears crt1.o always initializes the stack and clears SREG, even for modern AVRs that don't require it.
While it is necessary for old AVRs like the mega8, since SPH/SPL is initialized to 0 on reset (datasheet s. 7.5.1), on the tinyx5, tinyx4, mega48/88/168/328, and many others SPH/SPL is initialized to RAMEND upon reset.  See, for example, s. 4.8.1 of the tiny84a datasheet.

Anonymous

 

(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 None (Submitted the item)
  •  

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code