how to copy the data in the flash to RAM for special address before project start running

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

how to copy the data in the flash to RAM for special address before project start running

472 Views
明伟张
Contributor III

Dear all;

I need to copy the data  that from the flash special address to the RAM adress which is special;before project start running;

 

thanks for supply the sample code;

Labels (1)
0 Kudos
1 Reply

292 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Here I have described how it is possible to relocate code to the RAM:

https://community.freescale.com/thread/386638

Similar approach can be used with data as well but

- variable is already located in RAM whilst its default value is being loaded from flash during init, thus I don’t see any reason for relocation

int i = 10;

- if you need specific alignment, use pragma aligned like this (aligns to 8 bytes)

vuint32_t test[2] __attribute__ ((aligned (8))) =

{

    0xBABADEDA,

    0xABBAABBA

};

- if you really need to access specific address, you can do it as follows where 0x40000000 specifies address (don’t forget to reserve space in linker command file) for this accesses:

*(unsigned int*)0x40000000  = 0x44444444;

0 Kudos