12.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
  • No tags were found...

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

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

C Language...}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.Intrinsic functions produce very efficient assembly code. Though it is possible to inline assembly code byhand, intrinsic functions use registers even more efficiently. At the same time your C source remains veryreadable.You can use intrinsic functions in C as if they were ordinary C (library) functions. All intrinsics begin witha double underscore character (__).The <strong>TASKING</strong> <strong>ARM</strong> C compiler recognizes the following intrinsic functions:__allocvoid * volatile __alloc( __size_t size );Allocate memory. Returns a pointer to space of size bytes on the stack of the calling function. Memoryallocated through this function is freed when the calling function returns. This function is used internally<strong>for</strong> variable length arrays, it is not to be used by end users.__freevoid volatile __free( void *p );Deallocates the memory pointed to by p. p must point to memory earlier allocated by a call to __alloc().__nopvoid __nop( void );Generate NOP instruction.25

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

Saved successfully!

Ooh no, something went wrong!