Keil Logo


Information in this article applies to:

  • C51 Version 7.00


I must locate a specific string (whose length will vary from build to build) at the end of a 32KB code ROM. Is there any clever way to do this?


Yes. The LX51 Linker allows you to locate a segment by specifying its ending address. To use this feature for your application you must:

  1. Create a new source file that contains only the string to locate at the end of the ROM. For example:
    //--- Source File:  Version.C ---
    char code device[] = "My Device V1.00 Beta";
  2. Invoke the LX51 linker using the segments directive as follows:
    LX51 Version.obj SEGMENTS (?CO?Version (^C:0x7FFF))

This locates the segment ?CO?Version (that holds the version string) so that it ends at address C:0x7FFF. If you use the µVision2 IDE, you must select the extended LX51 linker/locater and, under Options for Target - LX51 Locate - Segments:, enter ?CO?Version (^C:0x7FFF).


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

Last Reviewed: Friday, July 15, 2005

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.