avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Re: avr-gcc code generation and initialization of the


From: Dave Hylands
Subject: RE: [avr-gcc-list] Re: avr-gcc code generation and initialization of the return stack
Date: Wed, 5 May 2004 11:18:23 -0700

> > >It seems like the main function does an re-initialization of the 
> > >return stack (SPL/SPH). Actually, the new JTAGICE mkII expects the 
> > >stack pointer not to be modified this way apart from in the system 
> > >startup-code, or the single-stepping mechanisms wont work. The 
> > >avr-gcc does set up the stack properly in the 
> startup-code, so I dont 
> > >clearly see why it's done over again in 'main'.
> > 
> > Do any of you know why the stack is reinitialized this way?
> 
> Mainly historical reasons - it has been that way since the 
> beginning, the initialization in startup code has been added 
> later, but main() still does this for backwards compatibility 
> (new avr-gcc working with old avr-libc).

As a quick hack, you could always call your main something else, and
write the real main in assembler, as a function that just calls your
renamed main.

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]