declaring array of constants in ROM

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

declaring array of constants in ROM

Jump to solution
840 Views
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

Labels (1)
Tags (2)
0 Kudos
1 Solution
635 Views
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.

View solution in original post

0 Kudos
2 Replies
636 Views
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 Kudos
635 Views
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 Kudos