Hi, I would like to preset a byte at a specific adress in the code memory with a specific value. code char BYTE=0x55; //works, but adress not specified code char BYTE _at_ 0xF000; //works, but value not specified code char BYTE=0x55 _at_ 0xF000; //leads to Sytanx Error How do I tell the Compiler to preset the byte in the code memory? Thanks, Lutz
The manual states two limitations of the _at_ keyword: "1. Absolute variables cannot be initialized." So you can't do it that way. I'm sure this was discussed not so long ago - use the Forum Search (link in the left sidebar) Get the Linker to fix the location?
searching the Forum was not so easy, as it refuses to search for "_at_" Doh! :-( Anyway, the Thread is, "Writing constant to ROM" http://www.keil.com/forum/msgpage.asp?Offset=-1&MsgID=1197 Jon Ward suggested this link: http://www.keil.com/support/docs/301.htm
Thank you very much for the answer. I wonder that the Keil-Compiler has so much problems in combinig the _at_ directive and initialization. I think it's a pretty complicate way to make the compiler generate assembler-code like: cseg org 0F000H foo: DB 0EEH END Funny: Keil's low-cost competitor 'Raisonance' allows such a syntax: at 0xF000 code const char foo=0xEE; and it works pretty fine. Lutz