placing data in an absolute address in flash(ROM) : NXPS12ZVM

cancel
Showing results for 
Search instead for 
Did you mean: 

placing data in an absolute address in flash(ROM) : NXPS12ZVM

Jump to solution
927 Views
AjRj14
Contributor III

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

0 Kudos
1 Solution
879 Views
StanoA
NXP Employee
NXP Employee

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.

View solution in original post

0 Kudos
4 Replies
911 Views
StanoA
NXP Employee
NXP Employee

Hello AjRj14,

You need modify the *.prm file for this MCU – select such FLASH space for this variable:

StanoA_0-1634045132656.png

 

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:

StanoA_1-1634045132674.png

 

The ROM_Variable is the variable saved in defined FLASH position.

I hope it could help you.

Best Regards,

Stano.

904 Views
AjRj14
Contributor III

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..

0 Kudos
880 Views
StanoA
NXP Employee
NXP Employee

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.

0 Kudos
874 Views
AjRj14
Contributor III

Hi StanoA,

But I was using the DATA SEG only and not CODE SEG, as you have mentioned in the previous screenshot.

AjRj14_0-1634127127620.png

Please find my .prm file and main.c attached.

 

0 Kudos