I can set a variable in the ROM area as following: #define END_CODE_SIZE 0x3FFF char code CRCbyte _at_ END_CODE_SIZE How do I set its value to says 0xAA? I can do this: char code CRCbyte = 0xAA; Then The variable is not allocated to the END_OF_CODE. Thanks for reading this. HN
I think the easiest way to do this is to place the 'variable' in a source file on its own, then direct the linker to place the resulting segment at the correct address. Isn't it a shame that Keil doesn't allow initialisers with the _at_ keyword? Stefan
I also found another way. I create an assembly file with code as: PUBLIC CrCValue CSEG at LOCATION CrcValue: DB VALUE END Then in C code, I can use: extern char CrCValue. It works. Too bad I can not use #ifdef, ... to have different CRC values for different targets. Thanks.