declaring array of constants in ROM

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

declaring array of constants in ROM

ソリューションへジャンプ
924件の閲覧回数
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 解決策
719件の閲覧回数
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 返答(返信)
720件の閲覧回数
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 件の賞賛
返信
719件の閲覧回数
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 件の賞賛
返信