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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,848 次查看
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 项奖励
1 解答
1,800 次查看
StanoA
NXP TechSupport
NXP TechSupport

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 项奖励
4 回复数
1,832 次查看
StanoA
NXP TechSupport
NXP TechSupport

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.

1,825 次查看
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 项奖励
1,801 次查看
StanoA
NXP TechSupport
NXP TechSupport

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 项奖励
1,795 次查看
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 项奖励