embarc_osp icon indicating copy to clipboard operation
embarc_osp copied to clipboard

Execution via OpenOCD is broken due to wrong scripts folder

Open abrodkin opened this issue 4 years ago • 0 comments

https://github.com/foss-for-synopsys-dwc-arc-processors/embarc_osp/commit/5581e62579df6795de4d8d77ca95de0b635868a4 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

abrodkin avatar Nov 23 '21 16:11 abrodkin