11.07.2015 Views

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ICCV8 <strong>for</strong> AVR – C Compiler <strong>for</strong> Atmel AVRC TasksAs described in <strong>the</strong> Assembly Interface <strong>and</strong> Calling Conventions page, <strong>the</strong> <strong>compiler</strong>normally generates code to save <strong>and</strong> restore <strong>the</strong> preserved registers. Under somecircumstances, this behavior may not be desirable. For example, if you are using aRTOS (Real Time Operating System), <strong>the</strong> RTOS manages <strong>the</strong> saving <strong>and</strong> restoring of<strong>the</strong> registers as part of <strong>the</strong> task switching process <strong>and</strong> <strong>the</strong> code inserted by <strong>the</strong><strong>compiler</strong> becomes redundant.To disable this behavior, use <strong>the</strong> comm<strong>and</strong> #pragma ctask. For example,#pragma ctask drive_motor emit_siren....void drive_motor() { ... }void emit_siren() {...}The pragma must appear be<strong>for</strong>e <strong>the</strong> definitions of <strong>the</strong> functions. Note that by default,<strong>the</strong> routine main has this attribute set, since main should never return <strong>and</strong> it isunnecessary to save <strong>and</strong> restore any register <strong>for</strong> it.131

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!