|
|||||||||||
|
Technical Support Support Resources
Product Information |
LX51: Linking User-Modified C FunctionsInformation in this article applies to:
QUESTIONI noticed that the putchar function is pulled out of the Keil Libraries. I would rather use my own version of putchar, instead of the one in the libraries. How do I link my own version of the putchar function using µVision? ANSWERThis answer pertains to all of the source files in C:\Keil\Cxx\Lib\, not just the PUTCHAR.C source file. To link your own version of a function (putchar, for example):
If you open your MAP file, you will see:
This shows that the putchar being used by your project is the one located in the project directory. If you remove putchar.c from the project window and recompile, the map file would show the following:
This shows that putchar is once again being called from the library. The linker resolves external references using the project's object files first, then searches the C:\Keil\Cxx\Lib libraries for any other unresolved references. You must use the same name as the module you are trying to replace for this to automaticly happen. For example if you changed the name of the function in putchar.c to 'modified_putchar', the linker will use the putchar from the library, and ignore your modified putchar.c. You can use the same procedure with non-Keil libraries. If you can, create a C file and include a function that has the same name as a module in the library. The compiler will look at the local directory, and use your version of the module, rather than the one in the library. SEE ALSO
Last Reviewed: Thursday, February 25, 2021 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.