Reserve a part of internal flash for storing data

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

Reserve a part of internal flash for storing data

1,772 Views
elel
Contributor III

Hello

 

In my application I need to store some data(variable data) into the internal flash, because I need to set this data and preserve their values after a reboot.

 

I'm using a Mcf52259demo board with mqx 3.5.1.

 

I've think to create a new section in .lcf files where I can store my variables; but I can't do this, because the .lcf file it's create when I compile the bsp project. So I think I've to modify something in the bsp project, but I haven't understand what.

 

Anyone knows wich are the settings that create the .lcf file? or another way to store data in flash?

 

Thanks in advance.

 

Stefano

 

0 Kudos
Reply
3 Replies

832 Views
JuroV
NXP Employee
NXP Employee

Hi,

 

LCF files are created manually and you can modify them if you need. LCF files are not created when compiling at all. Output file generation phases are:

1. asm file -> assembler preprocessor - assembler processor -> obj file

2. C file -> C preprocessor - C processor -> obj file

3. obj files + LCF file -> linker -> ELF file

 

Another way to store data in flash is to use flashx driver. This enables you to store dynamic data in the flash.

 

jv

0 Kudos
Reply

832 Views
elel
Contributor III

Hi JuroV, thanks for your reply.

 

My problem is that I have to store some data, and preserve their values after a reboot and an update too.

 

Actually I'm using flashx driver, and in this way I can store data in flash, and preserve their value until I'll do a software update.

 

So I've think to modify .lcf file and create a new segment of flash where I can store my data, in way to protect this segment from an update.

I've modified the .lcf file, and I've create this segment, but if I compile the bsp project the .lcf file lose my changes.

 

How can I achieve my goal?

 

Stefano

0 Kudos
Reply

832 Views
DavidS
NXP Employee
NXP Employee

Hi Stefano,

Normally an application would have its own linker file but since the FSLMQX is a huge software package supporting many processors and demo's, the linker files have been consolidated to the following path:

\Freescale MQX 3.5\mqx\source\bsp

with specific path for M52259EVB of:

\Freescale MQX 3.5\mqx\source\bsp\m52259evb\cw\intflash.lcf

 When you compile the build_libs.mcp, it linker scripts are copied from the above path into the following path:

\Freescale MQX 3.5\lib\m52259evb.cw\mqx

You application or the demo (and \mqx\examples) reference the linker files in the \lib path.

So if you want to modify the "real" linker script it is the \mqx\source\bsp path.

Alternatively you can copy any of the linker scripts into your application path and load it into your project and use.

Regards,

David

0 Kudos
Reply