DFU bootloader in F4

Post here first, or if you can't find a relevant section!
victor_pv
Posts: 1864
Joined: Mon Apr 27, 2015 12:12 pm

Re: Rebooting to DFU bootloader in F4 and others.

Post by victor_pv » Sat Aug 26, 2017 12:53 pm

But that is the ROM bootloader, the one you were mentioning that would not timeout, and that in case the sketch doesn't work (for setting the magic word), then the user will have to use the boot pin to get the board to load a sketch again.
That is the same method that I mentioned in the first post.

logd32
Posts: 20
Joined: Thu Sep 07, 2017 8:41 pm

Re: Rebooting to DFU bootloader in F4 and others.

Post by logd32 » Fri Dec 22, 2017 12:29 pm

fpiSTM wrote:
Sat Aug 26, 2017 6:41 am
FYI, Dfu for F4 was implemented for the Otto:
https://github.com/arduino-org/arduino-core-stm32f4

To enter in dfu, no need user action, set seialusb config to 1200:
https://github.com/arduino-org/arduino- ... _if.c#L261
Then, set a dedicated magic code at a dedicated @:
https://github.com/arduino-org/arduino- ... _if.c#L436
Finally, during init:
https://github.com/arduino-org/arduino- ... ds.cpp#L70
Call entersysrom:
https://github.com/arduino-org/arduino- ... sROM.S#L11
@fpiSTM
Has any bootloader or POC been tried? This uses the read only ROM bootloader of F3/F4 core right?

fpiSTM
Posts: 315
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: DFU bootloader in F4

Post by fpiSTM » Sat Dec 23, 2017 6:01 am

For Otto it was functional.
Yes, no dedicated bootloader

edogaldo
Posts: 291
Joined: Fri Jun 03, 2016 8:19 am

Re: DFU bootloader in F4

Post by edogaldo » Sat Dec 23, 2017 7:51 am

Hi all, I was wondering if it could be enough to set the system bootloader address in the reset handler to do the trick.

Best & merry Xmas, E.

logd32
Posts: 20
Joined: Thu Sep 07, 2017 8:41 pm

Re: DFU bootloader in F4

Post by logd32 » Sun Dec 24, 2017 3:34 pm

@fpiSTM
OK, thanks, i tested the same mecanism for STM32F303, only replacing SRAM flag by RTC backup register since the F303CC doesnt have backup SRAM (so it was not working as is), the STM32F303 now resets on CDC 1200bps touch and can detect the DFU mode after reset.However, i still have a problem for jumping to bootlader (sysROM.s), it falls into usageFault when reaching line 19
https://github.com/arduino-org/arduino- ... sROM.S#L19

Is SYSCFG_CFGR1 (+0x00) specific to STM32F4? i havent found any info on how to jump to the internal DFU bootlaoder on STM32F303 in datasheet and DM00046982. If anyone has a clue.

victor_pv
Posts: 1864
Joined: Mon Apr 27, 2015 12:12 pm

Re: DFU bootloader in F4

Post by victor_pv » Sun Dec 24, 2017 7:08 pm

edogaldo wrote:
Sat Dec 23, 2017 7:51 am
Hi all, I was wondering if it could be enough to set the system bootloader address in the reset handler to do the trick.

Best & merry Xmas, E.
Sorry I edited Edogaldo post by mistake before, this part was mine:

There is a bit more than that, you need to set the NVIC VTOR register so the NVIC can find the vector table.
This video shows it and shows sample code, very minimal. You just set a couple of registers and jump to it:
https://www.youtube.com/watch?v=cvKC-4tCRgw

victor_pv
Posts: 1864
Joined: Mon Apr 27, 2015 12:12 pm

Re: DFU bootloader in F4

Post by victor_pv » Sun Dec 24, 2017 7:10 pm

logd32 wrote:
Sun Dec 24, 2017 3:34 pm

Is SYSCFG_CFGR1 (+0x00) specific to STM32F4? i havent found any info on how to jump to the internal DFU bootlaoder on STM32F303 in datasheet and DM00046982. If anyone has a clue.
Generally the F3 peripherals are more similar to the F1 than the F4. It has a cortexM4 core, but with F1 peripherals (mostly), vs the F2 which has F4 peripherals with a cortex M3 like the F1.

So the SYSCFG_CFGR1 register may be very different between the F3 and F4, check the datasheet.

Post Reply