Hi, I am trying to make an Over-The-Air bootloader which downloads a new image from a remote HTTP server. I am able to download the image and write it into the XIP Flash memory. I have create two partitions, one at address 0x60000000 and one at 0x60200000 similar to https://www.nxp.com/docs/en/application-note/AN12255.pdf
I have tried the Flash Remapping function but I can't understand how to make the application boot/jump to the new image. Once the registers (IOMUXC_GPR_GPR30, IOMUXC_GPR_GPR31, IOMUXC_GPR_GPR32) have been set, how should board start from the new image starting at 0x60200000 (resetISR at 0x60202000)?
I have tried to do a software reset but it start from the old image (0x60000000) and also change the IVT entry address to 0x60202000, then software restart but with no luck. I have also been trying to make a direct jump to the new application with the following code:
#define BL_APP_VECTOR_TABLE_ADDRESS 0x60202000
#define APP_VECTOR_TABLE ((uint32_t *)BL_APP_VECTOR_TABLE_ADDRESS)
void goToApp()
{
static void (*farewellBootloader)(void) = 0;
farewellBootloader = (void (*)(void))(APP_VECTOR_TABLE[1]);
SCB->VTOR = (uint32_t)APP_VECTOR_TABLE;
__set_MSP(APP_VECTOR_TABLE[0]);
__set_PSP(APP_VECTOR_TABLE[0]);
farewellBootloader();
}
I am using an Embedded Artists RT-1062 board with Adesto XIP flash: https://www.embeddedartists.com/products/imx-rt1062-developers-kit/
Thanks in advance
Robert
Will the the registers (IOMUXC_GPR_GPR30 etc.) be persistent during a software restart or will the be reset? The image entry address for the bootloader is 0x60002000, will this be translated (re-mapped) to 0x60202000 once the registers have been set before a software restart?
I will probably try the solution instead of the re-mapping: https://community.nxp.com/t5/i-MX-RT/iMXRT1064-Issue-with-firmware-swap/m-p/1293587
Hi @Robert123 ,
IOMUXC_GPR_GPR30 will be reset if you do the software restart .
So, you can see, from the AN:
https://www.nxp.com/docs/en/application-note/AN12255.pdf
AN12255SW\SW\src\boards\evkmimxrt1060\use_case\flash_remap_test\nor\polling_transfer
it is using the code without the reset to test the remap, it is just the software method remap, use the GPR register control let you see the address related data is really changed.
But in the real usage, normally, use the Fuse to configure it, then use the ROM code to select which remapped code is working.
See AN chapter 3.2. Flash remapping supported on ROM
Wish it helps you!
Best Regards,
kerry
Hi @Robert123
If you want to do the remap function, just follow your mentioned application note, that application also contains the software package.
But if you use the SDK ota_bootloader and the HTTP ota app. It is not the situation.
0X60000000 is putting the ota_bootloader
#define BL_APP_VECTOR_TABLE_ADDRESS (0x60040000u)
#define BL_BACKUP_APP_START (0x60080000u)
So you can't remap the secondary bootloader and the app, as the code will run the secondary bootloader ota_bootloader at first, then jump to the real app.
Wish it helps you!
If you still have questions about it, please kindly let me know.
kerry