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):

  1. Copy the PUTCHAR.C source file from the C:KeilCxxLib directory into your project directory. The project directory is the folder where the .uv2 file for your project is located.


    • Do not modify the source files in C:KeilCxxLib. These files are overwritten during uVision upgrade process, and any changes to them will be lost.
  2. Add the copied version of PUTCHAR.C (now in your project directory) to your project window and make your modifications.
  3. Compile and link your project.

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: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

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential