Skip to content

WIP: Allow uploading using open-ocd-supported programmers #1002

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 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ GenF1.build.mcu=cortex-m3
GenF1.build.series=STM32F1xx
GenF1.build.cmsis_lib_gcc=arm_cortexM3l_math
GenF1.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} {build.bootloader_flags}
GenF1.build.openocd_script=openocd.cfg

# BLUEPILL_F103C6 board
GenF1.menu.pnum.BLUEPILL_F103C6=BluePill F103C6 (32K)
Expand All @@ -803,6 +804,8 @@ GenF1.menu.pnum.BLUEPILL_F103C6.upload.maximum_data_size=10240
GenF1.menu.pnum.BLUEPILL_F103C6.build.board=BLUEPILL_F103C6
GenF1.menu.pnum.BLUEPILL_F103C6.build.product_line=STM32F103x6
GenF1.menu.pnum.BLUEPILL_F103C6.build.variant=PILL_F103XX
GenF1.menu.pnum.BLUEPILL_F103C6.hid_bootloader=hid-bootloader/F103/low_and_medium_density/hid_generic_pc13.bin
GenF1.menu.pnum.BLUEPILL_F103C6.stm32duino_bootloader=stm32duino-bootloader/generic_boot20_pc13.bin

# BLUEPILL_F103C8 board
GenF1.menu.pnum.BLUEPILL_F103C8=BluePill F103C8
Expand All @@ -811,13 +814,17 @@ GenF1.menu.pnum.BLUEPILL_F103C8.upload.maximum_data_size=20480
GenF1.menu.pnum.BLUEPILL_F103C8.build.board=BLUEPILL_F103C8
GenF1.menu.pnum.BLUEPILL_F103C8.build.product_line=STM32F103xB
GenF1.menu.pnum.BLUEPILL_F103C8.build.variant=PILL_F103XX
GenF1.menu.pnum.BLUEPILL_F103C8.hid_bootloader=hid-bootloader/F103/low_and_medium_density/hid_generic_pc13.bin
GenF1.menu.pnum.BLUEPILL_F103C8.stm32duino_bootloader=stm32duino-bootloader/generic_boot20_pc13.bin

GenF1.menu.pnum.BLUEPILL_F103C8B=BluePill F103C8 (128k)
GenF1.menu.pnum.BLUEPILL_F103C8B.upload.maximum_size=131072
GenF1.menu.pnum.BLUEPILL_F103C8B.upload.maximum_data_size=20480
GenF1.menu.pnum.BLUEPILL_F103C8B.build.board=BLUEPILL_F103C8
GenF1.menu.pnum.BLUEPILL_F103C8B.build.product_line=STM32F103xB
GenF1.menu.pnum.BLUEPILL_F103C8B.build.variant=PILL_F103XX
GenF1.menu.pnum.BLUEPILL_F103C8B.hid_bootloader=hid-bootloader/F103/low_and_medium_density/hid_generic_pc13.bin
GenF1.menu.pnum.BLUEPILL_F103C8B.stm32duino_bootloader=stm32duino-bootloader/generic_boot20_pc13.bin

# BLACKPILL_F103C8 board
GenF1.menu.pnum.BLACKPILL_F103C8=BlackPill F103C8
Expand All @@ -826,13 +833,17 @@ GenF1.menu.pnum.BLACKPILL_F103C8.upload.maximum_data_size=20480
GenF1.menu.pnum.BLACKPILL_F103C8.build.board=BLACKPILL_F103C8
GenF1.menu.pnum.BLACKPILL_F103C8.build.product_line=STM32F103xB
GenF1.menu.pnum.BLACKPILL_F103C8.build.variant=PILL_F103XX
GenF1.menu.pnum.BLACKPILL_F103C8.hid_bootloader=hid-bootloader/F103/low_and_medium_density/hid_generic_pc13.bin
GenF1.menu.pnum.BLACKPILL_F103C8.stm32duino_bootloader=stm32duino-bootloader/generic_boot20_pc13.bin

GenF1.menu.pnum.BLACKPILL_F103C8B=BlackPill F103C8 (128k)
GenF1.menu.pnum.BLACKPILL_F103C8B.upload.maximum_size=131072
GenF1.menu.pnum.BLACKPILL_F103C8B.upload.maximum_data_size=20480
GenF1.menu.pnum.BLACKPILL_F103C8B.build.board=BLACKPILL_F103C8
GenF1.menu.pnum.BLACKPILL_F103C8B.build.product_line=STM32F103xB
GenF1.menu.pnum.BLACKPILL_F103C8B.build.variant=PILL_F103XX
GenF1.menu.pnum.BLACKPILL_F103C8B.hid_bootloader=hid-bootloader/F103/low_and_medium_density/hid_generic_pc13.bin
GenF1.menu.pnum.BLACKPILL_F103C8B.stm32duino_bootloader=stm32duino-bootloader/generic_boot20_pc13.bin

# Generic STM32F103Rx boards (Blue button)
GenF1.menu.pnum.Generic_F103R8T6=Generic F103R8T6 (Blue Button)
Expand Down Expand Up @@ -956,6 +967,7 @@ 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.bootloader.file={hid_bootloader}

