SEGMENTS RAM_1 = READ_WRITE 0x800 TO 0x8FF FILL 0xAA 0x55; END
MY_STK = NO_INIT 0x0C60 TO 0x105F FILL 0x55; // 1024 byte
// initialize stack with 0x55 "U" memset((void*)0x0C60, 0x55, 0x3E0);
I think FILL command is not working for my project. I'm not sure.
Regards,
BP.
>MY_STK = NO_INIT 0x0C60 TO 0x105F FILL 0x55; NO_INIT : do not init. FILL: do init with FF. Basically that does not work together. FILL only works with segments which are actually containing content. So to fill the stack, you have to use runtime code as you did. Using memset on the whole stack except the last 0x10 bytes is a bit problematic too, as this will suddenly start to fail as soon as main and memset together use more memmory. Daniel
void main(void){ __RESET_WATCHDOG(); // initialize stack with 0x55 "U" memset((void*)0x0C60, 0x55, 0x3E0);...
Here is my prm file to fill unused program memory with illegal opcode (0x8D):
SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */ Z_RAM = READ_WRITE 0x0060 TO 0x00FF; // 160 byte RAM = READ_WRITE 0x0100 TO 0x085F; // 1888 byte NO_INIT_RAM_SEG = NO_INIT 0x0860 TO 0x0C5F; // 1024 byte MY_STK = NO_INIT 0x0C60 TO 0x105F; // 1024 byte NV_SAVE_SEG = READ_ONLY 0x1060 TO 0x13FF; // reserve 928 (512) byte for NV ROM1 = READ_ONLY 0x1400 TO 0x17FF FILL 0x8D; ROM = READ_ONLY 0x1870 TO 0xFEAF FILL 0x8D; FLASH_ROUTINE_SEG = READ_ONLY 0xFEB0 TO 0xFFAF FILL 0x8D; ROM2 = READ_ONLY 0xFFC0 TO 0xFFD1 FILL 0x8D;/* INTVECT = READ_ONLY 0xFFD2 TO 0xFFFF; Reserved for Int. Vectors*/END
and it seems working.
Thanks.
BP.