Merging custom bootloader and non-xip application

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

Merging custom bootloader and non-xip application

1,481 Views
Muhammet
Contributor II

We are utilizing the i.MXRT 1176 MCU, and we require the M4 core to have read and write access to the flash memory. When the application operates in XIP mode from the flash and the M4 core attempts to write to the flash, the application crashes. (expected, since the M7 runs in XIP mode from the flash). To solve this problem, I followed the steps outlined in NXP's application note How to Enable Non-XIP Boot on i.MX RT Series EVK and successfully relocated the application code to RAM(non-xip mode). This approach prevented any issues when the M4 core wrote to the flash.

The current issue is: How can I merge the non-XIP application code with the custom bootloader we've developed?


0 Kudos
Reply
3 Replies

1,461 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi @Muhammet  

Thank you for contacting us ! Is the custom bootloader running from XIP and from M4?

I use to rellocate functions to RAM or any code area using macros and creating specific sections,  lets say that you want to place a function like write_flash()  into a internal OCRAM. So, as option 1 we can use compiler macros to place a function into OCRAM or any other RAM area you would like.

As option 2, there are also linkscripts, that let you place objects and code into certain areas of the memory. For example move text and data of  fsl_flexspi.c, clocks_.c text to  located into OCRAM.  Could you detail the kind of advice you need?

diego_charles_0-1737151551912.pngdiego_charles_0-1737151551912.png

I hope to be helpful

Diego

 

0 Kudos
Reply

1,433 Views
Muhammet
Contributor II

Hi @diego_charles , 

The bootloader can run from RAM or flash. M7 and M4 should run from RAM. Do I need a secondary bootloader that relocates the M7 code to RAM to do this? If so, is there an example and documentation for this? Or is there an alternative solution?

0 Kudos
Reply

1,401 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi @Muhammet 

Thank you for your response. Do you need to copy M7 code to SRAM on runtime? If yes, the alternative is to create your secondary bootloader code. I say this because the bootROM is capable to copy whole M7 application from FLASH to SRAM or SDRAM, but this is only  prior to aplication boot.  This process is used to load and execute an application that will boot on a volatile memory (like SDRAM, SRAM) and will have its code stored in non-volatile memory.  We can call this a NON-XIP image. 

We  provide two bootloader sample codes in the SDK ( flashloader, MCUboot_opensource),  and  the  NXP SBL. But they migth be more complex than what you may need. 

I hope this helps, if you are still having questions, please let me know. 

Diego

 

 

0 Kudos
Reply