Hello,
I am trying to write a custom bootloader based on the evkmimxrt1060_ota_bootloader example program, but I'm having issues understanding some of the assumptions used in the example. I am using the 1060-EVK dev board and I would like to install the evkmimxrt1060_iled_blinky example at location 0x6020 0000 so that I can try calling it from my bootloader.
Hi @chadgraham ,
1. I tested on my RT1060 EVK, it works fine. I guess there my be some software or hardware issue on your board. Can your own application or other demos in SDK run on your board? Have you set RT1060 in internal boot or fuse boot mode?
2. Please refer to the attachment. The start address of customer image is 0x60040000. And it need a OTA header.
3. You can set and change memory details in Properties->MCU settings. The interrupt vector address is set in .ld file.
Regards,
Jing
Regards,
Jing
Hello Jing,
Thank you for the help.
Hi,
MSP and PSP keep the stack address. In interrupt vector table, the first word is stack address. Bootloader will get this address and put into MSP and PSP. Below is extract from bl_main.c
static void jump_to_application(uint32_t applicationAddress, uint32_t stackPointer)
{
#if BL_FEATURE_OTFAD_MODULE
quadspi_cache_clear();
oftfad_resume_as_needed();
#endif
shutdown_cleanup(kShutdownType_Shutdown);
// Create the function call to the user application.
// Static variables are needed since changed the stack pointer out from under the compiler
// we need to ensure the values we are using are not stored on the previous stack
static uint32_t s_stackPointer = 0;
s_stackPointer = stackPointer;
static void (*farewellBootloader)(void) = 0;
farewellBootloader = (void (*)(void))applicationAddress;
// Set the VTOR to the application vector table address.
SCB->VTOR = (uint32_t)APP_VECTOR_TABLE;
// Set stack pointers to the application stack pointer.
__set_MSP(s_stackPointer);
__set_PSP(s_stackPointer);
// Jump to the application.
farewellBootloader();
// Dummy fcuntion call, should never go to this fcuntion call
shutdown_cleanup(kShutdownType_Shutdown);
}
MCUXpresso can generate link file. It will put vector table at the top of image.
You can put your application image at anywhere, but you must change the bootloader to tell it the address. It defined in bootloader_config.h
#define BL_APP_VECTOR_TABLE_ADDRESS (0x60040000u)
You can trace this definition to see how it deal with application image.
Regards,
Jing