declaring array of constants in ROM

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

declaring array of constants in ROM

跳至解决方案
942 次查看
stevec
Contributor III

Hi,

I'm using a 9S08QE8 and wish to declare an array of constant ints into ROM and be able to reference them from another module.

I have used :

const static unsigned int page_table[] = {.........};

in the .h files with

extern unsigned int page_table[31];

to declare it to other modules.

 

I get linker error L1823 as well as an out of RAM error (because it has put it in RAM).

 

Can someone point me in the right direction. I have spent all afternnon trying to get this right. It sounds simple enough.

 

Thanks

 

Steve

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
737 次查看
BlackNight
NXP Employee
NXP Employee

I would make the declaration const too:

extern const unsigned int page_table[31];

Additionally, if you have it extern, then do *not* use static for the implementation:

const unsigned int page_table[] = {.........};

I hope this helps.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
738 次查看
BlackNight
NXP Employee
NXP Employee

I would make the declaration const too:

extern const unsigned int page_table[31];

Additionally, if you have it extern, then do *not* use static for the implementation:

const unsigned int page_table[] = {.........};

I hope this helps.

0 项奖励
回复
737 次查看
stevec
Contributor III

Hi Erich,

That seems to have sorted it. Many thanks. I will need to understand what I did wrong so I don't make the same mistake again. Back to the books!

0 项奖励
回复