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 AVRPragmas <strong>and</strong> ExtensionsThe C Preprocessor accepts <strong>compiler</strong>-specific extensions using <strong>the</strong> #pragma control<strong>and</strong> <strong>the</strong> equivalent C99 _Pragma() keyword; e.g., <strong>the</strong> following are equivalent:#pragma abs_address:0x1000_Pragma(“abs_address:0x1000”)This allows you to write a macro definition that exp<strong>and</strong>s to a pragma control line:#define EMOSFN(ty, f, param) PRAGMA(ctask eMOS__##f)#define PRAGMA(x)_Pragma(#x)...EMOSFN(void, MemFreeAll, (void))exp<strong>and</strong>s to#pragma ctask eMOS__MemFreeAllThe actual code (from our eMOS RTOS) defines EMOSFN multiple ways to get both<strong>the</strong> ctask declaration <strong>and</strong> a function declaration with minimal typing, to minimizetypographical errors.#pragmaThe <strong>compiler</strong> accepts <strong>the</strong> following pragmas: #pragma warn messageEmits a warning message similar to <strong>the</strong> C preprocessor directive #warning. #pragma ignore_unused_var name1 name2 ...This must appear inside a function <strong>and</strong> specifies that <strong>the</strong> named arguments areintentionally unused so no warning message should be generated <strong>for</strong> <strong>the</strong>m. #pragma interrupt_h<strong>and</strong>ler ::...This declares functions as interrupt h<strong>and</strong>lers so that <strong>the</strong> <strong>compiler</strong> generates <strong>the</strong>interrupt h<strong>and</strong>ler return instruction instead of <strong>the</strong> normal function return, <strong>and</strong>saves <strong>and</strong> restores all <strong>the</strong> registers that <strong>the</strong> functions use. It also generates <strong>the</strong>interrupt vectors based on <strong>the</strong> vector numbers. See Interrupt H<strong>and</strong>ling. Thispragma must precede <strong>the</strong> function definitions.17

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

Saved successfully!

Ooh no, something went wrong!