question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenOCD on RaspberryPi broken

See original GitHub issue

What 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

  1. Install PlatformIO

  2. Connect Nucleo-Board to RaspberryPi

  3. Build and Upload

  4. 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:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ivankravetscommented, Jun 14, 2019

Happy coding with PlatformIO 🤗

0reactions
LtdSaucecommented, Jun 14, 2019

Works on all my machines now 😃 Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenOCD RP2040 branch installation is broken
I am following the instructions from the "Getting started with Raspberry Pi Pico" PDF and having some trouble.
Read more >
Raspberry Pi and OpenOCD - Lean2
Having just written 2100 words and drawn 8 diagrams, I'm going to take a short break. However, first I ought to give some...
Read more >
OpenOCD chip programming on Raspberry Pi ... - YouTube
Subscribe to Adafruit on YouTube: http://adafru.it/subscribeJoin our weekly Show & Tell on G+ Hangouts On Air: http:...
Read more >
OpenOCD on Raspberry Pi: Better with SWD on SPI
The snake eats its own tail! To break the snake, we use a sneaky way to read IDCODE after resetting, the Throwaway Way…...
Read more >
Raspberry pi 3 openocd debugging jtag scan interrogation ...
The JTAG state machine goes to the shift idcode state when powered on. You only need two pins to be working. Tclk and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found