How to use “__attribute__” on MC9S12XEP100R chip?

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

How to use “__attribute__” on MC9S12XEP100R chip?

跳至解决方案
878 次查看
TingTing
Contributor II

Hi Developer,
I want to set a const value into plash with a const address. Then I met error as picture:
How to resolve it?
BR, Shi Ting Ting

TingTing_0-1609824144621.png

 

0 项奖励
回复
1 解答
875 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

CodeWarrior for HCS12(X) uses const to define global variable to FLASH. 

for example,

       const int VersionNbr = 2;

if define a const variable in a specific address, @is used, for example

    const unsigned int mycst_data@0xF08000=0xAAAA;

 

If these const variables are not used anywhere in the application, you have to instruct the Linker to avoid optimization.

This is done specifying the constant name in the .prm file ENTRIES block.

For example:

ENTRIES

  VersionNbr mycst_data

END

 

Please try it. If any issue, contact me again.

 

Have a nice day,

Jun Zhang

 

 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
876 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

CodeWarrior for HCS12(X) uses const to define global variable to FLASH. 

for example,

       const int VersionNbr = 2;

if define a const variable in a specific address, @is used, for example

    const unsigned int mycst_data@0xF08000=0xAAAA;

 

If these const variables are not used anywhere in the application, you have to instruct the Linker to avoid optimization.

This is done specifying the constant name in the .prm file ENTRIES block.

For example:

ENTRIES

  VersionNbr mycst_data

END

 

Please try it. If any issue, contact me again.

 

Have a nice day,

Jun Zhang

 

 

0 项奖励
回复
861 次查看
TingTing
Contributor II

Hi Jun Zhang,

Thanks for your reply.

You mean use '@', but I cannot find '@' in your example.

I want to set a fixed value into fixed address in paged flash,for example,write 0x1234 into 0xFCBFF0.

How can I do?

Thank you so much.

BR, Shi Ting Ting

0 项奖励
回复
858 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

I correct the example, please check it again.

Thanks,

Jun Zhang