STM32CubeProgrammer CLI v2.23.0 on macOS fails to identify MCU when launched via symlink
I am reporting this issue here following the recommendation of the STM32duino maintainer.
STM32CubeProgrammer GUI works correctly, but STM32_Programmer_CLI v2.23.0 fails to identify the same MCU when launched through a symbolic link on macOS.
The issue was initially reported on GitHub:
https://github.com/stm32duino/Arduino_Tools/issues/123
Below are the reproduction steps and a verified workaround.
Describe the bug
On macOS Apple Silicon, uploading to an STM32L053C8T6 using STM32CubeProgrammer (SWD) fails with:
Error: Unable to list supported devices
Error: Cannot identify the deviceThe ST-LINK/V2 is correctly detected, including firmware version and target voltage.
STM32CubeProgrammer GUI connects successfully and identifies the MCU (Device ID 0x417).
The problem was traced to invoking STM32_Programmer_CLI through a symbolic link in /usr/local/bin.
To Reproduce
-
Install STM32CubeProgrammer 2.23.0 on macOS.
-
Create a symbolic link to its CLI executable in
/usr/local/bin. -
Run:
STM32_Programmer_CLI -c port=SWD freq=4000 mode=UR reset=HWrst-
The CLI detects the ST-LINK but fails to identify the MCU.
Running the executable directly from its installation directory succeeds:
cd /Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/Resources/bin
./STM32_Programmer_CLI -c port=SWD freq=4000 mode=UR reset=HWrstImportantly, invoking the symbolic link still fails even when the current working directory is the CLI installation directory.
Expected behavior
The CLI should identify the MCU regardless of whether it is invoked directly or through a symbolic link.
Verified workaround
Replace the symbolic link with a shell wrapper at /usr/local/bin/STM32_Programmer_CLI:
#!/bin/sh
BIN="/Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/Resources/bin"
cd "$BIN" || exit 1
exec ./STM32_Programmer_CLI "$@"After this change, the CLI successfully identifies Device ID 0x417, and uploading from Arduino IDE works correctly.
Desktop
-
OS: macOS, Apple Silicon
-
Arduino IDE: 2.3.10
-
STM32Tools: 2.5.0
-
STM32CubeProgrammer: 2.23.0
-
Upload method: STM32CubeProgrammer (SWD)
-
STM32 core version: not recorded
-
Additional libraries: none required
Hardware
-
MCU: STM32L053C8T6 on a modified Bluepill board
-
Programmer: Original ST-LINK/V2
-
ST-LINK firmware: V2J46S7
-
Connection: SWD, 4000 kHz, Under Reset
-
Target voltage: 3.17 V
Additional context
The issue appears related to executable-path resolution or resource lookup in STM32CubeProgrammer CLI on macOS. The exact internal cause has not been established.
The workaround was verified on the configuration above; other macOS and CubeProgrammer versions have not been tested.
