Jump to System bootloader: does not stay inside
It has been asked several times, however I can not find a working solution for me.
With STM32L486RGT6 I achieved to implement jump to bootloader, entering DFU mode successfully. All fine!
Doing it similar for STM32L071CZY6TR and STM32F469VE it does not remain in bootloader, but starts the application from flash.
Environment: Boot0 = 0 fixed. Application is stored in Bank1.
Debugging STM32L071 I see the jump to 0x1ff0’0510. Stepping forward ends up in a small loop. Disconnecting the debugger, the application starts from flash. I don’t see any Hardfault message.
Do I miss something to reset or should this anyway not be used to update the FW in Flash?
Below the code I use.
void Jump2StInternalBootloader(void)
{
volatile uint32_t addr = 0x1FF00000;
HAL_UART_DeInit(&huart1);
HAL_UART_DeInit(&huart5);
HAL_ADC_DeInit(&hadc);
HAL_I2C_DeInit(&hi2c1);
HAL_TIM_Base_DeInit(&htim2);
HAL_LPTIM_DeInit(&hlptim1);
HAL_StatusTypeDef s = HAL_RCC_DeInit();
if (s != HAL_OK){
while(1){;}
}
HAL_SuspendTick();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
HAL_DeInit();
__disable_irq();
HAL_RCCEx_DisableLSECSS();
__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();
/* Clear Interrupt Enable Register & Interrupt Pending Register. TODO check code */
for (uint8_t i = 0; i < (MCU_IRQS + 31u) / 32; i++) {
NVIC->ICER[i] = 0xFFFFFFFF;
NVIC->ICPR[i] = 0xFFFFFFFF;
}
for (IRQn_Type i = WWDG_IRQn; i <= LPUART1_IRQn; i++) {
HAL_NVIC_DisableIRQ(i);
}
void (*jumpFuncPtr)(void);
jumpFuncPtr = (void (*)(void))(*((uint32_t *)(addr + 4)));
__set_MSP(*(uint32_t *)addr);
jumpFuncPtr();
}
Thanks in advance.
Led
