RT1021: Read/Write to flash when running XIP from the same flash

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

RT1021: Read/Write to flash when running XIP from the same flash

2,083 次查看
Selrac_13
Contributor I

This post is highly related with: https://community.nxp.com/t5/i-MX-Processors/RT1021-Writing-to-flash-when-running-XIP-from-the-same-...

RT1021: Writing to flash when running XIP from the same flash. 

Hi @jeremyzhou,

I am very interested on this topic.

When you say:

on the condition that relocating the FlexSPI driver in the RAM

How that can be achieved with details? I have taken a look to the example you mention: flexspi_nor_polling_transfer and I see

  • FlexSPI driver is moved to RAM on the Linker (linkscripts folder)
  • Use another Flash driver that the most common one:
Selrac_13_0-1690966482558.png

 

But I don't see any Flash partitions or anything like that.

My current project is using this other flash driver:

Selrac_13_1-1690966482550.png

 

Having the MIMXRT1020-EVK_IS25LP064.cfx is a requirement?

With more details what I want to achieve is to use the 8 MB SPI Flash for different purposes:

  • 3 MB for the program itself
  • Other 5 MB as a Flash storage to use in RAW to read/write data

Which steps I need to follow?

Many thanks,

Carles

0 项奖励
回复
5 回复数

1,990 次查看
Selrac_13
Contributor I

Hi again,

I have imported and tested two examples that seems to interact with the flash as I need:

  • flexspi_nor_polling_transfer (the one proposed by you)
  • flash_component_nor

By default both of them have unchecked the following setting Link application to RAM

Selrac_13_0-1691509724577.png

If I check this setting, as all the code is placed in RAM both examples run fine, but with the default configuration, that is having the program in Flash as I need for my project, both examples crash:

flash_component_nor:

Debugger starts but then a Fault occurs:

Selrac_13_1-1691509971585.png

flexspi_nor_polling_transfer:

First execution the program is stucked at some point and it is not recovered, from now on if trying to launch the application again the debugger is not even starting:

Selrac_13_2-1691510268590.png

To recover the device I need to connect it with 'NXP MCU Boot Utility' and perform a 'Connect to ROM' once.

Any help on how to be able to implement a flash read/write while program is stored in the flash is very appreciated.

Thanks

0 项奖励
回复

1,931 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @Selrac_13 ,

If your spi flash is same a RT1021 EVK, the fexspi demo can work well by default. If it is different, you must change the configuration in evkimxrt1021_flexspi_nor_config.c.

https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/i-MX-RT-FLEXSPI-booting-guide/ta-p/1669262

 

Regards,

Jing

0 项奖励
回复

2,064 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @Selrac_13 ,

You can refer to the flexspi_polling_transfer example. There is a linkscripts folder in the project. When compile the project, MCUXpresso IDE will read the .ldt file in this folder to generate new link file.

 

Regards,

Jing

0 项奖励
回复

2,055 次查看
Selrac_13
Contributor I

Thanks @jingpan ,

Yes, I have seen the example and I understand the Linker generation, I see the resulting '*.ld' file contains these settings, for example:

Selrac_13_0-1690973614476.png

My question was about if any other consideration should be also take into account.

For example:

  • Is it ok to use the Flash driver 'MIMXRT1020_SFDP_QSPI.cfx'? Or I must change it to 'MIMXRT1020-EVK_IS25LP064.cfx'?
  • Must I limit the size of the Program Memoery Space to 3MB (instead the whole Flash size -> 8MB)?Selrac_13_1-1690973849691.png

Thanks,

Carles

0 项奖励
回复

2,043 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @Selrac_13 ,

Is it ok to use the Flash driver 'MIMXRT1020_SFDP_QSPI.cfx'? Or I must change it to 'MIMXRT1020-EVK_IS25LP064.cfx'?

Yes, if it can download. Either drivers are fine.

Must I limit the size of the Program Memery Space to 3MB (instead the whole Flash size -> 8MB)

No, set the size according to your flash.

 

Regards,

Jing

0 项奖励
回复