I am using MC9S08SG32 and trying to write version number to a specified ROM address, how to do that? e.g. at ROM address 0x800, write version number "1.00", and from 0x8004 to store regular code.
I assume you are using CodeWarrior for MCU V6.x. Right?
I also assume you want to store the version number as a string (array of char).
I also assume there is a typo in your message and string is expected at address 0x8000.
You need to remember that in ANSI C every string need to be terminated by a NULL character(0x00). So you need to reserve at least 5 bytes for your version number.
To allocate the version number at address 0x8000, define following object in one of your C source files:
const char Version @0x8000 = "1.00";
Then change your .prm file to ensure the linker does not allocate anything over that memory area.
ROM = READ_ONLY 0x8000 TO 0xFFAD;into
ROM = READ_ONLY 0x8005 TO 0xFFAD;
Link your application. That should be it.
Retrieving data ...