Hi Tom
You can allocate a constant variable at an absolute address using the @ modifier.
For example allocating a constant called VersionNbr at address 0xF000 and initializing it to 2 is done as follows:
const int VersionNbr @0xF000 = 2;
Same notation can be used for a constant string as follows
const char VersionStr[] @0xF000 ="Version 4.6";
if you don't use @, CW will allocate const variable to default const section automatically.
If this version number is not used anywhere in the application, you have to instruct the Linker to link it to the application even though it is not used.
This is done specifying the constant name in the .prm file ENTRIES block.
For example:
ENTRIES
VersionNbr VersionStr
END
Last, please enable –Cc option in Compiler option setting panel.
Have a great day,
Jun Zhang
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------