Keil Logo

BL51: Locating Groups of Code Segments Together


Information in this article applies to:

  • C51

QUESTION

My CODE memory starts at 100H, however, I have a collection of USB functions that I wish to locate starting at 8000H. Is there any way to do this without specifying a starting address for every single function?

ANSWER

Yes. The following is an example which locates the USB functions usb_func1(), usb_func2() and usb_func3(), defined in the source file locate.c starting at 8000H:

CODE(?PR?USB_FUNC1?LOCATE(8000H), ?PR?USB_FUNC2?LOCATE, ?PR?USB_FUNC3?LOCATE, 100H)

The linker processes the arguments one at a time. It locates the first segment at address 8000H and from then on locates every specified segment sequentially in memory. It finally reaches the 100H and from that point onwards locates every other segment in the project sequentially in memory starting at that address.

The same technique can be used for multiple groups of segments. For example:

CODE(?PR?FUNC1?LOCATE(4000H),?PR?FUNC2?LOCATE,?PR?FUNC3?LOCATE(8000H),?PR?FUNC4?LOCATE,100H)

locates functions func1() and func2() starting at 4000H, functions func3() and func4() starting at 8000H, and the rest of the code segments starting at 100H.

MORE INFORMATION

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
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.