I'm trying to place a variable in an absolute flash location. Target is S12ZVM and I'm using codewarrior.
Can you help me with some reference for this scenario.
Thanks in Advance
Solved! Go to Solution.
Hello AjRj14,
Sorry for my mistake – it has to be used:
#pragma DATA_SEG ROM_VAR
Then define such data… and at the end use:
#pragma DATA_SEG DEFAULT
The CODE_SEG saves the functions and the DATA_SEG saves the data.
Sorry once again.
Best Regards,
Stano.
Hello AjRj14,
You need modify the *.prm file for this MCU – select such FLASH space for this variable:
In “SEGMENTS” define “ROM_VAR_SPACE” (I selected small part of FLASH);
Then in “PLACEMENT” tell linker ROM_VAR data must be placed to ROM_VAR_SPACE.
Then in main.c use:
The ROM_Variable is the variable saved in defined FLASH position.
I hope it could help you.
Best Regards,
Stano.
Thanks StanoA.
But after building the project, the ROM_VAR_SPACE area is not getting reflected in the .sx file.
Is this expected one? For the ROM_VAR_SPACE area to get reflected in .sx file, what I have to do. Could you please help me on this.?
Thanks in advance..
Hello AjRj14,
Sorry for my mistake – it has to be used:
#pragma DATA_SEG ROM_VAR
Then define such data… and at the end use:
#pragma DATA_SEG DEFAULT
The CODE_SEG saves the functions and the DATA_SEG saves the data.
Sorry once again.
Best Regards,
Stano.