AnsweredAssumed Answered

Custom bootloader jump to app best practices

Question asked by Dave Jones on Apr 14, 2018

I am writing a custom bootloader for the STM32L452. Before I jump to the application code from the bootloader I want to get the hardware to as close to a reset condition as possible to avoid any surprises.

 

My plan is to:

 

  call HAL_RCC_DeInit(); to turn off the PLL and set the clock to it's default state
  set SysTick->CTRL  = 0; to turn off the systick
  call HAL_DeInit(); to disable all the peripherals (it looks like it does a force reset/release of APB1, APB2, AHB1, AHB2, and AHB3)

 

I'll then disable IRQs, set the stack pointer, and jump to the startup vector in the application. The application startup code should then take care of setting everything to it's initial state before it calls main().

 

Does this seem like I have covered everything? Nothing left that might leave a pending interrupt bit, or some other surprise?

Outcomes