Skip to content

Execution via OpenOCD is broken due to wrong scripts folder #174

@abrodkin

Description

@abrodkin

5581e62 breaks execution with OpenOCD:

make BOARD=iotdk TOOLCHAIN=gnu run
Download & Run obj_iotdk_10/gnu_arcem9d/blinky_gnu_arcem9d.elf
arc-elf32-gdb -ex "target remote | openocd --pipe -s  .../bin//share/openocd/scripts -f ../../../board/iotdk/configs/openocd/snps_iotdk.cfg" -ex "load" -ex "c" obj_iotdk_10/gnu_arcem9d/blinky_gnu_arcem9d.elf
...
Reading symbols from obj_iotdk_10/gnu_arcem9d/blinky_gnu_arcem9d.elf...
Remote debugging using | openocd --pipe -s  .../bin//share/openocd/scripts -f ../../../board/iotdk/configs/openocd/snps_iotdk.cfg
Open On-Chip Debugger 0.9.0-dev-g8ee31a5 (2021-10-11-00:24)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Remote communication error.  Target disconnected.: Connection reset by peer.
You can't do that when your target is `exec'
The program is not being run.
(gdb)

That happens because scripts root directory gets calculated improperly: as if it's calculated from bin folder (where openocd binary is located). The following change fixes it:

--- a/options/toolchain/toolchain_gnu.mk
+++ b/options/toolchain/toolchain_gnu.mk
@@ -156,7 +156,7 @@ ifeq ($(findstring $(MAKECMDGOALS),run gui),)
 endif
 endif
 else
-    OPENOCD_SCRIPT_ROOT = $(OPENOCD_EXECUTABLE_ROOT)/share/openocd/scripts
+    OPENOCD_SCRIPT_ROOT = $(OPENOCD_EXECUTABLE_ROOT)/../share/openocd/scripts
 endif

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions