IMXRT1064 CAN Bootloader

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

IMXRT1064 CAN Bootloader

Jump to solution
476 Views
tisch
Contributor I

Hi everyone,

I want to port a existing and working CANopen-Bootloader to NXP IMXRT1064. The Bootloader works like this: It sits in the normal flash of a small microcontroller and on top comes the application which the bootloader can modify at runtime.

But with the IMXRT1064 it is very different in comparison to my little microcontroller. It has a 4MB QSPI Flash integrated directly into the package, connected to FlexSPI2.

I've already experiemented with the example bootloader projects from the NXP SDK, flashloader and mcuboot, and also with the nor_flash-example but I think I have fundamental misunderstanding of how the application is running over QSPI flash together with a bootloader.

My first question is where do I need to store my CAN-bootloader? Does it need to sit in QSPI-Flash or maybe ITCM or somewhere else? Where should i store it?

My second question is if the bootloader is programmed into QSPI-Flash (0x70000000), can the bootloader run and modify the upper ranges of the QSPI-Flash (e.g. 0x70020000) where the application would be stored? How is a write access via internal FlexSPI2 even possible while the processor needs to load instructions to run the bootloader?

Thank you.

Labels (1)
0 Kudos
Reply
1 Solution
418 Views
mayliu1
NXP Employee
NXP Employee

Hi  @tisch ,

Thank you so much for your interest in our products and for using our community.

Q1: My first question is where do I need to store my CAN-bootloader? Does it need to sit in QSPI-Flash or maybe ITCM or somewhere else? Where should i store it?

A1:  For i.MX RT1064, the bootloader image is normally stored in the internal 4 MB SIP QSPI flash connected to FlexSPI2, because this is the primary boot device for RT1064 .

RT1064 supports both XIP and non-XIP boot from Serial NOR flash:

an XIP image executes directly from the FlexSPI address space, while a non-XIP image is copied to internal RAM for execution .

So the bootloader is typically stored in QSPI flash,  OCRAM/ITCM are execution locations , not the normal boot storage defined by the ROM boot flow.

Q2:My second question is if the bootloader is programmed into QSPI-Flash (0x70000000), can the bootloader run and modify the upper ranges of the QSPI-Flash (e.g. 0x70020000) where the application would be stored? How is a write access via internal FlexSPI2 even possible while the processor needs to load instructions to run the bootloader?

A2: Yes, a bootloader stored in the internal QSPI flash can update a higher flash region used for the application, but it must not continue executing from that same flash while erase/program is in progress. 

RT1064 provides ROM FlexSPI NOR APIs such as init , program , erase , read , and update_lut for in-application flash operations. During flash erase/program, the update routine should execute from internal RAM,and the application must ensure there are no other flash accesses during the operation, otherwise behavior is unpredictable.

 

Snipaste_2026-04-02_17-58-21.png

I suggest you can refer to this link below:

How to use the RT1064 on-chip flash as NVM

 

Best Regards

May

View solution in original post

0 Kudos
Reply
3 Replies
419 Views
mayliu1
NXP Employee
NXP Employee

Hi  @tisch ,

Thank you so much for your interest in our products and for using our community.

Q1: My first question is where do I need to store my CAN-bootloader? Does it need to sit in QSPI-Flash or maybe ITCM or somewhere else? Where should i store it?

A1:  For i.MX RT1064, the bootloader image is normally stored in the internal 4 MB SIP QSPI flash connected to FlexSPI2, because this is the primary boot device for RT1064 .

RT1064 supports both XIP and non-XIP boot from Serial NOR flash:

an XIP image executes directly from the FlexSPI address space, while a non-XIP image is copied to internal RAM for execution .

So the bootloader is typically stored in QSPI flash,  OCRAM/ITCM are execution locations , not the normal boot storage defined by the ROM boot flow.

Q2:My second question is if the bootloader is programmed into QSPI-Flash (0x70000000), can the bootloader run and modify the upper ranges of the QSPI-Flash (e.g. 0x70020000) where the application would be stored? How is a write access via internal FlexSPI2 even possible while the processor needs to load instructions to run the bootloader?

A2: Yes, a bootloader stored in the internal QSPI flash can update a higher flash region used for the application, but it must not continue executing from that same flash while erase/program is in progress. 

