[Top][All Lists]

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

Re: [avr-gcc-list] gcc 4.3.0

From: Dmitry K.
Subject: Re: [avr-gcc-list] gcc 4.3.0
Date: Mon, 14 Apr 2008 08:08:53 +1100
User-agent: KMail/1.5

On Saturday 12 April 2008 01:01, Klaus Rudolph wrote:
> I have installed gcc 4.3.0 and becomes a bit confused :-)
> main ends now with a "ret" and returns to undefined address from stack?
> Bug or feature?

Unfortunately, this is a feature.  Since 4.3.0 Avr-gcc considers
the main() as a normal function, which must to save/restore all
call-saved registers and to use RET instruction.  (You must modify
yours startup code.)  Instead of direct record of the necessary
value in SP registers, full procedure of updating is now carried
out: save R28/R29, read SPL/H, subtraction, save SREG, write new
SPL/H, restore SREG.

This leads to useless expenditure of flash memory and (especially
unpleasantly) to reduction of an accessible stack.

It is often possible to hear advice to use 'OS_main' attribute with
main() function.  This is wrong advice: such attribute is absent in
4.3.0 (The alternatives like 'noOS_main', 'OSless_main' are absent
also).  In any case the including of nonstandarts into user source
is a bad idea.  It would be the best variant to restore old behavior
and add '-m...' option for generation of standart prologue/epilogue
with main().


reply via email to

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