I using HCS12 microcontroler. I declared a variable in RAM with NO_INIT qualifiers. But it seems like on some units, the variable is initialized have POR. Does someone have an idea why?
//.prm
RAM_NO_INIT = NO_INIT 0x0000400F TO 0x0000400F;
_RAM_NO_INIT INTO RAM_NO_INIT;
//main
#pragma DATA_SEG _RAM_NO_INIT
static byte FirmwareUsbRequestFlag;
#pragma DATA_SEG DEFAULT
已解决! 转到解答。
Hello
Well if this is only happening on some units, that means that startup code is not modifying the values (as expected by the NO_INIT attribute).
Here I would recommend you to check what the MCU reference manual is saying about that.
Is content of RAM preserved after a POR? Under which conditions?
Also I would recommend you posting the question in the Hardware forums as this seems to be hardware related.
CrasyCat
Hello
Well if this is only happening on some units, that means that startup code is not modifying the values (as expected by the NO_INIT attribute).
Here I would recommend you to check what the MCU reference manual is saying about that.
Is content of RAM preserved after a POR? Under which conditions?
Also I would recommend you posting the question in the Hardware forums as this seems to be hardware related.
CrasyCat
Hello
What do you mean exactly with "on some units, the variable is initialized have POR"?
Are you expecting a specific value there?
The attribute NO_INIT in the linker files just tells the linker that startup code should not modify content of memory.
So value stored there is undefined (remains set to whatever was stored there previously.)..
CrasyCat
The value stored in the NO_INIT region is not always preserved after a POR. But we do not observed this problem on all the microcontroler. 99% the value is fine, the content of the memory is not modified, but on some unit (that have the exact same hardware) the content is modified.