Storing variable in flash

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

Storing variable in flash

ソリューションへジャンプ
3,275件の閲覧回数
rmaier
Contributor III

Hello,

 

I'm using an MC9S12P128 MCU, and I'd like to store some constants in D-flash. I have the D-flash segment defined as

 

DFLASH        = READ_ONLY   0x010400 TO 0x0113FF;

 

So, when I go to write the constant, I use the following:

 

#pragma CONST_SEG CAL_VAL
volatile const unsigned char __near constant1=0x7F;

 

When I look at where this is in the memory, it shows up as 0xC015. To me, that's nowhere in the range define above. What am I missing here?

ラベル(1)
0 件の賞賛
返信
1 解決策
3,124件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Robert.

I just made a quick test but I didn't reproduce your problem.

see attached demo code and video.

 

Have a great day,
Jennie Zhang
 
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
3,125件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Robert.

I just made a quick test but I didn't reproduce your problem.

see attached demo code and video.

 

Have a great day,
Jennie Zhang
 
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
3,124件の閲覧回数
rmaier
Contributor III

I do not see any attachments. Can you please post?

0 件の賞賛
返信
3,124件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Can't you see it?

here is the screenshot of it

pastedImage_1.png

0 件の賞賛
返信
3,124件の閲覧回数
rmaier
Contributor III

Thank you, Jennie. The video was very helpful. I missed some items in the prm file.

Not sure how I missed the video. My appologies.

0 件の賞賛
返信
3,124件の閲覧回数
rmaier
Contributor III

I hacked a solution. I defined constant1 in D-flash as follows:

const unsigned char constant1 @ 0x0400;

Then I can write to D-flash at this location, and all is well...

0 件の賞賛
返信