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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

917件の閲覧回数
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 返答(返信)

902件の閲覧回数
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 件の賞賛

827件の閲覧回数
cyndymejia
Contributor I

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

png to ico

0 件の賞賛