ARM Technical Support Knowledge Articles

LOCATING CONSTANT (CODE) VARIABLES IN A CODE BANK

Applies to: LX51 Linker/Locator

Answer


Information in this article applies to:


QUESTION

How do I locate a constant variable in a code bank using the Extended Linker ( LX51 ) ? I have a source file with a table declared as follows:

unsigned char const code table [10] =
  { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };

When I compile and link, the functions in this source file are located in the correct bank, but the table is located in the common area.

ANSWER

When you compile a source file (for example FBANK1.C), the compiler creates program segments for your functions and code segments for your code-based variables. Each function is located in a segment named ?PR?function_name?source_file_name. All code variables are located in a segment named ?CO?source_file_name. This is also true for literal strings.

The linker has commands that let you automatically locate all of the program code from a source file in a code bank. However, the code segments from that file are NOT located in the code bank. You must do that manually.

To locate the code variables in a particular bank, link using a similar command line:

LX51 FBANK1.OBJ,B.OBJ SEGMENTS (?CO?FBANK1(B1:0x8000)) ...

If you use the uVision IDE, enter the following in the User Segment box in the LX51 Locate dialog box.

?CO?FBANK1 (B1:0x8000)

This locates the code variables and string literals from FBANK1.C in BANK1.

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-15 10:22:33

Rate this article

[Bad]
|
|
[Good]
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