AnsweredAssumed Answered

Flashloader inside application

Question asked by Daniele Pagani on Aug 5, 2019
Latest reply on Mar 28, 2020 by Anton Glukhov

   Dear sirs,

we're working with i.MX RT1060 EVK board and we're wondering about best practices for In-Application Programming.

We can correctly use Sdphost and Blhost utility, according to: Flash loader i.MXRT1060

However, we can not use boot pin mode for hardware's constraints.

So, we're using Rom Apis to set device programmatically into serial download mode:

void bl_serial_downloader(void)
run_bootloader_ctx_t boot_para;

boot_para.B.imageIndex = 0;
boot_para.B.serialBootInterface = kEnterBootloader_SerialInterface_USB;
boot_para.B.bootMode = kEnterBootloader_Mode_SerialDownloader;
boot_para.B.tag = kEnterBootloader_Tag;
g_bootloaderTree->runBootloader( (void *)&boot_para );


However, according to ROM APIs this feature is not available for all i.MX RT processors and our project can require usage of other processors.

So, we guess to load Flashloader application inside main application and then run it if required.

We define an array flashloader of bytes with Flashloader bin file and then we call a jump to application:



                0x0000000020000000    0x161a1 ./source/led_blinky.o

                0x0000000020000000                flashloader

 *fill*         0x00000000200161a1        0x3 ff


JumpApplication(*(uint32_t*)0x20000400, *(uint32_t*)0x20000404);


__STATIC_FORCEINLINE void JumpApplication(uint32_t topOfMainStack, uint32_t AppAddr)
    __ASM volatile ("mov SP, %0" : : "r" (topOfMainStack) : );
    __ASM volatile ("mov PC, %0" : : "r" (AppAddr) : );


This solution doesn't work, so, can you suggest something about the matter?