Keil Logo


Information in this article applies to:

  • C51 All Versions


How do I locate a C function at an absolute address? I succeeded in variables using _at_, but it doesn't work for functions.


You must use the BL51 Linker or LX51 Linker to locate functions at fixed addresses. To do so, make a note of the function name and the source file in which it is saved. The compiler creates a symbol name for the function using the following format:


So, the function named func in main.c would have a symbol name of:


Everything is uppercase to comply with the OMF51 standard.

There may be derivatives of this naming convention. For example, if the function accepts arguments that can all be passed in registers, the function name is prefixed with an underscore ('_') and the above would be:


You may look in the linker's map file to figure out the symbolic names for your functions.

Once you know the symbolic name, it is a simple matter of telling the linker where to locate it using the CODE directive. For example:

BL51 main.obj code(?pr?func?main(2000h))

Tells the linker to locate the function func at code address 0x2000.

If you use the µVision IDE you may enter the starting address for segments under Project - Options for Target. For the BL51 Linker/Locater enter the following code segment with the address under BL51 Locate - Code. For the LX51 Linker/Locater enter it under LX51 Locate - User Segments:



  • Refer to CODE in the BL51 User's Guide.
  • Refer to SEGMENTS in the LX51 User's Guide.


The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Wednesday, October 4, 2006

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

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.