AnsweredAssumed Answered

Jump to boot from code

Question asked by carmi.gil on Jul 2, 2014
Latest reply on Jul 3, 2014 by carmi.gil

I'm working with STM32F401C DISCO on IAR.

I'm trying to jump from code to the boot mode and my PC don't recognize the USB when I perform the jump.

When I perform the jump from HW pins the PC recognize the USB.

The code I used :

#include "stm32f401_discovery.h"

typedef  void (*pFunction)(void);

#define BOOTLOADER_ADDRESS        (uint32_t)0x1FFF0000

pFunction Jump_To_BootLoader;

uint32_t JumpAddress;

int main(void)

{

  JumpAddress = *(__IO uint32_t*) (BOOTLOADER_ADDRESS + 4);

  Jump_To_BootLoader = (pFunction) JumpAddress;

  RCC_DeInit();

  SysTick->CTRL = 0;

  SysTick->LOAD = 0;

  SysTick->VAL = 0;

  __set_PRIMASK(1);

  __set_MSP(*(__IO uint32_t*) BOOTLOADER_ADDRESS);

  Jump_To_BootLoader(); 

  while (1);

}

Outcomes