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: 12 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
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 Down Expand Up @@ -1038,6 +1044,12 @@ GenL0.menu.pnum.THUNDER_PACK.build.product_line=STM32L072xx
GenL0.menu.pnum.THUNDER_PACK.build.variant=THUNDER_PACK

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

GenL0.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD)
GenL0.menu.upload_method.swdMethod.upload.protocol=0
GenL0.menu.upload_method.swdMethod.upload.options=-g
Expand Down
14 changes: 12 additions & 2 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,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 @@ -190,7 +190,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 @@ -201,3 +201,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
tools.dfu_util.path.macosx={runtime.tools.STM32Tools.path}/tools/macosx/dfu-util
tools.dfu_util.path.linux={runtime.tools.STM32Tools.path}/tools/linux
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"