[Top][All Lists]

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

Re: [avr-gcc-list] Add 'OS_main' and 'OS_task' attributes in avr-gcc 4.2

From: Bob Paddock
Subject: Re: [avr-gcc-list] Add 'OS_main' and 'OS_task' attributes in avr-gcc 4.2.1
Date: Tue, 9 Dec 2008 08:39:56 -0500

On Mon, Jul 23, 2007 at 2:48 PM, Anatoly Sokolov <address@hidden> wrote:

> This patch add "OS_main" and 'OS_task' attributes in GCC 4.2.1. Function with
> "OS_main" and 'OS_task' attributes do not save any "call-saved" registers.

I had hoped that using OS_main would get rid of the call to main,
wastes stack space, and all of the dead _exit code, which is not allowed
under some design guidelines (as well as taking space), that will
never be executed, but it doesn't.
Is there an attribute that would?

using 'noreturn' does not work on main, causes:

Main/main.cpp: In function 'int main()':
Main/main.cpp:60: warning: function declared 'noreturn' has a 'return' statement

Removing 'int' from main causes different errors.

Test case:

int main( void ) __attribute__ ((OS_main));
int main( void )

generates the following where main will never return and
_exit will never be executed.

  5a:   02 d0           rcall   .+4             ; 0x60 <main>
  5c:   02 c0           rjmp    .+4             ; 0x62 <_exit>

0000005e <__bad_interrupt>:
  5e:   d0 cf           rjmp    .-96            ; 0x0 <__vectors>

00000060 <main>:

int main( void )
  60:   ff cf           rjmp    .-2             ; 0x60 <main>

00000062 <_exit>:
  62:   f8 94           cli

00000064 <__stop_program>:
  64:   ff cf           rjmp    .-2             ; 0x64 <__stop_program>

reply via email to

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