Using SPIFI to store data and program at the same time.

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

Using SPIFI to store data and program at the same time.

1,126 Views
NVazquez
Contributor IV

I am using LPC540xx evaluation board, with SPIFI pooling example.

I am using SPIFlash to store data and my program at the same time.

I'm trying to store 336kbytes of memory.

 

I am able to view the data stored under "memory" at location 0x10000000 at my MCUxpresso IDE.

 

The winbond flash have enough space for my data store, but I am not sure about the memory placement in the controller.

NVazquez_0-1661270178990.png

I think from location 1x10001000 the program memory gets over written and my data is lost.

 

 

How can I check from which location is the program written and how can I change the loaction?

According to the datasheet I can use this much space(0x1000 0000 - 0x17FF FFFF) for SPI Flash Interface,

NVazquez_1-1661270444643.png

 

What I am trying to do store around 400kbytes of memory in flash and save the program memory in the flash at the same time is it doable?

This is how the memory detail looks under MCUXpresso, I'm guessing I can make the partition here, but not sure,

NVazquez_0-1661271138636.png

 

Sorry if I am all over the place, please help me out I am a newbie when it comes memory placement.

#evaluation board #LPC54S018 #spiFI

@xiangjun_rong

Tags (1)
0 Kudos
Reply
4 Replies

1,113 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose that 400kbytes data are constant, which are determined when you compile the project. If it is the case, you can define a constant data as an array. In the case, when you download the code, it will be saved in the spifi flash.

Hope it can help you

BR

XiangJun Rong

 

xiangjun_rong_0-1661325530814.png

 

Tags (1)
0 Kudos
Reply

1,105 Views
NVazquez
Contributor IV

Yes they are constant. I don't really care where they are stored in the RAM, as long as they are store in the flash right and I can get the correct data from the flash.

 

Another thing I noticed,

 

Do I need to change, the starting address for storing my data in RAM, because it is the same as where I download my code as shown in the picture below? 


/* @brief SPIFI start address */
/#define FSL_FEATURE_SPIFI_START_ADDR (0x10000000)

 

 

NVazquez_0-1661354338659.png

 

Also how can I find out in which particular location in the flash the program memory is stored? Just to make sure it doesn't overlap with my data in flash?

0 Kudos
Reply

1,102 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As you said that you wanted to store 336kbytes of constant data, but the LPC54018 has only 360 kB on-chip SRAM, you have to allocate some space for stack, global variable, even heap.., because you do not want to change the constant array, it is not necessary to copy constant data from flash to on-chip RAM.

The constant array address is allocated by compiler, your application code is not required to know the constant array address.

You can read the constant data array directly.

Hope it can help you

BR

XiangJun Rong

 

 

1,100 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

you can use the line to read data from spifi flash:

uint8_t char_1;

char_1=model_data[1];

Hope it can help you

BR

XiangJun Rong

0 Kudos
Reply