Skip to content

Commit 744d3c0

Browse files
authored
Merge pull request #21794 from crasbe/pr/guides_stm32_flash_openocd
doc/guides: Extend STM32 Flashing Guide with OpenOCD and WSL Remark
2 parents 5afe64e + 88ff3c6 commit 744d3c0

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed

doc/guides/board_specific/stm32.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ title: STM32 Flashing
33
description: Guide on how to flash STM32 boards
44
---
55

6+
## General
7+
8+
The Nucleos often ship with very old ST-Link Firmware.
9+
If the flash operation fails for some reason, it is possible that
10+
the embedded ST-Link firmware is either too old or has bugs that have been
11+
fixed in the meantime. You can find updates for the ST-Link on
12+
[this STM webpage](https://www.st.com/en/development-tools/stsw-link007.html).
13+
You can also use the `STM32CubeProgrammer` software to update the firmware.
14+
615
## Flashing the Board Using OpenOCD
716

817
The ST Nucleo32, 64 and 144 boards include an on-board ST-LINK programmer
@@ -24,8 +33,36 @@ select it by explicitly setting the `PROGRAMMER` variable:
2433
make BOARD=xxxxx PROGARMMER=openocd flash
2534
```
2635

36+
:::note
37+
The OpenOCD release cycle is quite slow and newly released chips might not be
38+
supported by the latest release. For example the STM32C0 series is not yet
39+
supported by OpenOCD 0.12.0, resulting in the following error message:
40+
`Warn : Cannot identify target as an STM32G0/G4/L4/L4+/L5/U5/WB/WL family device.`.
41+
42+
Furthermore, some distributions ship even older versions, which might not have
43+
support for new devices or for the ST-Link V3 that is built-in on new
44+
generation Nucleos, resulting in a diffuse LibUSB error message such as this:
45+
`Error: libusb_open() failed with LIBUSB_ERROR_ACCESS`.
46+
If you have a recent OpenOCD version, you can check if your user is
47+
in the `dialout` and/or `plugdev` group and therefore has the appropriate
48+
access rights.
49+
50+
In either of the first two cases you have to compile the latest OpenOCD
51+
sources for your system and manually update the
52+
`/etc/udev/rules.d/60-openocd.rules` file with the
53+
file provided in the `contrib` subfolder of the OpenOCD repository.
54+
Please refer to the OpenOCD documentation for further information.
55+
:::
56+
2757
## Flashing the Board Using the ST-LINK Mass Storage Device
2858

59+
:::note
60+
This method does not (easily) work with WSL, as the standard kernel provided
61+
does not support Mass Storage Devices. While you can access the MSD through
62+
e.g. `/mnt/d/` if the ST-Link is mounted under Windows, you can not use the
63+
VCP (Virtual COM Port) via `usbipd` inside of WSL at the same time.
64+
:::
65+
2966
The on-board ST-Link programmer found on all Nucleo32, 64 and 144 boards
3067
will show up as a mass storage device when plugged in via USB.
3168
Copying a HEX file to the mass storage device will trigger the flashing
@@ -37,13 +74,6 @@ you can use the following command:
3774
make BOARD=nucleo-xxxx PROGRAMMER=cpy2remed flash
3875
```
3976

40-
:::note
41-
If the flash operation fails for some reason, it is possible that
42-
the embedded ST-Link firmware is either too old or has bugs that have been
43-
fixed in the meantime. You can find updates for the ST-Link on
44-
[this STM webpage](https://www.st.com/en/development-tools/stsw-link007.html).
45-
:::
46-
4777
## Flashing the Board using stm32flash
4878

4979
It is possible to automatically boot the STM32 board into the in-ROM bootloader

0 commit comments

Comments
 (0)