avr-libc-dev
[Top][All Lists]
Advanced

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

RE: [avr-libc-dev] [bug #19050] gcrt1.S should call main rather thanjump


From: Eric Weddington
Subject: RE: [avr-libc-dev] [bug #19050] gcrt1.S should call main rather thanjumping to it
Date: Tue, 13 Feb 2007 10:35:41 -0700

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Anatoly Sokolov
> Sent: Tuesday, February 13, 2007 9:52 AM
> To: Anatoly Sokolov; Joerg Wunsch; address@hidden; 
> address@hidden
> Subject: [avr-libc-dev] [bug #19050] gcrt1.S should call main 
> rather thanjumping to it
> 
> 
> Follow-up Comment #1, bug #19050 (project avr-libc):
> 
> Call main() as a normal function have some drawback:
> 
> 1. Loss of two bytes of RAM for storing 'main' return address 
> in stack.
> 
> 2. Increase code size, if 'main' function has local variables.
> 
> Now stack frames for 'main' function is setup by a following code:
> REG_Y (frame pointer)  = RAM_END - frame_size
> SP = REG_Y
> 
> Size = 4 instruction.
> 
> If 'main' will be usual function, that in prologue will be a 
> following code:
> 
> PUSH REG_Y
> REG_Y = SP
> REG_Y = REG_Y - frame_size
> SP = REG_Y
> 
> Size - 7/8 instruction and loss of two bytes more of RAM. And 7/8 more
> instructions in an epilogue of function.
> 
> 3. If in 'main' function 'call-saved' registers (r2..r17) 
> will be used, then
> they will be saved in a stack. 

Hi Anatoly,

You make some very good points. Unfortunately, main() is already converted
over to a normal function in gcc 4.x. Do you propose that we convert it
back?

Can someone remember what was the reasoning behind making main() a normal
function? Is the reason still valid?

Thanks
Eric Weddington





reply via email to

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