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.

Linking ProgramsC Language FeaturesThe program statistics shown after the summary provides more concise information based oneach memory area of the device. This can be used as a guide to the available space left in the device.More detailed memory usage information, listed in ascending order of individual psects, maybe obtained by using the DSPICC --SUMMARY=psect option. Generate a map file for the completememory specification of the program.3.13.1 Replacing Library ModulesAlthough HI-TECH C comes with a librarian (LIBR) which allows you to unpack a library files andreplace modules with your own modified versions, you can easily replace a library module that islinked into your program without having to do this. If you add the source file which contains thelibrary routine you wish to replace on the command-line list of source files then the routine willreplace the routine in the library file with the same name.•This method works due to the way the linker scans source and library file. When tryingto resolve a symbol (in this instance a function name) the linker first scans all sourcemodules for the definition. Only if it cannot resolve the symbol in these files does itthen search the library files. Even though the symbol may be defined in a source fileand a library file, the linker will not search the libraries and no multiply defined symbolerror will result. This is not true if a symbol is defined twice in source files.For example, if you wished to make changes to the library function max() which resides in the filemax.c in the SOURCES directory, you could make a copy of this source file, make the appropriatechanges and then compile and use it as follows.DSPICC --chip=30F6014 main.c init.c max.cThe code for max() in max.c will be linked into the program rather than the max() function containedin the standard libraries. Note, that if you replace an assembler module, you may need the-P option to preprocess assembler files as the library assembler files often contain C preprocessordirectives.3.13.2 Signature CheckingThe compiler automatically produces signatures for all functions. A signature is a 16-bit valuecomputed from a combination of the function’s return data type, the number of its parameters andother information affecting the calling sequence for the function. This signature is output in theobject code of any function referencing or defining the function.62

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

Saved successfully!

Ooh no, something went wrong!