How to partition an external NOR flash for LittleFS and CODE in a IMXRT1062

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

How to partition an external NOR flash for LittleFS and CODE in a IMXRT1062

Jump to solution
1,167 Views
patriciocohen
Contributor IV

Hi,

In my custom board I'm using an external NOR Flash connected to FLEXSPI1.
I need to partition this external flash, so it can contain code and also a filesystem. I'm using FreeRTOS and the filesystem is LittleFS.

I have seen some posts that a solution is to execute code from RAM, but this is not possible in my case. I need to be able to run code from flash and use it as filesystem storage as well.

Please give directions on how to do it. At the moment I'm getting hard faults.

1) Do I need to create a partition in MCU Settings?

2) How to configure the MPU in this case?

Is there and example available that shares external NOR flash between code and filesystem?

Thank you,

Patricio

 

 

0 Kudos
Reply
1 Solution
1,101 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @patriciocohen ,

You can move erase and program function code to SRAM. When it is executing, disable all interrupt and stay in SRAM. The flexspi demo in SDK works in this way.

Or you can use two spi flash.

 

Regards,

Jing

View solution in original post

3 Replies
1,126 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @patriciocohen ,

It's very hard to XIP while littlefs access nor flash. LittleFS access NOR flash in IP command mode(write, erase), XIP read flash on AHB bus. This will certainly cause conflict.

 

Regards,

Jing

0 Kudos
Reply
1,116 Views
patriciocohen
Contributor IV

Hi @jingpan 

Thanks for your reply.

Is there a way to do this that you can think of?

Best regards,

Patricio 

 

0 Kudos
Reply
1,102 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @patriciocohen ,

You can move erase and program function code to SRAM. When it is executing, disable all interrupt and stay in SRAM. The flexspi demo in SDK works in this way.

Or you can use two spi flash.

 

Regards,

Jing