How to put a structure in a NO_INIT section of RAM?

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

How to put a structure in a NO_INIT section of RAM?

929 次查看
mihir_rajput
Contributor III

 I want to carve out a section of RAM with a NO_INIT qualifier.

This is my implementation. Am I on the right track?

In a c file:

#pragma DATA_SEG restart_detection_ram_data
static RestartStruct_t restart;
#pragma DATA_SEG DEFAULT

In prm file:

SEGMENTS

/* RAM 8k */
STARTUP_RAM = NO_INIT 0x001000 TO 0x00103F; // 64 bytes

RAM = READ_WRITE 0x001040 TO 0x002DFF; // 8k - 64 - 512 bytes

PLACEMENT

SSTACK, /* allocate stack first to avoid overwriting variables on overflow */
DEFAULT_RAM INTO RAM;
restart_detection_ram_data INTO STARTUP_RAM;

0 项奖励
2 回复数

914 次查看
stanish
NXP Employee
NXP Employee

Hi,

Yes, your snippet of using NO_INIT section seems to be valid.

Just make sure that if there is any other variable placed to this section it is not declared as initialized.

Do you observe any particular problems with the code?

Stan

0 项奖励

839 次查看
cyndymejia
Contributor I

Thanks, I give it a go to figure it out.

png to ico

0 项奖励