Keil™, An ARM® Company

Technical Support

C251: LOCATING CONSTANTS IN CODE SPACE

QUESTION

Is there a way to put constants in code space using the C251 tools?

ANSWER

Yes. You may receive a syntax error if you try to assign your constant a type, initialize its value, and absolutely locate it. Fortunately, there is a much easier way to do this.

First, move all of the constants that you want relocated into a file of their own.

Next, declare the constants code space with the appropriate types and intialize their values. For example:

int code junk = 0x1234;

Finally, use the SEGMENTS tab in the L251 Linker Options to locate the constants in your new module at the address you want. For example:

In one of the segment fields, enter: ?CO?<module name>(FF8000H) This locates all of the constants in <module name> at address 0xFF8000.

Last Reviewed: Sunday, May 16, 2004


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