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