GenF1.menu.upload_method.dfu2Method=Maple DFU Bootloader 2.0
GenF1.menu.upload_method.dfu2Method.upload.protocol=maple
Expand All @@ -964,6 +976,7 @@ GenF1.menu.upload_method.dfu2Method.upload.usbID=1EAF:0003
GenF1.menu.upload_method.dfu2Method.upload.altID=2
GenF1.menu.upload_method.dfu2Method.build.flash_offset=0x2000
GenF1.menu.upload_method.dfu2Method.build.bootloader_flags=-DBL_LEGACY_LEAF -DVECT_TAB_OFFSET={build.flash_offset}
GenF1.menu.upload_method.dfu2Method.bootloader.file={stm32duino_bootloader}

GenF1.menu.upload_method.dfuoMethod=Maple DFU Bootloader original
GenF1.menu.upload_method.dfuoMethod.upload.protocol=maple
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bootloaders/stm32duino-bootloader/cc3d.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
37 changes: 35 additions & 2 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
# -------------------

# Upload to board via mass storage
tools.massStorageCopy.cmd=massStorageCopy.sh
tools.massStorageCopy.cmd=massStorageCopy
tools.massStorageCopy.cmd.windows=massStorageCopy.bat
tools.massStorageCopy.cmd.macosx=massStorageCopyMacOsX
tools.massStorageCopy.path={runtime.tools.STM32Tools.path}/tools/win
tools.massStorageCopy.path.macosx={runtime.tools.STM32Tools.path}/tools/macosx
tools.massStorageCopy.path.linux={runtime.tools.STM32Tools.path}/tools/linux
Expand All @@ -166,6 +167,7 @@ tools.massStorageCopy.upload.pattern="{path}/{cmd}" {upload.verbose} -I "{build.

# STM32CubeProgrammer upload
tools.stm32CubeProg.cmd=stm32CubeProg.sh
tools.stm32CubeProg.cmd.macosx=stm32CubeProg
tools.stm32CubeProg.cmd.windows=stm32CubeProg.bat
tools.stm32CubeProg.path.linux={runtime.tools.STM32Tools.path}/tools/linux
tools.stm32CubeProg.path.macosx={runtime.tools.STM32Tools.path}/tools/macosx
Expand Down Expand Up @@ -193,7 +195,7 @@ tools.hid_upload.upload.params.quiet=n
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.sh
tools.maple_upload.cmd=maple_upload
tools.maple_upload.cmd.windows=maple_upload.bat
tools.maple_upload.path={runtime.tools.STM32Tools.path}/tools/win
tools.maple_upload.path.macosx={runtime.tools.STM32Tools.path}/tools/macosx
Expand All @@ -210,3 +212,34 @@ tools.remoteproc_gen.script=run_arduino_gen.sh
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, for upload using programmer
#
tools.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path}
tools.openocd.cmd=bin/openocd
tools.openocd.cmd.windows=bin/openocd.exe
tools.openocd.init_args=-c "telnet_port disabled" -s "{path}/share/openocd/scripts/"
tools.openocd.interface_args=-c "source [find interface/{program.interface}]"
tools.openocd.board_args=-f "{runtime.platform.path}/variants/{build.variant}/{build.openocd_script}"
# This looks up the flash base address and puts it in the flash_base variable
# This uses the flash list command that returns a list of flash banks,
# using lindex to extract the first bank, which is a list of name/value
# pairs, which is transformed to an (associative) array with array set,
# and then the 'base' element is extracted.
tools.openocd.flash_base_args=-c "array set flash_bank [lindex [flash list] 0]; set flash_base $flash_bank(base)"

tools.openocd.program.params.verbose=-d2
tools.openocd.program.params.quiet=-d0
tools.openocd.program.program_args=-c "program {{build.path}/{build.project_name}.elf} verify reset; shutdown"
tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} {init_args} {interface_args} {board_args} {program.program_args}

# Used for burn bootloader, must exist even if empty
tools.openocd.erase.params.verbose=-d2
tools.openocd.erase.params.quiet=-d0
tools.openocd.erase.pattern=

tools.openocd.bootloader.params.verbose=-d2
tools.openocd.bootloader.params.quiet=-d0
tools.openocd.bootloader.program_args={flash_base_args} -c "program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset $flash_base; shutdown"
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} {init_args} {interface_args} {board_args} {bootloader.program_args}
17 changes: 17 additions & 0 deletions programmers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmsis_dap.name=CMSIS-DAP compatible programmer
cmsis_dap.communication=USB
cmsis_dap.protocol=
cmsis_dap.program.protocol=
cmsis_dap.program.interface=cmsis-dap.cfg
cmsis_dap.program.tool=openocd
cmsis_dap.program.extra_params=
cmsis_dap.bootloader.tool=openocd

stlink.name=ST-LINK
stlink.communication=USB
stlink.protocol=
stlink.program.protocol=
stlink.program.interface=stlink.cfg
stlink.program.tool=openocd
stlink.program.extra_params=
stlink.bootloader.tool=openocd
1 change: 1 addition & 0 deletions variants/PILL_F103XX/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source [find target/stm32f1x.cfg]