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

 
 

bug #45701: redundant stack initialization in crt1.o

Submitted by:  None
Submitted on:  Wed 05 Aug 2015 04:03:13 PM UTC  
 
Category: LibrarySeverity: 3 - Normal
Priority: 5 - NormalItem Group: Startup code
Status: NonePercent Complete: 0%
Assigned to: NoneOriginator Email: -unavailable-
Open/Closed: OpenRelease: 1.8.0
Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by gjlayde (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1