stm32duino / Arduino_Tools

Contains upload tools for STM32 based boards
Other
89 stars 64 forks source link

[Enhancement] Feature/softdfu upload #69

Closed ekawahyu closed 2 months ago

ekawahyu commented 4 years ago

The current built-in STM32 DFU upload requires user to pull BOOT0 pin to 3.3V and perform system reset. With this enhancement, users do not require to press reset button nor pulling BOOT0 pin to 3.3V to upload new binary. The protocol is based on reading magic number over USBCDC (same magic number as Maple board '1EAF') and then it jumps to built-in DFU mode and ready to accept binary from there.

This enhancement script has been tested to work on STM32F072B Discovery board with my branch develop:

https://github.com/SnapBloks/Arduino_Core_STM32/tree/develop

Board part number is STM32F072B-DISC-SOFTDFU and it has not been merged into STM32F072B-DISCOVERY yet. The enhancement scripts are available for Linux, macOS, and Windows.

fpistm commented 4 years ago

Hi @ekawahyu Thanks for this PR anyway it seems you made lot of changes (mainly in the variant). A POC has been made to test the reset in BL mode: https://github.com/stm32duino/Arduino_Core_STM32/pull/710

It requires some clean up and rebase but should be less invasive.

ekawahyu commented 4 years ago

The changes is not that much, but it was mainly due to missing __initialize_hardware_early() in every startup code. That's why I created a new variant *-SOFTDFU instead of adding it directly to the existing STM32F072B-DISCOVERY.

If you want, I can do the cleanup on the core and merge the required changes to STM32F072B-DISCOVERY before doing PR for the core. I will also look at #710. What is BL mode? BL as in BootLoader mode?

ekawahyu commented 4 years ago

By the way, when I worked on this thing in the past, I believe the __initialize_hardware_early() was generated and available in HALMX. So, why I don't see it anymore in every startup code in the core?

fpistm commented 4 years ago

Honestly, I don't know core __initialize_hardware_early(). BL is for BootLoader.

ekawahyu commented 4 years ago

FYI, got minimal changes merged with STM32F072B-DISCO variant here:

https://github.com/SnapBloks/Arduino_Core_STM32/tree/feature/STM32F072B-DISCO-softdfu-upload

Will do PR for the core soon. Please review and comments. Thank you.