How to use “__attribute__” on MC9S12XEP100R chip?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use “__attribute__” on MC9S12XEP100R chip?

Jump to solution
1,078 Views
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 Kudos
Reply
1 Solution
1,075 Views
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

 

 

View solution in original post

0 Kudos
Reply
3 Replies
1,076 Views
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 Kudos
Reply
1,061 Views
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 Kudos
Reply
1,058 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

I correct the example, please check it again.

Thanks,

Jun Zhang