Skip to content

openocd: flashing the STM32C0 and other "new" boards #21781

@crasbe

Description

@crasbe

Description

As discovered in #21775 (comment), the latest OpenOCD upstream code is required to flash the STM32C071 because the last OpenOCD Release (0.12.0, which is two years old at the time of writing) does not support is.

Also, the latest OpenOCD version wants the flash method to be swd instead of hla_swd, which apparently is not supported anymore.
swd is not a supported method for older OpenOCD versions though (0.11.0 that is standard on Ubuntu 22.04 LTS for example).

The make script that configures the OpenOCD settings for the ST-Link is not a great help at the moment because it changes swd to hla_swd by default:

# If swd / jtag is selected by the board, prefix it with hla_
ifneq (,$(filter swd jtag,$(OPENOCD_TRANSPORT)))
OPENOCD_TRANSPORT := hla_$(OPENOCD_TRANSPORT)
endif
# All ST-Link adapters support hla_swd, so use that for simplicity
OPENOCD_TRANSPORT ?= hla_swd

One temporary fix would be to set the OPENOCD_TRANSPORT variable to dapdirect_swd, which is also deprecated though...

The better solution would be to add a version check.

@maribu said that Zephyr maintains it's own OpenOCD fork that supports all boards supported by Zephyr, so that might be an option to look at. Perhaps it also supports the RP2040 and RP2350, so we don't need to point to the Raspberry Pi fork of OpenOCD?

It would be nice not to have to have three or four different OpenOCD forks on the computer 🫠

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: boardsArea: Board portsDiscussion: RFCThe issue/PR is used as a discussion starting point about the item of the issue/PRType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions