On Mon, Jun 27, 2005 at 11:03:36AM +0200, Haase Bjoern (PT-BEU/EMT) * wrote:
I am presently re-implementing prologue/epilogue by RTL instead of text. I
thought about posting it this week-end but weather was too fine and It will
probably still take a couple of days in order to make sure, that also the
TINY_STACK and NO_INTERRUPT cases are not broken. When doing this, I could
implement the change of the status of the main function right away.?
I think it may be best to do it all in this order:
1. Change gcrt1.S in avr-libc to call main() instead of jumping to it;
after main() returns, call exit(). I believe this should still be
backwards-compatible with stable versions of GCC (where main() never
returns, but jumps directly to exit() instead).
2. Implement the "OS_Task" function attribute (see the h8300 target;
in IAR C it's called "__C_task" and you can see it in code examples
found in some Atmel's app notes). Applications should specify this
for main(), to avoid unnecessary saving of call-saved registers.
3. Remove special handling of main(). This should simplify the function
prologue/epilogue logic, making the next step easier. After that,
GCC will require the updated avr-libc (with change from step 1).
4. Finally, implement prologue/epilogue as RTL instead of text.
There is also an issue with avr-gdb, which scans function prologues
and handles main() specially. But I can't help much here...
Marek