Hi,
Thank you for posting your questions.
We can't do this for a specific variable but we can do it for a section. I suggest you use NO_INIT qualifier to the RAM section that you don't want be initialized.
NO_INIT: used for address ranges where read/write accesses are allowed. The linker does not initialize memory area defined with this qualifier at application startup. This is useful if your target has a battery-buffered RAM or to speed up application startup.
For example:
///////////////////////
SECTIONS
ROM = READ_ONLY 0x1000 SIZE 0x2000;
CLOCK = NO_INIT 0xFF00 TO 0xFFFF;
RAM = READ_WRITE 0x3000 TO 0x3EFF;
Page0 = PAGED 0x4000 TO 0x4FFF;
Page1 = PAGED 0x4000 TO 0x4FFF;
END
/////////////////////////
The CLOCK section is a READ_WRITE memory area. It starts at address 0xFF00 and ends at 0xFFFF (size = 100 bytes). Variables allocated in this segment are not initialized at application startup.
Does this answer your questions?
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------