AnsweredAssumed Answered

Bootloader STM32L476

Question asked by hellenthal.wim on Oct 19, 2016
Latest reply on Oct 24, 2016 by Clive One
Dear all,

I'm working with a Nucleo-64 board and want to start the system boot loader from source code in combination with the Flash Loader Demonstrator, currently I'm trying the boot loader in combination with USART3 (PC4,PC5) The ST-link bridge to UART2 is disconnected by removal of SB14/SB14. I watched a few videos on youtube and tried the following startup code:
#define BOOTLOADER_START_ADDR 0x1FFF0000
int main()
{
 HAL_RCC_DeInit();
 HAL_DeInit();
 
 __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();
 
 SysTick->CTRL = 0;
 SysTick->LOAD = 0;
 SysTick->VAL  = 0;
 
 uint16 id = *((uint32_t *)0x1FFF6FFE);
 
 __set_PRIMASK(1);       /// Disable Interrupts 
 
 uint32 map = *(__IO uint32_t*) 0x0;
 
 __set_MSP(0x20000000); /// Set main stack pointer
// __set_MSP(*(__IO uint32_t*) 0x20003100); /// Set main stack pointer
// __set_MSP(*(__IO uint32_t*) BOOTLOADER_START_ADDR); /// Set main stack pointer
// __set_MSP(*(__IO uint32_t*) 0x0); /// Set main stack pointer
 
// void(*bootloader)(void) = (void(*)(void)) *((uint32_t *)(BOOTLOADER_START_ADDR + 4)); 
 void(*bootloader)(void) = (void(*)(void)) *((uint32_t *)0x04);
 bootloader();
 
 while (1);
}

I tried different combination of setting the stack pointer and so but nothing seems to work. Does anyone have a working example in combination with the Nucleo-64 Dev Env? 

Any help is highly appreciated.

Best regards,
Wim 

Outcomes