ARM Technical Support Knowledge Articles

LOCATING CONSTANT (CODE) VARIABLES IN A CODE BANK

Applies to: BL51 Code-banking Linker/Locator

Answer


Information in this article applies to:


QUESTION

How do I locate a constant variable in a code bank? 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 MYCODE.C), the compiler creates program segments for your functions and code segments for your code-based variables.

Each function will be located in a segment named ?PR?function_name?source_file_name.

All code variables will be located in a segment named ?CO?source_file_name.

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:

bl51 ... bankarea (0x8000,0xFFFF) BANK0(?CO?MYCODE (0x8000)) ...

or

bl51 ... bankarea (0x8000,0xFFFF) BANK0(0x8000, ?CO?MYCODE) ...

If you use the uVision IDE, enter the following in the Misc Controls input box in the L51 Misc dialog box.

BANK0(?CO?MYCODE (0x8000))

This locates the code variables from MYCODE.C in BANK0.

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-15 14:10:20

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