Skip to content

Commit

Permalink
feat(platform): Add OpenOCD programming support for STeaMi and Nucleo…
Browse files Browse the repository at this point in the history
… 64 boards

- Modified `platform.txt` to enable programming via OpenOCD, which was already used for debugging.
- Added an example demonstrating how to program all Nucleo-64 boards, whether they use STLink or DAPLink.

To avoid conflict, the support for STeaMi will be added after the merge of the PR stm32duino#2526

*Benefits:*

- Enables programming of STeaMi boards.
- Supports P_NUCLEO boards that use DAPLink instead of STLink to leverage WebUSB functionality.
  • Loading branch information
nedseb committed Sep 27, 2024
1 parent 8da4af2 commit f52cbd8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ Nucleo_64.menu.pnum.P_NUCLEO_WB55RG=P-Nucleo WB55RG
Nucleo_64.menu.pnum.P_NUCLEO_WB55RG.node="NODE_WB55RG,NOD_WB55RG"
Nucleo_64.menu.pnum.P_NUCLEO_WB55RG.upload.maximum_size=524288
Nucleo_64.menu.pnum.P_NUCLEO_WB55RG.upload.maximum_data_size=196608
Nucleo_64.menu.upload_method.OpenOCD.upload.target=stm32wbx
Nucleo_64.menu.pnum.P_NUCLEO_WB55RG.build.mcu=cortex-m4
Nucleo_64.menu.pnum.P_NUCLEO_WB55RG.build.fpu=-mfpu=fpv4-sp-d16
Nucleo_64.menu.pnum.P_NUCLEO_WB55RG.build.float-abi=-mfloat-abi=hard
Expand All @@ -817,6 +818,7 @@ Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE=P-Nucleo WB55 USB Dongle
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.node="No_mass_storage_for_this_board_Use_STLink_upload_method"
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.upload.maximum_size=524288
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.upload.maximum_data_size=196608
Nucleo_64.menu.upload_method.OpenOCD.upload.target=stm32wbx
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.mcu=cortex-m4
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.fpu=-mfpu=fpv4-sp-d16
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.float-abi=-mfloat-abi=hard
Expand Down Expand Up @@ -876,6 +878,16 @@ Nucleo_64.menu.upload_method.dfuMethod.upload.protocol=dfu
Nucleo_64.menu.upload_method.dfuMethod.upload.options=-v {upload.vid} -p {upload.pid}
Nucleo_64.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg

Nucleo_64.menu.upload_method.OpenOCD=OpenOCD STLink (SWD)
Nucleo_64.menu.upload_method.OpenOCD.upload.protocol=stlink
Nucleo_64.menu.upload_method.OpenOCD.upload.setup_command=transport select hla_swd;
Nucleo_64.menu.upload_method.OpenOCD.upload.tool=openocd_upload

Nucleo_64.menu.upload_method.OpenOCD=OpenOCD DapLink (SWD)
Nucleo_64.menu.upload_method.OpenOCD.upload.protocol=cmsis-dap
Nucleo_64.menu.upload_method.OpenOCD.upload.setup_command=transport select swd;
Nucleo_64.menu.upload_method.OpenOCD.upload.tool=openocd_upload

################################################################################
# Nucleo 32 boards

Expand Down
8 changes: 8 additions & 0 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ tools.remoteproc_gen.upload.params.verbose=
tools.remoteproc_gen.upload.params.quiet=
tools.remoteproc_gen.upload.pattern="{busybox}" sh "{path}/{script}" generate "{build.path}/{build.project_name}.elf" "{build.path}/run_arduino_{build.project_name}.sh"

# OpenOCD sketch upload
tools.openocd_upload.path={openocd_dir}
tools.openocd_upload.cmd=bin/openocd
tools.openocd_upload.cmd.windows=bin/openocd.exe
tools.openocd_upload.upload.params.verbose=-d2
tools.openocd_upload.upload.params.quiet=-d0
tools.openocd_upload.upload.pattern="{path}/{cmd}" {upload.verbose} -f interface/{upload.protocol}.cfg -c "{upload.setup_command}" -f target/{upload.target}.cfg -c "program {{build.path}/{build.project_name}.bin} verify reset; shutdown;"

#
# Debugger
#
Expand Down

0 comments on commit f52cbd8

Please sign in to comment.