AnsweredAssumed Answered

STM32F4 Custom Bootloader & Interrupts

Question asked by Phil V on Oct 2, 2012
Latest reply on Oct 3, 2012 by Phil V
I think this should be fairly straight forward, but so far it has tripped me up and now the solution is evading me.

I have a custom Bootloader which is located in the base memory of the User Flash.
Depending on input it may then read a firmware upgrade from the USB interface and Flash the User Flash higher sectors with new firmware.

Finally it checks for the application in the corect location in the User Flash before jumping to it using the following function:

static void Boot_ApplicationImage( void )
  // Typedef
  typedef void (*pFunction)(void);
  // Function Pointer
  pFunction Jump_To_Application;
  // Jump Address
  uint32_t JumpAddress;
  /* Jump to user application */
  JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
  Jump_To_Application = (pFunction) JumpAddress;
  /* Initialize user application's Stack Pointer */
  __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);

This all works fine.

HOWEVER... in my Bootloader I setup SysTick, and configure a SysTick handler that increments one variable (as a millisecond tick counter), and also decrements another variable if it's current value > 0.

When I jump from the Bootloader to my Application it seems that the SysTick is still running and still being serviced; the 1st memory location still gets incremented every millisecond, and the 2nd memory location still gets decremented whenever it has any value in it >0. Of course the problem with this is that the Application doesn't know that the Bootloader is still accessing these memory locations, and so stores it's own data in the locations which obviously gets corrupted 1ms later.

Just before leaving my Bootloader code how do I 'unregister' the SysTick handler code so that the Bootloader relinquishes full control to the Application once the jump is made?

Many thanks!