S32k148:Copy contents of one section of flash into another

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

S32k148:Copy contents of one section of flash into another

1,013 Views
saad_saeed
Contributor III

Hello,

I have two sections of same size in my linker file S32k1xx_flash.Id. I want to copy contents of one section into another. But I want to know that are there any functions to clear those section and copy contents of one section into another.

Regards,

Saad.

4 Replies

750 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

what is your use case? If you like store for example some static data in two sections - you can use __attribute__ keyword in your code like this: 

__attribute__ ((section(".my_primary_data"))) int primary_data[] = {10,20,30,40,50};

__attribute__ ((section(".my_backup_data"))) int backup_data[] = {10,20,30,40,50};

In linker file you need to define my_backup_data and my_primary_data and sections and if you need them on particular address define - MEMORY region for these sections as well. 

If you just need to copy part of flash in run-time - there are some examples in SDK for writing to flash.

Hope it helps.  

Jiri 

750 Views
saad_saeed
Contributor III

Hello Jiri,

Thanks for the reply. I would like to copy the contents of one section of flash memory into another section at run time. I would be grateful if you can please guide me to an example. I have seen the flash partitioning example. I have study the component flash in detail bit it does not contain any functionality related to copying.

0 Kudos

750 Views
saad_saeed
Contributor III

Hello Jiri,

Thanks for the reply. I would like to copy the contents of one section of flash memory into another section at run time. I would be grateful if you can please guide me to an example. I have seen the flash partitioning example. I have study the component flash in detail bit it does not contain any functionality related to copying.

0 Kudos

750 Views
stanish
NXP Employee
NXP Employee

Hi Saad,

If your goal is to copy one Flash section into another Flash section at runtime then you probably need to use flash programming routines during startup sequence and perform block erase and program. You should also probably use a RAM buffer or place the sections into different flash partition since while executing from a particular PFLASH read partition , FTFC commands (except parallel boot) cannot run over that PFLASH read partition.

Could you perhaps indicate what is goal of such a copy operation?

Regards,

Stanislav

0 Kudos