0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

PlatformIO で DAPLink を使って STM32 に書き込もうとしたらエラーが出る

Posted at

PlatformIO で STM32 開発をしていて、特定の DAP-Link を使用すると、以下のようなエラー表示された。

Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, serial, stlink
CURRENT: upload_protocol = cmsis-dap
Uploading .pio/build/genericSTM32F103C8/firmware.elf
xPack OpenOCD aarch64 Open On-Chip Debugger 0.11.0+dev (2021-10-16-21:18)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

swd
Warn : Using CMSIS-DAPv2 interface 1 with wrong class 10 subclass 0 or protocol 0
Warn : could not claim interface: Resource busy
Error: error reading data: Input/Output Error
...
Error: error reading data: Input/Output Error
Error: CMSIS-DAP command CMD_INFO failed.
Error: No Valid JTAG Interface Configured.
*** [upload] Error 255

ある DAP-Link デバイスだと成功したり、PyOCDだとできたにもかかわらずである。

どうも PlatformIO の指している OpenOCD のバージョンが古いようである。以下のように OpenOCD のバージョンに 3.12 を指定すると動作しました。

platform.ini
[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = stm32cube
platform_packages =
    toolchain-gccarmnoneeabi@~1.100301.220327
    tool-openocd@~3.1200.0
upload_protocol = cmsis-dap
monitor_port = /dev/ttyACM0
monitor_speed = 115200
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, serial, stlink
CURRENT: upload_protocol = cmsis-dap
Uploading .pio/build/genericSTM32F103C8/firmware.elf
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:08)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

swd
[stm32f1x.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800211c msp: 0x20005000
** Programming Started **
Warn : Adding extra erase range, 0x08002324 .. 0x080023ff
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked

PlatformIO の標準で指し示すバージョンがいろいろ古いのは一体何なんでしょう。。。

参考

Unable to download program through cmsis-dap debugger - General Discussion - PlatformIO Community
https://community.platformio.org/t/unable-to-download-program-through-cmsis-dap-debugger/21826

platformio/tool-openocd: Open On-Chip Debugger. Free and Open On…
https://registry.platformio.org/tools/platformio/tool-openocd/versions

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?