OpenOCD on RaspberryPi broken
See original GitHub issueWhat kind of issue is this?
- PlatformIO Core. If you’ve found a bug, please provide an information below.
Configuration
Operating system: Raspbian GNU/Linux 9 (stretch)
PlatformIO Version (platformio --version
): PlatformIO, version 3.6.7
Description of problem
The installation of the OpenOCD-Tool (tool-openocd @ 2.1000.190420) seems to be broken and compared to my Desktop (Linux Mint 19) a little older (tool-openocd @ 2.1000.190422). PlatformIO Versions are the same.
On the RaspberryPi OpenOCD fails to open a Connection to my STM32 NucleoF411RE Board due to missing Board-Config Files. Actually the Files are present, but not in the directory that OpenOCD looks for them.
Steps to Reproduce
-
Install PlatformIO
-
Connect Nucleo-Board to RaspberryPi
-
Build and Upload
-
Run OpenOCD standalone from inside .platformio/packages/tool-openocd/:
bin/openocd -d -f scripts/board/st_nucleo_f4.cfg
Actual Results
After Step 3 OpenOCD Fails with following output:
Open On-Chip Debugger 0.10.0+dev-00796-ga4ac561 (2019-04-20-17:09)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
/home/pi/.platformio/packages/tool-openocd/scripts/board/st_nucleo_f4.cfg:7: Error: Can't find interface/stlink.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 56
at file "/home/pi/.platformio/packages/tool-openocd/scripts/board/st_nucleo_f4.cfg", line 7
*** [upload] Error 1
If OpenOCD is called standalone with any given Board.cfg File in Verbose-Mode like in Step 4 it prints out the following lines:
Open On-Chip Debugger 0.10.0+dev-00796-ga4ac561 (2019-04-20-17:09)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
User : 13 13 command.c:544 command_print(): debug_level: 3
Debug: 14 13 options.c:184 add_default_dirs(): bindir=/tmp/pio-openocd/bin
Debug: 15 13 options.c:185 add_default_dirs(): pkgdatadir=/tmp/pio-openocd/share/openocd
Debug: 16 13 options.c:186 add_default_dirs(): exepath=/home/pi/.platformio/packages/tool-openocd/bin
Debug: 17 13 options.c:187 add_default_dirs(): bin2data=../share/openocd
Debug: 18 13 configuration.c:42 add_script_search_dir(): adding /home/pi/.openocd
Debug: 19 13 configuration.c:42 add_script_search_dir(): adding /home/pi/.platformio/packages/tool-openocd/bin/../share/openocd/site
Debug: 20 13 configuration.c:42 add_script_search_dir(): adding /home/pi/.platformio/packages/tool-openocd/bin/../share/openocd/scripts
Debug: 21 14 configuration.c:97 find_file(): found scripts/board/st_nucleo_f4.cfg
User : 22 15 command.c:715 command_run_line(): scripts/board/st_nucleo_f4.cfg:7: Error: Can't find interface/stlink.cfg
in procedure 'script'
at file "embedded:startup.tcl", line 56
at file "scripts/board/st_nucleo_f4.cfg", line 7
Expected Results
Expected result was that the firmware is beeing uploaded without errors.
If problems with PlatformIO Build System:
The content of platformio.ini
:
[env:nucleo_f411re]
platform = ststm32
board = nucleo_f411re
framework = arduino
Source file to reproduce issue:
#include <Arduino.h>
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
digitalToggle(LED_BUILTIN);
delay(200);
}
Additional info
All installed OpenOCD-Scripts can be found under .platformio/packages/tool-openocd/scripts/
Only OpenOCD isn’t configured to look for them there as you can see from Debug-Output 18 to 20.
I also have a workaround running for me. I added the directory .platformio/packages/tool-openocd/share/openocd
and created a Sym-Link in it to the scripts-directory:
.platformio/packages/tool-openocd/share/openocd/ $ ls -la
total 8
drwxr-xr-x 2 pi pi 4096 May 29 16:53 .
drwxr-xr-x 5 pi pi 4096 Jun 3 10:56 ..
lrwxrwxr-x 1 pi pi 14 May 29 16:53 scripts -> ../../scripts/
With this Link the Script-Search in Debug-Line 20 does not fail and all Configurtions are loaded correctly and the firmware is uploaded.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
Happy coding with PlatformIO 🤗
Works on all my machines now 😃 Thanks!