NO_INIT does not work

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

NO_INIT does not work

跳至解决方案
1,957 次查看
admin
Specialist II

I using HCS12 microcontroler. I declared a variable in RAM with NO_INIT qualifiers. But it seems like on some units, the variable is initialized have POR. Does someone have an idea why?

 

//.prm

  RAM_NO_INIT =  NO_INIT              0x0000400F TO 0x0000400F;

_RAM_NO_INIT                     INTO RAM_NO_INIT;

 

//main

 

#pragma DATA_SEG _RAM_NO_INIT

static byte FirmwareUsbRequestFlag;

#pragma DATA_SEG DEFAULT

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,250 次查看
CrasyCat
Specialist III

Hello

 

Well if this is only happening on some units, that means that startup code is not modifying the values (as expected by the NO_INIT attribute).

 

Here I would recommend you to check what the MCU reference manual is saying about that.

Is content of RAM preserved after a POR? Under which conditions?

 

Also I would recommend you posting the question in the Hardware forums as this seems to be hardware related.

 

CrasyCat

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,251 次查看
CrasyCat
Specialist III

Hello

 

Well if this is only happening on some units, that means that startup code is not modifying the values (as expected by the NO_INIT attribute).

 

Here I would recommend you to check what the MCU reference manual is saying about that.

Is content of RAM preserved after a POR? Under which conditions?

 

Also I would recommend you posting the question in the Hardware forums as this seems to be hardware related.

 

CrasyCat

0 项奖励
回复
1,250 次查看
CrasyCat
Specialist III

Hello

 

What do you mean exactly with "on some units, the variable is initialized have POR"?

Are you expecting a specific value there?

 

The attribute NO_INIT in the linker files just tells the linker that startup code should not modify content of memory.

So value stored there is undefined (remains set to whatever was stored there previously.)..

 

CrasyCat

0 项奖励
回复
1,250 次查看
admin
Specialist II

The value stored in the NO_INIT region is not always preserved after a POR. But we do not observed this problem on all the microcontroler. 99% the value is fine, the content of the memory is not modified, but on some unit (that have the exact same hardware) the content is modified.

0 项奖励
回复