Data in DFLASH

cancel
Showing results for 
Search instead for 
Did you mean: 

Data in DFLASH

321 Views
Contributor III

Hi!

I'm planning to put some data in the dflash of SPC5602B and for that reason creating some variables with addresses starting from 0x00800000.

I have created a new memory area in the LCF:

dFlash_sector0: org = 0x00800000, len = 0x00004000

and created a section:

GROUP : {

.__DflashStorage : {}

} > dFlash_sector0

in .c file:

#pragma push /* Save the current state */

#pragma section const_type ".__DflashStorage"

__declspec(section ".__DflashStorage") char my_data;

char my_data;

#pragma pop

 

When trying to compile this I get the error :

section '.__DflashStorage' must have an uninitialized data section for object 'nodeIdDflash'

I don't know if I have done a minor error or if the approach is totally wrong.

Best Regards

Bengt Andersson

0 Kudos
2 Replies

12 Views
NXP Employee
NXP Employee

Hello Bengt

Your approach is right, but please try to adjust your pragma section to include also uninitialized consts and small consts too. I also removed __declspec since if there is #pragma section const_type... it's not needed.

#pragma push /* Save the current state */

#pragma section const_type sconst_type ".__DflashStorage" ".__DflashStorage"

char my_data;

#pragma pop

hope it helps!

Stan

0 Kudos

12 Views
Contributor III

Hi Stan!

I have finally had some time to try this fix. I works but only almost. It compiles and links without problems but at __init_data() in __start.c it tries to copy data from address 0xC000 to my address in DFLASH which is impossible and I think this is the reason why my application finally craches. If I could find a way to avoid this copying I think it will work. Any suggestions??

Best Regards

Bengt Andersson

0 Kudos