cancel
Showing results for 
Search instead for 
Did you mean: 

jump to bootloader without using boot0 and boot1 pins

Florian HOUTTEMANE
Associate
Posted on March 30, 2017 at 10:57

I am programming on nucleo L073RZ board.

My target is to jump from the main to the bootloader application without using BOOT0 and BNOOT1 pins.

To do that i look over the internet. By using the following video on the internet : 

https://www.youtube.com/watch?v=cvKC-4tCRgw&t=2s

 , i wrote the attached filed.

The issue is that the MCU goes to default_handler and it is impossible to enter into the bootloader.

I don't know if something is missing in the code ?

Regards,

Florian

2 REPLIES 2
toby2
Senior
Posted on March 30, 2017 at 18:20

I don't know if it is the best way but when I wanted to do this on a F407 I did the following:

#define DFU_BOOT_CODE 0xABACABED

volatile u32 boot_check; // pattern used to boot into bootloader mode. 

void dfu_boot(void)

{

   boot_check = DFU_BOOT_CODE; // set the magic number to reboot into DFU mode.

   NVIC_SystemReset();

}

void Reset_Handler(void)

{

   if (boot_check == 0xABACABED) // if bootloader required go there....

   {                                                       // code start for the F407 bootloader is at 0x1fff000, check for other devices.

      boot_check = 0; // reset the boot check so it doesn't come back here after the bootloader.

      __asm(

      ' ldr r0, =0x1fff0000\n'

      ' ldr SP,[R0,#0]\n'

      ' ldr R0,[R0,#4]\n'

      ' bx R0'

      );

   }

   // otherwise the standard bootup, copied from startup_stm32f4xx.c

   /* Initialize data and bss */

   unsigned long *pulSrc, *pulDest;

   etc

   etc

}

Posted on March 30, 2017 at 18:28

hmm... odd, I just replied but it says 'currently being moderated' and I don't think the reply is visible to anyone else. This is a test to see if it happens again.....

edit: ok, now my previous reply has appeared so ignore this one!