MICROCONTROLLER RECORD INITIAL PARAMETERS

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

MICROCONTROLLER RECORD INITIAL PARAMETERS

跳至解决方案
1,421 次查看
Superdiode
Contributor II

Hello:

I'm currently using the flash to record a HC08GZ60 both the program and certain parameters for the user.

My intention is that when recording the microcontroller, these parameters are in their initial defaults recorded in flash.
In other words, I want the compiler to generate code that I record certain values in certain positions of flash.
I've tried with directives "# pragma" and many inventions, but I get nothing.

I hope you can help me.
Thank you.

标签 (1)
标记 (4)
0 项奖励
回复
1 解答
1,300 次查看
Derrick
NXP Employee
NXP Employee

Hi David,

If I understand correctly, you want to store a group of values at a specific Flash memory address location when you compile your code.  I usually do this by declaring a constant string or structure.  The following will store the byte values 0x00, 0x01, 0x02, and 0x03 starting at address 0x8000:

const byte FlashData [] @0x8000 = { 0x00, 0x01, 0x02, 0x03};

By default, the linker will locate any constant values in Flash.  So 0x8000 will need to be a valid Flash address.

Does this help?

Best Regards,

Derrick

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,301 次查看
Derrick
NXP Employee
NXP Employee

Hi David,

If I understand correctly, you want to store a group of values at a specific Flash memory address location when you compile your code.  I usually do this by declaring a constant string or structure.  The following will store the byte values 0x00, 0x01, 0x02, and 0x03 starting at address 0x8000:

const byte FlashData [] @0x8000 = { 0x00, 0x01, 0x02, 0x03};

By default, the linker will locate any constant values in Flash.  So 0x8000 will need to be a valid Flash address.

Does this help?

Best Regards,

Derrick

0 项奖励
回复
1,300 次查看
Superdiode
Contributor II

Hi Derrick:

Thanks for your answer... i'm, testing. I need some time.

0 项奖励
回复
1,300 次查看
Superdiode
Contributor II

Hi Derrick:

Sorry I took so long to answer, but sometimes I have more serious problems and I must leave some issues for later.

The code that I have said is just what I needed, I never would have thought to put "const" because I saw it as a variable.

Thank you very much.

0 项奖励
回复