How to place an array of constants in a flash?

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

How to place an array of constants in a flash?

Jump to solution
1,773 Views
Florijan
Contributor III

Hi,

 

i am using  CodeWarrior 6.2. I can't put an array of constants in a flash when using Coldfire V1 mcu. It works very well with 8-bit s08 mcus. Can someone please tell me how to make it work with Coldfire V1 mcus also.

 

For example, i want these array in a flash:

 

const char [8][200];

Labels (1)
0 Kudos
Reply
1 Solution
529 Views
Florijan
Contributor III

Dear pgo,

 

i have found the solution. The catch was that the const array was put in to the flash correctly while the interface on the left side of a Codewarrior window reported increase in data instead of a code and I was thinking that it is placed in ram. Maybe this is a minor bug. Because it is only the case when using Coldfire V1 processors.

 

Have a nice day!

View solution in original post

0 Kudos
Reply
2 Replies
529 Views
pgo
Senior Contributor V

Dear Florijan,

 

I'm won't pretend to be an expert on the subtities of C constants but I think that a 'definitiion' of a constant array without an initialisation is treated differently to one with. It's treated as a declaration rather than a definition.  You are free to define the array in another location - the const qualifier  on the declaration appears to be ignored for placement.

 

If I declare an _initialised_ constant array:

 

const unsigned char dummy[5] = {1};

 

it ends up in the ROM area.

 

However,

const unsigned char dummy[5];

 

ends up in RAM.

 

 

So - either initialise the array or use the @notation to place the array in Flash.

 

const unsigned char myData[10]@0x1000;

 

bye

 

PS. Above tested with  CW v6.2.2?

Message Edited by pgo on 2009-06-28 11:19 AM
0 Kudos
Reply
530 Views
Florijan
Contributor III

Dear pgo,

 

i have found the solution. The catch was that the const array was put in to the flash correctly while the interface on the left side of a Codewarrior window reported increase in data instead of a code and I was thinking that it is placed in ram. Maybe this is a minor bug. Because it is only the case when using Coldfire V1 processors.

 

Have a nice day!

0 Kudos
Reply