Programming external nor flash and internal flash, then boot from internal flash. Mcxn947

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

Programming external nor flash and internal flash, then boot from internal flash. Mcxn947

跳至解决方案
987 次查看
TomC818
Contributor III

Hello I want to evaluate the use case where an external nor flash is primarily used as a non-volatile storage and used to keep tflite model and gui image while the internal flash is used to hold the program. The system after booting up and read from the external flash. Therefore can avoid re-flashing the large data that doesn’t need to be updated when flashing the firmware/image to the system.

0 项奖励
回复
1 解答
824 次查看
Harry_Zhang
NXP Employee
NXP Employee

Hi @TomC818 

I think this can also be achieved. You can store the model in external flash through linkserver.

And in your code. you can initial external flash, and run it.

BR

Harry

在原帖中查看解决方案

0 项奖励
回复
6 回复数
955 次查看
Harry_Zhang
NXP Employee
NXP Employee

Hi @TomC818 

Yes, you are right, and we have already achieved this.

Firstly, you need to add external flash initialization code into your project.

And then put your model data into external flash.

BR

Harry

0 项奖励
回复
949 次查看
TomC818
Contributor III

Hi @Harry_Zhang ,

Thanks for the reply but can you explain a little more on how to only flash the large data to the external flash without running any codes by the mcu?

I know that running a different set of code on the mcu which open a serial interface to receive data and then writing to external nor flash would probably be a possible solution. 

I do see that there are some guide on how to program bootable image to external flash via ISP and SEC tool or SPSDK.
Running code from external memory with MCX N94x - NXP Community
Using SEC Tool Config and Program Image to External Flash - NXP Community

But my goal would be still having the bootable image stay inside the internal flash while the model/ui images would be larger than the size of the internal flash could be placed in the external flash and can be loaded to an external PSRAM later for inferencing or displaying while running the code from the internal flash. Therefore I can modify and update the codes without needing to flash the model and ui data again, or vice versa I can update the model and ui independently to the codes.

Are there any existing tool or demo that can achieve this goal?

0 项奖励
回复
931 次查看
Harry_Zhang
NXP Employee
NXP Employee

@TomC818 

can you explain a little more on how to only flash the large data to the external flash without running any codes by the mcu?

If  you want to store the model data to the nor flash.

You can add text.ldt in the linkscripts folder.

Harry_Zhang_0-1749723775283.png

Harry_Zhang_1-1749723841336.png

After compile this project.

Harry_Zhang_2-1749723870801.png

And when you debug or flash, the data in OSPI_FLASH will be flashed into the octal flash.

After you initialize nor flash, you can directly use these data.

I have just completed the relevant demo, but due to company policy, I am unable to share my project. I will write an article about this project in the near future.

BR

Harry

0 项奖励
回复
910 次查看
TomC818
Contributor III
Hi Harry,
Thanks for the quick response, what I mean by not running codes on mcu and flashing the external flash is that I don’t have to run any live code on the mcu in order to write to the flash.

A similar case would be the uuu tool provided by nxp, which can program the target boot media without booting up the processor and any data that is stored in the other storage medias will remain untouched. (e.g. I am flashing the NOR flash in an I.MX mpu platform, then the data stored in eMMC and sd card will remain unchanged; thus each time the image is modified I only need to program the flash).

Since there is the isp function in mcxn mcu I wanted to know if I can do something similar by having the large data stored in an external storage (e.g. nor flash) and have the boot target media as the internal flash.
0 项奖励
回复
825 次查看
Harry_Zhang
NXP Employee
NXP Employee

Hi @TomC818 

I think this can also be achieved. You can store the model in external flash through linkserver.

And in your code. you can initial external flash, and run it.

BR

Harry

0 项奖励
回复
939 次查看
TomC818
Contributor III
This use case is basically using nor flash instead of sd card as external non-violatile storage. The reason for such use case is quite straight forward, as wifi/bt modules supported by nxp mcu normally only use sdio, and mcxn mcu only have one SDHC interface.
0 项奖励
回复