Hi Eric Chen,
Thanks for your reply.
The flashloader code also doesn't run well after jumping. And it will trigger a reset event once jumping.
I've attached my flashloader.c and my basic testing code.
Now I'm still working on the issue, and I'll inform you ASAP after working it out.
Of course, you can contact me if you have some breakthroughs.
#include "fsl_device_registers.h"
#include "fsl_debug_console.h"
#include "board.h"
#include "flash_loader.h"
#include "pin_mux.h"
#include "clock_config.h"
#define kDefaultVectorTableAddress 0
void bootloader_cleanup()
{
__disable_irq();
SCB->VTOR = kDefaultVectorTableAddress;
__ISB();
__DSB();
}
static void jump_to_application(uint32_t applicationAddress, uint32_t stackPointer)
{
static uint32_t s_stackPointer = 0;
s_stackPointer = stackPointer;
static void (*farewellBootloader)(void) = 0;
farewellBootloader = (void (*)(void))applicationAddress;
SCB->VTOR = (uint32_t)stackPointer;
__set_MSP(s_stackPointer);
__set_PSP(s_stackPointer);
farewellBootloader();
}
int main(void)
{
char ch;
BOARD_ConfigMPU();
BOARD_InitPins();
BOARD_InitBootClocks();
BOARD_InitDebugConsole();
PRINTF("Flashloader testing.\r\n");
memcpy((void *)0x20002000, FlashLoaderIAR, 82142);
bootloader_cleanup();
jump_to_application(0x20002004,0x20002000);
while (1)
{
ch = GETCHAR();
PUTCHAR(ch);
bootloader_cleanup();
jump_to_application(0x20002004,0x20002000);
}
}
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------