Store constant array into internal flash

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

Store constant array into internal flash

1,187 Views
ranjithshanbhag
Contributor III

Hi,

Can you tel how to store constant array into internal flash memory lpc824?

I referred below link. Still not able to save.

http://host.lpcware.com/content/forum/compile-and-store-constant-array-external-flash-memory-lpc1788...

Thanks.

Labels (1)
Tags (1)
3 Replies

969 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Ranjith,

Are you giving any use for the array App1_0? In the .map file that you attach you can see that the compiler is performing a optimization with the array (does this automatically). In the line 118 of the file .map you can see that it says "Discarded input sections" (See image below) and below that in line 131 is the array you want App1_0, you will see that the address is 0x00000000 that means that the variable is not located in the flash because it was optimized, this always happens because you declare the variable but you are not using it.

Capture.JPG

For example, I declare the same array than you in a random program and below the declaration I used the array in an IF condition:

if(App1_0[45])

Once I made this I got the next result in the .map file 

Capture2.JPG

Once you use the variable it declares it in a  valid memory address, in this case  0x00001de0 instead of the 0x00000000 of before.

Hope this solve your problem.

Have a great day, 

Victor.

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

969 Views
ranjithshanbhag
Contributor III

Hi Victor,

Thanks for your valuable reply.

I verified .map file for particular data (App1_0[ ]) which I want to save in flash. I build the project without any optimization.

I attached .map and .c file attached for your reference.

Thanks,

Regards,

Ranjith

0 Kudos

969 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Ranjith,

When you declare any constant variable it goes directly to the flash memory. So all you need is to declare the array.

const uint32_t test[2]={1,2};

The array test will go directly to the flash memory of the LPC824. You can check the result in the .map file. Also It is important to check that the compiler is not performing any optimization with the array for not being used. 

Have a great day, 

Victor.

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------