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

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

Re: [avr-gcc-list] Re: [patch #6004] "main-as-normal" patches for GCC


From: Anatoly Sokolov
Subject: Re: [avr-gcc-list] Re: [patch #6004] "main-as-normal" patches for GCC
Date: Mon, 2 Jun 2008 22:13:10 +0400

Hi.


> 
> Is there some documentation out there about the effect of all the AVR 
> specific attributes?  I'd like to understand the puposes and (generated 
> code) consequences of
> 
> OS_main

Function with "OS_main" and 'OS_task' attributes do not save any 
"call-saved" registers.

1. "OS_main" attribute  used when there IS guarantee that interrupts are 
disabled at that time when function is called. For example "main" function in 
avr-libc. If this function has local variables that a prologue will look so:
  in r28, 0x3d ; 61
  in r29, 0x3e ; 62
  sbiw r28, 0x08 ; 8
  out 0x3e, r29 ; 62
  out 0x3d, r28 ; 61

> OS_task

2. "OS_task" attribute  used when there is NO guarantee that interrupts are 
disabled at that time when function is called. For example task functions 
multi-threading operating systems. In this case save/clear/restore "I" flag is 
need for changing SP register. Prologue (if this function has local variables) 
will look so:

  in r28, 0x3d ; 61
  in r29, 0x3e ; 62
  sbiw r28, 0x08 ; 8
  in r0, 0x3f ; 63
  cli
  out 0x3e, r29 ; 62
  out 0x3f, r0 ; 63
  out 0x3d, r28 ; 

> naked

From GCC manual:
naked 
Use this attribute on the ARM, AVR, C4x and IP2K ports to indicate that the 
specified function does not need prologue/epilogue sequences generated by the 
compiler. It is up to the programmer to provide these sequences. 

Anatoly.

reply via email to

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