| |||||
Technical Support Support Resources
Product Information | LX51: LOCATING CONSTANT (CODE) VARIABLES IN A CODE BANKInformation in this article applies to:
QUESTIONHow 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. ANSWERWhen 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 µVision 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
FORUM THREADSThe following Discussion Forum threads may provide information related to this topic. Last Reviewed: Friday, July 15, 2005 | ||||
| |||||