13.07.2015 Views

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C LanguageEnable interrupts in exception handlers (not <strong>for</strong> M-profile architectures)Normally interrupts are disabled when an exception handler is entered. With the function qualifier__nesting_enabled you can <strong>for</strong>ce that the link register (LR) is saved and that interrupts are enabled.For example:void __interrupt_svc __nesting_enabled svc( int n ){if ( n == 2 ){__svc(3);}...}1.10.3.2. Interrupt Frame: __frame()With the function type qualifier __frame() you can specify which registers and SFRs must be saved <strong>for</strong>a particular interrupt function. Only the specified registers will be pushed and popped from the stack. Ifyou do not specify the function qualifier __frame(), the C compiler determines which registers must bepushed and popped. The syntax is:void __interrupt_xxx__frame(reg[, reg]...) isr( void ){...}where, reg can be any register defined as an SFR. The compiler generates a warning if some registersare missing which are normally required to be pushed and popped in an interrupt function prolog andepilog to avoid run-time problems.Example__interrupt_irq __frame(R4,R5,R6) void alarm( void ){...}1.10.4. Intrinsic FunctionsSome specific assembly instructions have no equivalence in C. Intrinsic functions give the possibility touse these instructions. Intrinsic functions are predefined functions that are recognized by the compiler.The compiler generates the most efficient assembly code <strong>for</strong> these functions.The compiler always inlines the corresponding assembly instructions in the assembly source (rather thancalling it as a function).This avoids parameter passing and register saving instructions which are normallynecessary during function calls.27

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

Saved successfully!

Ooh no, something went wrong!