2024-10-17 05:39 AM - edited 2024-10-17 06:35 AM
Hi all,
I am trying to launch the app from a bootloader code that I copied from a project on an STM32L0 and STM32F446, it worked fine there but somehow my app doesn't start on the STM32G491.
Here's the code for the jump:
static void bootloader_jump_to_app(void)
{
uint32_t JumpAddress = *(__IO uint32_t*)(APP_ADDRESS + 4u);
pFunction Jump = (pFunction)JumpAddress;
if (!bootloader_check_integrity())
{
bootloader_send_message("Abort\r", 8u);
bootloader_init();
}
else
{
bootloader_send_message("Starting\r", 9u);
HAL_FLASH_Lock(); // lock flash after memory erase + write
HAL_RCC_DeInit();
HAL_DeInit();
SysTick->CTRL = 0u;
SysTick->LOAD = 0u;
SysTick->VAL = 0u;
SCB->VTOR = (__IO uint32_t)APP_ADDRESS;
__set_MSP(*(__IO uint32_t*)APP_ADDRESS);
Jump();
while(1);
}
}
I have modified my .ld file accordingly with app start address 0x08003000, I compared the memory part with the app to the bin file and it's similar, I don't understand where the problem comes from, even though I noticed some differences in the APIs between STM32L0 and G4 series, all the code examples seem to match, or maybe I missed something, can anybody help please?
Solved! Go to Solution.
2024-12-02 07:29 AM
I appreciate your response.
I checked the memory regions where the code is being written and identified an issue with how the data was being written to the flash memory—specifically, little-endian / big-endian issue. After addressing this, the application is now successfully loading and working.
Thanks for being responsive. I will reach out to you for assistance with other parts of the bootloader process during my development.
Thanks again,
FS