|ARM Technical Support Knowledge Articles|
Applies to: LX51 Linker/Locator
Information in this article applies to:
I 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 uVision?
This answer pertains to all of the source files in C:KeilCxxLib, 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:
... MEMORY MODEL: SMALL INPUT MODULES INCLUDED:.PUTCHAR.obj (PUTCHAR)
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:KeilCxxLib 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.
Article last edited on: 2007-06-04 11:14:02
Did you find this article helpful? Yes No
How can we improve this article?