cancel
Showing results for 
Search instead for 
Did you mean: 

Jump to boot from code

gil23
Associate III
Posted on July 02, 2014 at 16:44

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 :

&sharpinclude ''stm32f401_discovery.h''

typedef  void (*pFunction)(void);

&sharpdefine 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);

}

#it''s-deja-vu-all-over-again
2 REPLIES 2
Posted on July 02, 2014 at 20:50

https://community.st.com/0D50X00009Xkh7wSAB

 

Edit: Fixing DEAD LINK, original post from 2-July-2014

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gil23
Associate III
Posted on July 03, 2014 at 10:42

Hi,

I remarked the line:

//

__set_PRIMASK(1);

and it's work.

Is this the correct way to jump to boot mode?