11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

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 Language FeaturesFunctions•Absolute variables are accessed using the address specified with their definition, thusthere are no symbols associated with them. Because the linker never sees any symbolsfor these objects it is not aware that they have been allocated space and it cannot makeany checks for overlap of absolute variables with other objects. It is entirely the programmer’sresponsibility to ensure that absolute variables are allocated memory that isnot already in use.3.5.4 Objects in the Program Spaceconst-qualified objects are placed in the program space along with code. The program space visibility(PSV) feature of the <strong>dsPIC</strong> is use to map the const-qualified objects into the x-data space.The PSV is configured automatically at startup by the runtime code.3.6 Functions3.6.1 Function Argument PassingThe first parameter, if it is no larger than 2 bytes in size, is loaded into W0. If it is three or four bytesin size, the high order word is loaded into W1. If present, the second, third and fourth parametersare loaded into W2/W3, W4/W5 and W6/W7, respectively. Additional arguments, or those largerthan 4 bytes in size are placed on the stack. Once one parameter has been loaded onto the stack, allfollowing parameters will also be placed on the stack.In the case of a variable argument list, which is defined by the ellipsis symbol ..., the callingfunction places all but the last prototype parameter in registers, if possible. The last prototypedparameter and all parameters matching the ellipsis are placed on the stack.Take, for example, the following ANSI-style function:void test(char a, int b, long c){}The function test() will receive the parameter a in low order byte of register W0, parameter b inregister W2, and the low and high order words of parameter c in registers W4 and W5, respectively.If you need to determine, for assembler code for example, the exact entry or exit code within afunction or the code used to call a function, it is often helpful to write a dummy C function with the41

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

Saved successfully!

Ooh no, something went wrong!