how to allocate an area from internal flash to store private user data in MPC56xx

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

how to allocate an area from internal flash to store private user data in MPC56xx

505 Views
plabgh
Contributor I

Hi,

 

If my 'inernal_flash' length is 1M, i want to allocate 100K memory from 'internal_flash' to store private user data.

Complier and linker can't use the 100K area to store hardware initialization routines, application code, constants and so on.

how should i modify the .lcf file ?

I consider that whether only modify length of 'internal_flash' segment from 1M to 924K in .lcf file ?

The 'internal_flash' segment defined in a MEMORY directive is used to to store sections .init, .text, .rodata, .ctors, .dtors, extab, extabindex and so on.

what operation I need to carry out for .lcf file ?

1、whether i need use .lcf file's MEMORY directive to associate a name 'myrom' for the 100K area ?

2、And then whether i need use .lcf file's SECTIONS directive to define a section which will be loaded in the memory area named 'myrom' ?

3、Finally, using #pragma and __declspec() directives to specify private user data write to specific section in source file ?

The 100K area is used to store all global variable value of CW every 60 seconds by flash_write driver function. After power-on startup, using flash_read driver function to read these global variable value which are stored in the 100K area last time. After the reading of global variable value, respectively assigning these read vlaue to global variable of CW project in order.

Could you tell me how to implement the feature ?

Tks.

 

PS:

flash_read and flash_write driver functions are linked into 'inernal_flash' segment.

The 100K area can only be used to store all global variable value of CW project, not object code or/and other data.

I have never attempted to program the internal flash using Processor Expert Component, so i'm not familiar with this tool.

Whether there are any other methods or ideas to solve the problem through modifying .lcf file ?

Labels (1)
0 Kudos
1 Reply

293 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Please, take a look on following example code:

https://community.freescale.com/docs/DOC-101849

It shows very simple flash programming of user data, also it contains modified linker files. I believe it could help you to solve your issue.

0 Kudos