RT1064 provides ROM FlexSPI NOR APIs such as init , program , erase , read , and update_lut for in-application flash operations. During flash erase/program, the update routine should execute from internal RAM,and the application must ensure there are no other flash accesses during the operation, otherwise behavior is unpredictable.

 

Snipaste_2026-04-02_17-58-21.png

I suggest you can refer to this link below:

How to use the RT1064 on-chip flash as NVM

 

Best Regards

May

0 Kudos
Reply
235 Views
tisch
Contributor I
Hi May,
your answer and the link to change the flexspi_nor_example from flexspi to flexspi2 helped a lot. I was able to write the application into the flash and startup the application.
Thank you very much.
0 Kudos
Reply
231 Views
mayliu1
NXP Employee
NXP Employee

Thanks for your updated information and sharing.

If you meet any issue in the future, welcome to create the new question post.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2343742%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EIMXRT1064%20CAN%20Bootloader%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2343742%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20everyone%2C%3C%2FP%3E%3CP%3EI%20want%20to%20port%20a%20existing%20and%20working%20CANopen-Bootloader%20to%20NXP%20IMXRT1064.%20The%20Bootloader%20works%20like%20this%3A%20It%20sits%20in%20the%20normal%20flash%20of%20a%20small%20microcontroller%20and%20on%20top%20comes%20the%20application%20which%20the%20bootloader%20can%20modify%20at%20runtime.%3C%2FP%3E%3CP%3EBut%20with%20the%20IMXRT1064%20it%20is%20very%20different%20in%20comparison%20to%20my%20little%20microcontroller.%20It%20has%20a%204MB%20QSPI%20Flash%20integrated%20directly%20into%20the%20package%2C%20connected%20to%20FlexSPI2.%3C%2FP%3E%3CP%3EI've%20already%20experiemented%20with%20the%20example%20bootloader%20projects%20from%20the%20NXP%20SDK%2C%20flashloader%20and%20mcuboot%2C%20and%20also%20with%20the%20nor_flash-example%20but%20I%20think%20I%20have%20fundamental%20misunderstanding%20of%20how%20the%20application%20is%20running%20over%20QSPI%20flash%20together%20with%20a%20bootloader.%3C%2FP%3E%3CP%3EMy%20first%20question%20is%20where%20do%20I%20need%20to%20store%20my%20CAN-bootloader%3F%20Does%20it%20need%20to%20sit%20in%20QSPI-Flash%20or%20maybe%20ITCM%20or%20somewhere%20else%3F%20Where%20should%20i%20store%20it%3F%3C%2FP%3E%3CP%3EMy%20second%20question%20is%20if%20the%20bootloader%20is%20programmed%20into%20QSPI-Flash%20(0x70000000)%2C%20can%20the%20bootloader%20run%20and%20modify%20the%20upper%20ranges%20of%20the%20QSPI-Flash%20(e.g.%200x70020000)%20where%20the%20application%20would%20be%20stored%3F%20How%20is%20a%20write%20access%20via%20internal%20FlexSPI2%20even%20possible%20while%20the%20processor%20needs%20to%20load%20instructions%20to%20run%20the%20bootloader%3F%3C%2FP%3E%3CP%3EThank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2343742%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3Ei.MXRT%20106x%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2345036%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%20translate%3D%22no%22%3ERe%3A%20IMXRT1064%20CAN%20Bootloader%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2345036%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3EHi%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F261224%22%20target%3D%22_blank%22%3E%40tisch%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20so%20much%20for%20your%20interest%20in%20our%20products%20and%20for%20using%20our%20community.%3C%2FP%3E%0A%3CP%3EQ1%3A%20My%20first%20question%20is%20where%20do%20I%20need%20to%20store%20my%20CAN-bootloader%3F%20Does%20it%20need%20to%20sit%20in%20QSPI-Flash%20or%20maybe%20ITCM%20or%20somewhere%20else%3F%20Where%20should%20i%20store%20it%3F%3C%2FP%3E%0A%3CP%3EA1%3A%26nbsp%3B%20For%20i.MX%20RT1064%2C%20the%20bootloader%20image%20is%20normally%20stored%20in%20the%20internal%204%20MB%20SIP%20QSPI%20flash%20connected%20to%20FlexSPI2%2C%20because%20this%20is%20the%20primary%20boot%20device%20for%20RT1064%26nbsp%3B.%3C%2FP%3E%0A%3CP%3ERT1064%20supports%20both%20XIP%20and%20non-XIP%20boot%20from%20Serial%20NOR%20flash%3A%3C%2FP%3E%0A%3CP%3Ean%20XIP%20image%20executes%20directly%20from%20the%20FlexSPI%20address%20space%2C%20while%20a%20non-XIP%20image%20is%20copied%20to%20internal%20RAM%20for%20execution%20.%3C%2FP%3E%0A%3CP%3ESo%20the%20bootloader%20is%20typically%26nbsp%3Bstored%20in%20QSPI%20flash%2C%26nbsp%3B%20OCRAM%2FITCM%20are%20execution%20locations%26nbsp%3B%2C%20not%20the%20normal%20boot%20storage%20defined%20by%20the%20ROM%20boot%20flow.%3C%2FP%3E%0A%3CP%3EQ2%3AMy%20second%20question%20is%20if%20the%20bootloader%20is%20programmed%20into%20QSPI-Flash%20(0x70000000)%2C%20can%20the%20bootloader%20run%20and%20modify%20the%20upper%20ranges%20of%20the%20QSPI-Flash%20(e.g.%200x70020000)%20where%20the%20application%20would%20be%20stored%3F%20How%20is%20a%20write%20access%20via%20internal%20FlexSPI2%20even%20possible%20while%20the%20processor%20needs%20to%20load%20instructions%20to%20run%20the%20bootloader%3F%3C%2FP%3E%0A%3CP%3EA2%3A%20Yes%2C%20a%20bootloader%20stored%20in%20the%20internal%20QSPI%20flash%20can%20update%20a%20higher%20flash%20region%20used%20for%20the%20application%2C%20but%20it%20must%20not%20continue%20executing%20from%20that%20same%20flash%20while%20erase%2Fprogram%20is%20in%20progress.%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERT1064%20provides%20ROM%20FlexSPI%20NOR%20APIs%20such%20as%20init%20%2C%20program%20%2C%20erase%20%2C%20read%20%2C%20and%20update_lut%20for%20in-application%20flash%20operations.%20During%20flash%20erase%2Fprogram%2C%20the%20update%20routine%20should%20execute%20from%20internal%20RAM%EF%BC%8Cand%20the%20application%20must%20ensure%20there%20are%20no%20other%20flash%20accesses%20during%20the%20operation%EF%BC%8C%20otherwise%20behavior%20is%20unpredictable.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Snipaste_2026-04-02_17-58-21.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Snipaste_2026-04-02_17-58-21.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Snipaste_2026-04-02_17-58-21.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Snipaste_2026-04-02_17-58-21.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F381290i89709FEC38BCD301%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Snipaste_2026-04-02_17-58-21.png%22%20alt%3D%22Snipaste_2026-04-02_17-58-21.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EI%20suggest%20you%20can%20refer%20to%20this%20link%20below%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fi-MX-RT-Crossover-MCUs-Knowledge%2FHow-to-use-the-RT1064-on-chip-flash-as-NVM%2Fta-p%2F1123381%22%20target%3D%22_blank%22%3EHow%20to%20use%20the%20RT1064%20on-chip%20flash%20as%20NVM%3C%2FA%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBest%20Regards%3C%2FP%3E%0A%3CP%3EMay%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2352095%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20IMXRT1064%20CAN%20Bootloader%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2352095%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHi%20May%2C%3CBR%20%2F%3Eyour%20answer%20and%20the%20link%20to%20change%20the%20flexspi_nor_example%20from%20flexspi%20to%20flexspi2%20helped%20a%20lot.%20I%20was%20able%20to%20write%20the%20application%20into%20the%20flash%20and%20startup%20the%20application.%3CBR%20%2F%3EThank%20you%20very%20much.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2352113%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20IMXRT1064%20CAN%20Bootloader%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2352113%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThanks%20for%20your%20updated%20information%20and%20sharing.%3C%2FP%3E%0A%3CP%3EIf%20you%20meet%20any%20issue%20in%20the%20future%2C%20welcome%20to%20create%20the%20new%20question%20post.%3C%2FP%3E%3C%2FLINGO-BODY%3E