Keil™, An ARM® Company

Technical Support

LX51: LOCATING A SEGMENT'S ENDING ADDRESS


Information in this article applies to:

  • C51 Version 7.00

QUESTION

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?

ANSWER

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

MORE INFORMATION

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

Last Reviewed: Friday, July 15, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure