Skip to content

Add dfu-util as a standard upload method #718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
12 changes: 9 additions & 3 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ GenF1.menu.upload_method.hidMethod=HID Bootloader 2.2
GenF1.menu.upload_method.hidMethod.upload.protocol=hid22
GenF1.menu.upload_method.hidMethod.upload.tool=hid_upload
GenF1.menu.upload_method.hidMethod.build.flash_offset=0x800
GenF1.menu.upload_method.hidMethod.build.bootloader_flags=-DBL_HID -DVECT_TAB_OFFSET={build.flash_offset}
GenF1.menu.upload_method.hidMethod.build.bootloader_flags=-DBL_HID -DVECT_TAB_OFFSET={build.flash_offset}

GenF1.menu.upload_method.dfu2Method=Maple DFU Bootloader 2.0
GenF1.menu.upload_method.dfu2Method.upload.protocol=maple
Expand Down Expand Up @@ -992,6 +992,12 @@ GenF4.menu.pnum.FEATHER_F405.build.product_line=STM32F405xx
GenF4.menu.pnum.FEATHER_F405.build.variant=FEATHER_F405

# Upload menu
GenF4.menu.upload_method.dfuUtil=USB (dfu-util)
GenF4.menu.upload_method.dfuUtil.upload.tool=dfu_util
GenF4.menu.upload_method.dfuUtil.upload.protocol=
GenF4.menu.upload_method.dfuUtil.upload.usbID=0483:df11
GenF4.menu.upload_method.dfuUtil.upload.address=0x08000000:leave

GenF4.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD)
GenF4.menu.upload_method.swdMethod.upload.protocol=0
GenF4.menu.upload_method.swdMethod.upload.options=-g
Expand All @@ -1015,7 +1021,7 @@ GenF4.menu.upload_method.hidMethod=HID Bootloader 2.2
GenF4.menu.upload_method.hidMethod.upload.protocol=hid22
GenF4.menu.upload_method.hidMethod.upload.tool=hid_upload
GenF4.menu.upload_method.hidMethod.build.flash_offset=0x4000
GenF4.menu.upload_method.hidMethod.build.bootloader_flags=-DBL_HID -DVECT_TAB_OFFSET={build.flash_offset}
GenF4.menu.upload_method.hidMethod.build.bootloader_flags=-DBL_HID -DVECT_TAB_OFFSET={build.flash_offset}

###############################
# Sparky Flight Controllers
Expand Down Expand Up @@ -1265,7 +1271,7 @@ Genericflight.build.series=STM32F1xx
Genericflight.build.cmsis_lib_gcc=arm_cortexM3l_math
Genericflight.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} {build.bootloader_flags}

# AfroFlight Rev5
# AfroFlight Rev5
Genericflight.menu.pnum.AFROFLIGHT_F103CB=Afro Flight Rev5 (8MHz)
Genericflight.menu.pnum.AFROFLIGHT_F103CB.upload.maximum_size=131072
Genericflight.menu.pnum.AFROFLIGHT_F103CB.upload.maximum_data_size=20480
Expand Down
14 changes: 12 additions & 2 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.5.1.path}/CMSIS/DSP/Lib/GCC

# USB Flags
# ---------
build.usb_flags=-DUSBCON {build.usb_speed} -DUSBD_VID={build.vid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT="{build.board}"' -DHAL_PCD_MODULE_ENABLED
build.usb_flags=-DUSBCON {build.usb_speed} -DUSBD_VID={build.vid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT="{build.board}"' -DHAL_PCD_MODULE_ENABLED

# Default usb manufacturer will be replaced at compile time using
# numeric vendor ID if available or by board's specific value.
Expand Down Expand Up @@ -189,7 +189,7 @@ tools.hid_upload.path.macosx={runtime.tools.STM32Tools.path}/tools/macosx
tools.hid_upload.path.linux={runtime.tools.STM32Tools.path}/tools/linux
tools.hid_upload.upload.params.verbose=-d
tools.hid_upload.upload.params.quiet=n
tools.hid_upload.upload.pattern="{path}/{cmd}" "{build.path}/{build.project_name}.bin" {serial.port.file}
tools.hid_upload.upload.pattern="{path}/{cmd}" "{build.path}/{build.project_name}.bin" {serial.port.file}

# Upload using Maple bootloader over DFU
tools.maple_upload.cmd=maple_upload
Expand All @@ -200,3 +200,13 @@ tools.maple_upload.path.linux={runtime.tools.STM32Tools.path}/tools/linux
tools.maple_upload.upload.params.verbose=-d
tools.maple_upload.upload.params.quiet=n
tools.maple_upload.upload.pattern="{path}/{cmd}" {serial.port.file} {upload.altID} {upload.usbID} "{build.path}/{build.project_name}.bin"

# USB upload using dfu-util
tools.dfu_util.cmd=dfu-util
tools.dfu_util.cmd.windows=dfu-util.exe
tools.dfu_util.path={runtime.tools.STM32Tools.path}/tools/win/dfu-util
tools.dfu_util.path.macosx={runtime.tools.STM32Tools.path}/tools/macosx/dfu-util
tools.dfu_util.path.linux={runtime.tools.STM32Tools.path}/tools/linux/dfu-util
tools.dfu_util.upload.params.verbose=-v
tools.dfu_util.upload.params.quiet=
tools.dfu_util.upload.pattern="{path}/{cmd}" --device {upload.usbID} -a 0 --dfuse-address {upload.address} -D "{build.path}/{build.project_name}.bin"