Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
abrodkin opened this issue Nov 23, 2021 · 0 comments
Open

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

abrodkin opened this issue Nov 23, 2021 · 0 comments
Assignees
Labels

Comments

@abrodkin
Copy link
Member

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
@abrodkin abrodkin added the bug label Nov 23, 2021
wangnuannuan added a commit to wangnuannuan/embarc_osp that referenced this issue Nov 24, 2021
fix issue foss-for-synopsys-dwc-arc-processors#174

Signed-off-by: Jingru Wang <jingru@synopsys.com>
wangnuannuan added a commit to wangnuannuan/embarc_osp that referenced this issue Nov 25, 2021
The openocd scripts root directory gets calculated improperly,
OPENOCD_EXECUTABLE_ROOT is the 'bin' folder, it's in the same
parent dirextory as 'script', so we need use '..' to get the
parent directory first.

fix issue foss-for-synopsys-dwc-arc-processors#174

Signed-off-by: Jingru Wang <jingru@synopsys.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants