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

ARC debug support broken after Zephyr SDK 0.14.2 #631

Open
jkiepert opened this issue Mar 1, 2023 · 9 comments
Open

ARC debug support broken after Zephyr SDK 0.14.2 #631

jkiepert opened this issue Mar 1, 2023 · 9 comments
Assignees
Labels
area: OpenOCD Issues related to OpenOCD bug priority: medium Medium impact/importance issue

Comments

@jkiepert
Copy link

jkiepert commented Mar 1, 2023

Overview
There appears to be a regression in ARC debugger support with Zephyr SDK releases after 0.14.2. Initially, we encountered this with our own ARC EM7D-based SoC, but I have also reproduced this regression with the natively supported Synopsys ARC EM Starter Kit (EMSK) board across Zephyr release versions when using Zephyr SDK 0.15.2 or later.

Board target: em_starterkit_em7d
Zephyr versions tested: v2.4, v2.7, v3.3
Zephyr SDK versions tested: 0.12.1, 0.14.2, 0.15.2, 0.16.0-beta1
Application tested: zephyr/samples/basic/threads

Bug
There appear to be two major regressions after SDK 0.14.2:

  1. Debugger connection failure if CONFIG_DEBUG_THREAD_INFO=y (or CONFIG_OPENOCD_SUPPORT=y in earlier versions of Zephyr)
  2. Code loading via GDB and code stepping via GDB is broken when connection is successful (only possible without CONFIG_DEBUG_THREAD_INFO=y)

It should be noted that code loading via west flash is functional with recent SDK versions. It is only debug functionality that is broken (whether using west debug or cmake --target debug).

To Reproduce
Steps to reproduce the behavior debugger connection failure using Zephyr v3.3 (or v2.7) with SDK 0.16.0-beta1 or 0.15.2:

  1. cd zephyr/samples/basic threads
  2. west build -b em_starterkit_em7d -p always -- -DCMAKE_BUILD_TYPE=Debug -DCONFIG_DEBUG_THREAD_INFO=y
  3. west debug
  4. Output
(zephyr-v3.3) jkiepert@aurora:~/work/sdk/zephyr/samples/basic/threads$ west debug
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner openocd
-- runners.openocd: OpenOCD GDB server running on port 3333; thread info enabled
Open On-Chip Debugger 0.11.0+dev-00725-gc5c47943d (2022-12-07-08:45)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'ftdi vid_pid' not 'ftdi_vid_pid'
DEPRECATED! use 'ftdi channel' not 'ftdi_channel'
DEPRECATED! use 'ftdi layout_init' not 'ftdi_layout_init'
Info : Zephyr: looking for target: arcv2
openocd: src/jtag/core.c:338: jtag_checks: Assertion `jtag_trst == 0' failed.
GNU gdb (Zephyr SDK 0.16.0-beta1) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arc-zephyr-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build/zephyr/zephyr.elf...
:3333: Connection timed out.
You can't do that when your target is `exec'
(gdb) 

Notice the JTAG failure message:

openocd: src/jtag/core.c:338: jtag_checks: Assertion `jtag_trst == 0' failed.
...
:3333: Connection timed out.
You can't do that when your target is `exec'

Steps to reproduce the behavior GDB load/step failure using Zephyr v3.3 (or v2.7) + SDK 0.16.0-beta1 or 0.15.2

  1. cd zephyr/samples/basic threads
  2. west build -b em_starterkit_em7d -p always -- -DCMAKE_BUILD_TYPE=Debug
  3. west debug
  4. Output
(zephyr-v3.3) jkiepert@aurora:~/work/sdk/zephyr/samples/basic/threads$ west debug
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner openocd
-- runners.openocd: OpenOCD GDB server running on port 3333; no thread info available
Open On-Chip Debugger 0.11.0+dev-00725-gc5c47943d (2022-12-07-08:45)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'ftdi vid_pid' not 'ftdi_vid_pid'
DEPRECATED! use 'ftdi channel' not 'ftdi_channel'
DEPRECATED! use 'ftdi layout_init' not 'ftdi_layout_init'
Info : clock speed 5000 kHz
Info : JTAG tap: arc-em.cpu tap/device found: 0x200044b1 (mfg: 0x258 (ARC International), part: 0x0004, ver: 0x2)
Info : starting gdb server for arc-em.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* arc-em.cpu         arcv2      little arc-em.cpu         halted

Info : Listening on port 6333 for tcl connections
Info : Listening on port 4444 for telnet connections
GNU gdb (Zephyr SDK 0.16.0-beta1) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arc-zephyr-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build/zephyr/zephyr.elf...
Remote debugging using :3333
Info : accepting 'gdb' connection on tcp/3333
0x000006bc in sys_heap_aligned_alloc (heap=<optimized out>, align=0, bytes=0) at /home/jkiepert/work/sdk/zephyr/lib/os/heap.c:344
/usr/lib/python3/dist-packages/traitlets/config/loader.py:795: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(key) is 1:
/usr/lib/python3/dist-packages/traitlets/config/loader.py:804: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(key) is 1:
344             mem = (uint8_t *) ROUND_UP(mem + rew, align) - rew;
Warn : No RTOS could be auto-detected!
Loading section text, size 0x5894 lma 0x0
Load failed
(gdb) load
Loading section text, size 0x5894 lma 0x0
Load failed
(gdb) list
349             chunkid_t c_end = end - chunk_buf(h);
350             CHECK(c >= c0 && c  < c_end && c_end <= c0 + padded_sz);
351
352             /* Split and free unused prefix */
353             if (c > c0) {
354                     split_chunks(h, c0, c);
355                     free_list_add(h, c0);
356             }
357
358             /* Split and free unused suffix */
(gdb) s
^CInfo : The target is not running when halt was requested, stopping GDB.
Info : The target is not running when halt was requested, stopping GDB.

At this point openocd continues to spew that last line until openocd is manually killed (killall -9 openocd).

Expected behavior
Connecting the debugger with west debug should halt the CPU and allow one to load code, single step the processor, and when CONFIG_DEBUG_THREAD_INFO=y, openocd should detect Zephyr and provide thread awareness such as info threads. All of this functionality is present when using Zephyr SDK 0.14.2 and 0.12.1.

Impact
This is a showstopper for Zephyr ARC development with Zephyr SDKs after 0.14.2.

Logs and console output
See above

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: Zephyr SDK 0.16.0-beta1 and 0.15.2
  • Commit SHA or Version used: Zephyr tag v3.3.0 (07c6af3b8c35c1e49186578ca61a25c76e2fb308)

Additional context
The EMSK board is configured for the EM7D CPU with the DIP switch set to OFF,OFF,OFF,OFF. However, the behavior appears to be the same independent of the particular ARC core used.

@abrodkin abrodkin self-assigned this Mar 1, 2023
@abrodkin
Copy link
Collaborator

abrodkin commented Mar 1, 2023

@jkiepert thanks for the report, let us look at what's wrong here. I'm wondering if this issue is blocking any important activities on your side, i.e. how soon that needs to be resolved?

@abrodkin abrodkin added the area: OpenOCD Issues related to OpenOCD label Mar 1, 2023
@jkiepert
Copy link
Author

jkiepert commented Mar 1, 2023

@abrodkin thank you for taking a look into this issue. To answer your question, this issue mainly prevents us from migrating to Zephyr v3.3 for our ARC-based products since Zephyr v3.3 requires SDK 0.15+. For the time being, we will stay on SDK 0.14.2 and Zephyr v2.7 until things have been fixed in the later Zephyr SDK versions.

@jkiepert
Copy link
Author

jkiepert commented Mar 2, 2023

@abrodkin I did a bit further investigation and found that there is a Zephyr version dependency to this issue as well. Specifically, I moved to the minimum SDK supported by Zephyr v2.7 (SDK 0.13.1) and then tested west debug with CONFIG_OPENOCD_SUPPORT=y across zephyr versions between v2.4 and v2.7 with the em_starterkit_em7d board target.

I found that the debugger connection and openocd thread awareness works for all zephyr versions between v2.4 and v2.6, but it breaks with Zephyr v2.7 and above. I do see a crash report generated for openocd. I've attached an example crash with 0.13.1, but similar crashes occur for SDK 0.14.2, 0.15.2, and 0.16.0-beta1.

Here's an example snippet from the 0.13.1 openocd crash report (report is similar for newer SDK versions):

ProblemType: Crash
Architecture: amd64
CurrentDesktop: KDE
Date: Wed Mar  1 17:17:09 2023
DistroRelease: Ubuntu 18.04
ExecutablePath: /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/bin/openocd
ExecutableTimestamp: 1677716162
ProcCmdline: /opt/tools/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/openocd -s /home/jkiepert/work/sdk/zephyr/boards/arc/em_starterkit/support -s /opt/tools/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -f /home/jkiepert/work/sdk/zephyr/boards/arc/em_starterkit/support/openocd.cfg -c tcl_port\ 6333 -c telnet_port\ 4444 -c gdb_port\ 3333 -c $_TARGETNAME\ configure\ -rtos\ Zephyr -c init -c targets -c\ halt
ProcCwd: /home/jkiepert/work/sdk/zephyr/samples/basic/threads
ProcEnviron:
 LANG=en_US.UTF-8
 TERM=xterm-256color
 SHELL=/bin/bash
 LANGUAGE=
 XDG_RUNTIME_DIR=<set>
 PATH=(custom, user)
ProcMaps:
 55fd4fbde000-55fd4fc3a000 r--p 00000000 103:05 10888738                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/bin/openocd
 55fd4fc3a000-55fd4fe36000 r-xp 0005c000 103:05 10888738                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/bin/openocd
 55fd4fe36000-55fd4ff35000 r--p 00258000 103:05 10888738                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/bin/openocd
 55fd4ff35000-55fd4ff71000 r--p 00356000 103:05 10888738                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/bin/openocd
 55fd4ff71000-55fd4ff88000 rw-p 00392000 103:05 10888738                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/bin/openocd
 55fd4ff88000-55fd50009000 rw-p 00000000 00:00 0 
 55fd510b9000-55fd51160000 rw-p 00000000 00:00 0                          [heap]
 7f366ff4c000-7f366ff4e000 rw-p 00000000 00:00 0 
 7f366ff4e000-7f366ff55000 r--p 00000000 103:05 10888657                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libpthread-2.32.so
 7f366ff55000-7f366ff64000 r-xp 00007000 103:05 10888657                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libpthread-2.32.so
 7f366ff64000-7f366ff6a000 r--p 00016000 103:05 10888657                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libpthread-2.32.so
 7f366ff6a000-7f366ff6b000 r--p 0001b000 103:05 10888657                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libpthread-2.32.so
 7f366ff6b000-7f366ff6c000 rw-p 0001c000 103:05 10888657                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libpthread-2.32.so
 7f366ff6c000-7f366ff70000 rw-p 00000000 00:00 0 
 7f366ff70000-7f366ff75000 r--p 00000000 103:05 10888666                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libudev.so.1.6.3
 7f366ff75000-7f366ff8a000 r-xp 00005000 103:05 10888666                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libudev.so.1.6.3
 7f366ff8a000-7f366ff93000 r--p 0001a000 103:05 10888666                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libudev.so.1.6.3
 7f366ff93000-7f366ff94000 ---p 00023000 103:05 10888666                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libudev.so.1.6.3
 7f366ff94000-7f366ff95000 r--p 00023000 103:05 10888666                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libudev.so.1.6.3
 7f366ff95000-7f366ff96000 rw-p 00024000 103:05 10888666                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libudev.so.1.6.3
 7f366ff96000-7f366ffbc000 r--p 00000000 103:05 10888641                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libc-2.32.so
 7f366ffbc000-7f36700fe000 r-xp 00026000 103:05 10888641                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libc-2.32.so
 7f36700fe000-7f367014b000 r--p 00168000 103:05 10888641                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libc-2.32.so
 7f367014b000-7f367014c000 ---p 001b5000 103:05 10888641                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libc-2.32.so
 7f367014c000-7f367014f000 r--p 001b5000 103:05 10888641                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libc-2.32.so
 7f367014f000-7f3670155000 rw-p 001b8000 103:05 10888641                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libc-2.32.so
 7f3670155000-7f367015b000 rw-p 00000000 00:00 0 
 7f367015b000-7f367015c000 r--p 00000000 103:05 10888643                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libdl-2.32.so
 7f367015c000-7f367015d000 r-xp 00001000 103:05 10888643                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libdl-2.32.so
 7f367015d000-7f367015e000 r--p 00002000 103:05 10888643                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libdl-2.32.so
 7f367015e000-7f367015f000 r--p 00002000 103:05 10888643                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libdl-2.32.so
 7f367015f000-7f3670160000 rw-p 00003000 103:05 10888643                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libdl-2.32.so
 7f3670160000-7f3670161000 r--p 00000000 103:05 10888663                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libutil-2.32.so
 7f3670161000-7f3670162000 r-xp 00001000 103:05 10888663                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libutil-2.32.so
 7f3670162000-7f3670163000 r--p 00002000 103:05 10888663                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libutil-2.32.so
 7f3670163000-7f3670164000 r--p 00002000 103:05 10888663                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libutil-2.32.so
 7f3670164000-7f3670165000 rw-p 00003000 103:05 10888663                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libutil-2.32.so
 7f3670165000-7f3670174000 r--p 00000000 103:05 10888645                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libm-2.32.so
 7f3670174000-7f367020c000 r-xp 0000f000 103:05 10888645                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libm-2.32.so
 7f367020c000-7f36702a5000 r--p 000a7000 103:05 10888645                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libm-2.32.so
 7f36702a5000-7f36702a6000 r--p 0013f000 103:05 10888645                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libm-2.32.so
 7f36702a6000-7f36702a7000 rw-p 00140000 103:05 10888645                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libm-2.32.so
 7f36702a7000-7f36702ab000 r--p 00000000 103:05 10888670                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libusb-1.0.so.0.2.0
 7f36702ab000-7f36702b8000 r-xp 00004000 103:05 10888670                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libusb-1.0.so.0.2.0
 7f36702b8000-7f36702c0000 r--p 00011000 103:05 10888670                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libusb-1.0.so.0.2.0
 7f36702c0000-7f36702c1000 r--p 00018000 103:05 10888670                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libusb-1.0.so.0.2.0
 7f36702c1000-7f36702c2000 rw-p 00019000 103:05 10888670                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/libusb-1.0.so.0.2.0
 7f36702c2000-7f36702c4000 r--p 00000000 103:05 10888706                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libhidapi-hidraw.so.0.0.0
 7f36702c4000-7f36702c6000 r-xp 00002000 103:05 10888706                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libhidapi-hidraw.so.0.0.0
 7f36702c6000-7f36702c7000 r--p 00004000 103:05 10888706                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libhidapi-hidraw.so.0.0.0
 7f36702c7000-7f36702c8000 r--p 00004000 103:05 10888706                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libhidapi-hidraw.so.0.0.0
 7f36702c8000-7f36702c9000 rw-p 00005000 103:05 10888706                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libhidapi-hidraw.so.0.0.0
 7f36702c9000-7f36702cc000 r--p 00000000 103:05 10888704                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libftdi1.so.2.4.0
 7f36702cc000-7f36702d4000 r-xp 00003000 103:05 10888704                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libftdi1.so.2.4.0
 7f36702d4000-7f36702d7000 r--p 0000b000 103:05 10888704                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libftdi1.so.2.4.0
 7f36702d7000-7f36702d8000 r--p 0000d000 103:05 10888704                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libftdi1.so.2.4.0
 7f36702d8000-7f36702d9000 rw-p 0000e000 103:05 10888704                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/usr/lib/libftdi1.so.2.4.0
 7f36702d9000-7f36702db000 rw-p 00000000 00:00 0 
 7f36702db000-7f36702dc000 r--p 00000000 103:05 10888635                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/ld-2.32.so
 7f36702dc000-7f36702fc000 r-xp 00001000 103:05 10888635                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/ld-2.32.so
 7f36702fc000-7f3670306000 r--p 00021000 103:05 10888635                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/ld-2.32.so
 7f3670306000-7f3670307000 rw-p 00000000 00:00 0 
 7f3670307000-7f3670308000 r--p 0002b000 103:05 10888635                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/ld-2.32.so
 7f3670308000-7f367030a000 rw-p 0002c000 103:05 10888635                  /opt/tools/zephyr-sdk-0.13.1/sysroots/x86_64-pokysdk-linux/lib/ld-2.32.so
 7ffd23a16000-7ffd23a38000 rw-p 00000000 00:00 0                          [stack]
 7ffd23bca000-7ffd23bcd000 r--p 00000000 00:00 0                          [vvar]
 7ffd23bcd000-7ffd23bcf000 r-xp 00000000 00:00 0                          [vdso]
 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
ProcStatus:
 Name:	openocd
 Umask:	0002
 State:	S (sleeping)
 Tgid:	22697
 Ngid:	0
 Pid:	22697
 PPid:	22690
 TracerPid:	0
 Uid:	1001	1001	1001	1001
 Gid:	1001	1001	1001	1001
 FDSize:	64
 Groups:	6 20 27 100 116 128 999 1001 
 NStgid:	22697
 NSpid:	22697
 NSpgid:	22697
 NSsid:	22697
 VmPeak:	    8924 kB
 VmSize:	    8924 kB
 VmLck:	       0 kB
 VmPin:	       0 kB
 VmHWM:	    4948 kB
 VmRSS:	    4948 kB
 RssAnon:	     884 kB
 RssFile:	    4064 kB
 RssShmem:	       0 kB
 VmData:	    1400 kB
 VmStk:	     136 kB
 VmExe:	    2400 kB
 VmLib:	    1908 kB
 VmPTE:	      60 kB
 VmSwap:	       0 kB
 HugetlbPages:	       0 kB
 CoreDumping:	1
 Threads:	1
 SigQ:	0/126588
 SigPnd:	0000000000000000
 ShdPnd:	0000000000000000
 SigBlk:	0000000000000000
 SigIgn:	0000000000000000
 SigCgt:	0000000180005007
 CapInh:	0000000000000000
 CapPrm:	0000000000000000
 CapEff:	0000000000000000
 CapBnd:	0000003fffffffff
 CapAmb:	0000000000000000
 NoNewPrivs:	0
 Seccomp:	0
 Speculation_Store_Bypass:	thread vulnerable
 Cpus_allowed:	fff
 Cpus_allowed_list:	0-11
 Mems_allowed:	00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
 Mems_allowed_list:	0
 voluntary_ctxt_switches:	2
 nonvoluntary_ctxt_switches:	0
Signal: 6
Uname: Linux 4.15.0-200-generic x86_64
UserGroups: dialout disk docker lpadmin sudo users vboxusers
_LogindSession: 3

@kokas-a
Copy link

kokas-a commented Mar 7, 2023

Hi @jkiepert,

We are still working on the issue, but I'd like to suggest you workaround.

If you type west -v debug you may see that west creates 2 separate processes:
openocd and gdb with appropriate sets of parameters.
One of OpenOcd's parameter is a command -c '$_TARGETNAME configure -rtos Zephyr' and
it is located in the middle of parameters list.
This parameters order cause error: openocd: src/jtag/core.c:338: jtag_checks: Assertion `jtag_trst == 0' failed.

Suggestion is to make a manual call of openocd and move the os-awareness command at the and of the argument list.
It may looks like:

<PATH_TO_SDK>/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/bin/openocd 
-s <PATH_TO_ZEPHYR>/zephyrproject/zephyr/boards/arc/em_starterkit/support 
-s <PATH_TO_SDK>/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts  
-f <PATH_TO_ZEPHYR>/zephyrproject/zephyr/boards/arc/em_starterkit/support/openocd.cfg 
-c 'tcl_port 6333' -c 'telnet_port 4444' -c 'gdb_port 3333' '-c init' '-c targets' '-c halt' 
-c '$_TARGETNAME configure -rtos Zephyr'

In parallel GDB should be executed with unchanged list of parameters:

<PATH_TO_SDK>/zephyr-sdk-0.15.0/arc-zephyr-elf/bin/arc-zephyr-elf-gdb 
-ex 'target extended-remote :3333' 
<PATH_TO_ZEPHYR>/zephyrproject/zephyr/samples/basic/threads/build/zephyr/zephyr.elf -ex load

@stephanosio stephanosio added bug priority: medium Medium impact/importance issue labels Mar 7, 2023
@jkiepert
Copy link
Author

jkiepert commented Mar 7, 2023

Thanks @kokas-a, I'll give this a try.

@perceiver-josh
Copy link

@kokas-a There seems to be something more going on here with ARC debug targets, or at least the FTDI debug interface to OpenOCD in the most recent toolchains/zephyr versions. I applied your patch above to Zephyr v3.3 OpenOCD runner with SDK 0.15.2 and while thread-aware debugging does work with the patch, several things are still going wrong:

  1. Debugging without thread awareness fails to load code at all:
.../zephyr/samples/basic/threads$ west build -b em_starterkit_em7d -p always -- -DCMAKE_BUILD_TYPE=Debug -DCONFIG_NO_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=n
...
../zephyr/samples/basic/threads$ west debug
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner openocd
-- runners.openocd: OpenOCD GDB server running on port 3333; no thread info available
Open On-Chip Debugger 0.11.0+dev-00725-gc5c47943d (2022-11-22-06:32)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'ftdi vid_pid' not 'ftdi_vid_pid'
DEPRECATED! use 'ftdi channel' not 'ftdi_channel'
DEPRECATED! use 'ftdi layout_init' not 'ftdi_layout_init'
Info : clock speed 5000 kHz
Info : JTAG tap: arc-em.cpu tap/device found: 0x200044b1 (mfg: 0x258 (ARC International), part: 0x0004, ver: 0x2)
Info : starting gdb server for arc-em.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* arc-em.cpu         arcv2      little arc-em.cpu         halted

Info : Listening on port 6333 for tcl connections
Info : Listening on port 4444 for telnet connections
GNU gdb (Zephyr SDK 0.15.2) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arc-zephyr-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build/zephyr/zephyr.elf...
Remote debugging using :3333
Info : accepting 'gdb' connection on tcp/3333
0x00003a90 in arch_cpu_idle () at /home/jkiepert/work/sdk/zephyr/arch/arc/core/cpu_idle.S:50
50		nop
Warn : No RTOS could be auto-detected!
Loading section text, size 0xf8f8 lma 0x0
Load failed
  1. Even with thread aware debug enabled, debugging only partially works. One can attach, load, and run the code and even halt and view thread info, but if you attempt to halt and single-step, openocd eventually hangs and must be killed manually. This behavior is more pronounced when running gdb with tui enable :
.../zephyr/samples/basic/threads$ west build -b em_starterkit_em7d -p always -- -DCMAKE_BUILD_TYPE=Debug -DCONFIG_NO_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y
...
zephyr/samples/basic/threads$ west debug
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner openocd
-- runners.openocd: OpenOCD GDB server running on port 3333; thread info enabled
Open On-Chip Debugger 0.11.0+dev-00725-gc5c47943d (2022-11-22-06:32)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'ftdi vid_pid' not 'ftdi_vid_pid'
DEPRECATED! use 'ftdi channel' not 'ftdi_channel'
DEPRECATED! use 'ftdi layout_init' not 'ftdi_layout_init'
Info : clock speed 5000 kHz
Info : JTAG tap: arc-em.cpu tap/device found: 0x200044b1 (mfg: 0x258 (ARC International), part: 0x0004, ver: 0x2)
Info : starting gdb server for arc-em.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* arc-em.cpu         arcv2      little arc-em.cpu         halted

Info : Zephyr: looking for target: arcv2
Info : Zephyr: target known, params at 0x55b2ffb529f8
Info : Listening on port 6333 for tcl connections
Info : Listening on port 4444 for telnet connections
GNU gdb (Zephyr SDK 0.15.2) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arc-zephyr-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build/zephyr/zephyr.elf...
Remote debugging using :3333
Info : accepting 'gdb' connection on tcp/3333
Error: No symbols for Zephyr
arch_cpu_idle () at /home/jkiepert/work/sdk/zephyr/arch/arc/core/cpu_idle.S:49
49		j_s [blink]
Info : Zephyr: does it have symbol 0 (mandatory)?
Info : Zephyr: does it have symbol 1 (mandatory)?
Info : Zephyr: does it have symbol 2 (mandatory)?
Info : Zephyr: does it have symbol 3 (optional)?
Info : Zephyr: all mandatory symbols found
Info : Auto-detected RTOS: Zephyr
Info : Zephyr: looking for target: arcv2
Info : Zephyr: target known, params at 0x55b2ffb529f8
Loading section text, size 0xfc84 lma 0x0
Loading section initlevel, size 0x88 lma 0xfc84
Loading section devices, size 0xc0 lma 0xfd0c
Loading section sw_isr_table, size 0xb0 lma 0xfdcc
Loading section _static_thread_data_area, size 0x90 lma 0xfe7c
Loading section device_handles, size 0x30 lma 0xff0c
Loading section log_const_sections, size 0x20 lma 0xff3c
Loading section zephyr_dbg_info, size 0x40 lma 0xff5c
Loading section rodata, size 0x1e44 lma 0xff9c
Loading section datas, size 0xe4 lma 0x80001d98
Loading section device_states, size 0x10 lma 0x80001e7c
Loading section k_heap_area, size 0x18 lma 0x80001e8c
Loading section k_queue_area, size 0x14 lma 0x80001ea4
Start address 0x000040d0, load size 73472
--Type <RET> for more, q to quit, c to continue without paging--
Transfer rate: 437 KB/sec, 4592 bytes/write.
(gdb) c
Continuing.
^C[New Thread 2147484320]
[New Thread 2147483936]
[New Thread 2147483792]
[New Thread 2147483648]

Thread 2 "idle" received signal SIGINT, Interrupt.
[Switching to Thread 2147484320]
arch_cpu_idle () at /home/jkiepert/work/sdk/zephyr/arch/arc/core/cpu_idle.S:49
49		j_s [blink]
(gdb) s
k_cpu_idle () at ../../../../include/zephyr/kernel.h:5692
5692	}
(gdb) s
Error: Only size_t of 4 bytes are supported
Only size_t of 4 bytes are supported
Error: Only size_t of 4 bytes are supported
Only size_t of 4 bytes are supported
Error: Only size_t of 4 bytes are supported
Only size_t of 4 bytes are supported
idle (unused1=0x800001e8 <_kernel>, unused2=0x0 <_VectorTable>, unused3=0x0 <_VectorTable>) at /home/jkiepert/work/sdk/zephyr/kernel/idle.c:50
50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) s
62			(void) arch_irq_lock();
(gdb) s
arch_irq_lock () at ../../../../include/zephyr/arch/arc/v2/irq.h:172
172		__asm__ volatile("clri %0" : "=r"(key):: "memory");
(gdb) 
173		return key;
(gdb) s
idle (unused1=0x800001e8 <_kernel>, unused2=0x0 <_VectorTable>, unused3=0x0 <_VectorTable>) at /home/jkiepert/work/sdk/zephyr/kernel/idle.c:86
86			k_cpu_idle();
(gdb) s
k_cpu_idle () at ../../../../include/zephyr/kernel.h:5691
5691		arch_cpu_idle();
(gdb) 
arch_cpu_idle () at /home/jkiepert/work/sdk/zephyr/arch/arc/core/cpu_idle.S:46
46		ld r1, [z_arc_cpu_sleep_mode]
(gdb) s
47		or r1, r1, (1 << 4) /* set IRQ-enabled bit */
(gdb) s
48		sleep r1
(gdb) s
49		j_s [blink]
(gdb) s
k_cpu_idle () at ../../../../include/zephyr/kernel.h:5692
5692	}
(gdb) s
idle (unused1=0x800001e8 <_kernel>, unused2=0x0 <_VectorTable>, unused3=0x0 <_VectorTable>) at /home/jkiepert/work/sdk/zephyr/kernel/idle.c:50
50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) s
62			(void) arch_irq_lock();
(gdb) info threads
  Id   Target Id                                                              Frame 
* 2    Thread 2147484320 "idle" (Name: idle, prio:15,useropts:1)              idle (unused1=0x800001e8 <_kernel>, 
    unused2=0x0 <_VectorTable>, unused3=0x0 <_VectorTable>) at /home/jkiepert/work/sdk/zephyr/kernel/idle.c:62
Info : Getting thread 2147483936 reg list
  3    Thread 2147483936 "uart_out_id" (Name: uart_out_id, prio:7,useropts:0) arch_switch (switch_to=0x800002a0 <z_idle_threads>, 
    switched_from=0x800001a4 <_k_thread_obj_uart_out_id+132>) at ../../../../arch/arc/include/kernel_arch_func.h:74
Info : Getting thread 2147483792 reg list
  4    Thread 2147483792 "blink1_id" (Name: blink1_id, prio:7,useropts:0)     arch_switch (switch_to=0x80000120 <_k_thread_obj_uart_out_id>, 
    switched_from=0x80000114 <_k_thread_obj_blink1_id+132>) at ../../../../arch/arc/include/kernel_arch_func.h:74
Info : Getting thread 2147483648 reg list
  5    Thread 2147483648 "blink0_id" (Name: blink0_id, prio:7,useropts:0)     arch_switch (switch_to=0x80000120 <_k_thread_obj_uart_out_id>, 
    switched_from=0x80000084 <_k_thread_obj_blink0_id+132>) at ../../../../arch/arc/include/kernel_arch_func.h:74
(gdb) thread 5
[Switching to thread 5 (Thread 2147483648)]
#0  arch_switch (switch_to=0x80000120 <_k_thread_obj_uart_out_id>, switched_from=0x80000084 <_k_thread_obj_blink0_id+132>)
    at ../../../../arch/arc/include/kernel_arch_func.h:74
74	}
(gdb) s
Info : Getting thread 3 reg list
Error: RTOS: failed to get register list
idle (unused1=0x800001e8 <_kernel>, unused2=0x0 <_VectorTable>, unused3=0x0 <_VectorTable>) at /home/jkiepert/work/sdk/zephyr/kernel/idle.c:62
62			(void) arch_irq_lock();
(gdb) s
arch_irq_lock () at ../../../../include/zephyr/arch/arc/v2/irq.h:172
172		__asm__ volatile("clri %0" : "=r"(key):: "memory");
(gdb) s
Info : Getting thread 3 reg list
Error: RTOS: failed to get register list
Info : Getting thread 3 reg list
Error: RTOS: failed to get register list
Info : Getting thread 3 reg list
Error: RTOS: failed to get register list
Info : Getting thread 3 reg list
Error: RTOS: failed to get register list
Info : Getting thread 3 reg list
Error: RTOS: failed to get register list
Info : Getting thread 3 reg list
Error: RTOS: failed to get register list
Info : Getting thread 3 reg list
Error: RTOS: failed to get register list
Info : Getting thread 3 reg list
Error: RTOS: failed to get register list
...
Info : The target is not running when halt was requested, stopping GDB.
...
>>>>>>>>>> Here I manually killed openocd with: killall -9 openocd
Error: libusb_handle_events() failed with LIBUSB_ERROR_INTERRUPTED
Error: error while flushing MPSSE queue: -4
Error: Failed to execute jtag queue: -4
Error: Could not obtain thread list
Info : The target is not running when halt was requested, stopping GDB.
shutdown command invoked
Remote communication error.  Target disconnected.: Connection reset by peer.

@kokas-a
Copy link

kokas-a commented Mar 16, 2023

  1. Debugging without thread awareness fails to load code at all:

Could you please provide output of west -v debug command (with verbose key)? It's not clear from your log what kind of parameters were passed to OpenOCD and GDB.

@perceiver-josh
Copy link

@kokas-a Here's the log with -v:

$ west -v debug
-- west debug: rebuilding
cmake version 3.20.5 is OK; minimum version is 3.13.1
Running CMake: /usr/local/bin/cmake --build /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build
ninja: no work to do.
-- west debug: using runner openocd
-- runners.openocd: OpenOCD GDB server running on port 3333; no thread info available
runners.openocd: /opt/tools/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/openocd -s /home/jkiepert/work/sdk/zephyr/boards/arc/em_starterkit/support -s /opt/tools/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -f /home/jkiepert/work/sdk/zephyr/boards/arc/em_starterkit/support/openocd.cfg -c 'tcl_port 6333' -c 'telnet_port 4444' -c 'gdb_port 3333' '-c init' '-c targets' '-c halt'
runners.openocd: /opt/tools/zephyr-sdk/arc-zephyr-elf/bin/arc-zephyr-elf-gdb-py -ex 'target extended-remote :3333' /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build/zephyr/zephyr.elf -ex load
Open On-Chip Debugger 0.11.0+dev-00725-gc5c47943d (2022-11-22-06:32)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'ftdi vid_pid' not 'ftdi_vid_pid'
DEPRECATED! use 'ftdi channel' not 'ftdi_channel'
DEPRECATED! use 'ftdi layout_init' not 'ftdi_layout_init'
Info : clock speed 5000 kHz
Info : JTAG tap: arc-em.cpu tap/device found: 0x200044b1 (mfg: 0x258 (ARC International), part: 0x0004, ver: 0x2)
Info : starting gdb server for arc-em.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* arc-em.cpu         arcv2      little arc-em.cpu         halted

Info : Listening on port 6333 for tcl connections
Info : Listening on port 4444 for telnet connections
GNU gdb (Zephyr SDK 0.15.2) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arc-zephyr-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build/zephyr/zephyr.elf...
Remote debugging using :3333
Info : accepting 'gdb' connection on tcp/3333
0x0000cf14 in k_sched_unlock () at /home/jkiepert/work/sdk/zephyr/kernel/sched.c:1003
1003			__ASSERT(_current->base.sched_locked != 0U, "");
Warn : No RTOS could be auto-detected!
Loading section text, size 0xf8f8 lma 0x0
Load failed
(gdb) 

@perceiver-josh
Copy link

@kokas-a interestingly, if I manually run openocd and gdb I see non-thread-aware debug loading work. The key is to not pass in -ex load with the gdb command.

Proceedure that seems to work for CONFIG_DEBUG_THEAD_INFO=n:

/opt/tools/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/openocd -s /home/jkiepert/work/sdk/zephyr/boards/arc/em_starterkit/support -s /opt/tools/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -f /home/jkiepert/work/sdk/zephyr/boards/arc/em_starterkit/support/openocd.cfg -c 'tcl_port 6333' -c 'telnet_port 4444' -c 'gdb_port 3333' '-c init' '-c targets' '-c halt'

In another terminal:

$ /opt/tools/zephyr-sdk/arc-zephyr-elf/bin/arc-zephyr-elf-gdb-py -ex 'target extended-remote :3333' /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build/zephyr/zephyr.elf
GNU gdb (Zephyr SDK 0.15.2) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arc-zephyr-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://github.com/zephyrproject-rtos/sdk-ng/issues>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build/zephyr/zephyr.elf...
Remote debugging using :3333
0x0000cf14 in k_sched_unlock () at /home/jkiepert/work/sdk/zephyr/kernel/sched.c:1003
1003			__ASSERT(_current->base.sched_locked != 0U, "");
(gdb) load
Loading section text, size 0xf8f8 lma 0x0
Loading section initlevel, size 0x88 lma 0xf8f8
Loading section devices, size 0xc0 lma 0xf980
Loading section sw_isr_table, size 0xb0 lma 0xfa40
Loading section _static_thread_data_area, size 0x90 lma 0xfaf0
Loading section device_handles, size 0x30 lma 0xfb80
Loading section log_const_sections, size 0x20 lma 0xfbb0
Loading section rodata, size 0x1d90 lma 0xfbd0
Loading section datas, size 0xe4 lma 0x80001c88
Loading section device_states, size 0x10 lma 0x80001d6c
Loading section k_heap_area, size 0x18 lma 0x80001d7c
Loading section k_queue_area, size 0x14 lma 0x80001d94
Start address 0x000040cc, load size 72320
Transfer rate: 446 KB/sec, 4821 bytes/write.
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
arch_cpu_idle () at /home/jkiepert/work/sdk/zephyr/arch/arc/core/cpu_idle.S:49
49		j_s [blink]
(gdb) s
k_cpu_idle () at ../../../../include/zephyr/kernel.h:5692
5692	}
(gdb) 
idle (unused1=0x8000014c <_kernel>, unused2=0x0 <_VectorTable>, unused3=0x0 <_VectorTable>) at /home/jkiepert/work/sdk/zephyr/kernel/idle.c:50
50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) n
62			(void) arch_irq_lock();
(gdb) 
86			k_cpu_idle();
(gdb) 
50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) 
62			(void) arch_irq_lock();
(gdb) 
86			k_cpu_idle();
(gdb) 
50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) 
62			(void) arch_irq_lock();
(gdb) 
86			k_cpu_idle();
(gdb) 
50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) 
62			(void) arch_irq_lock();
(gdb) 
86			k_cpu_idle();
(gdb) 

50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) 
62			(void) arch_irq_lock();
(gdb) 
86			k_cpu_idle();
(gdb) 

50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) 
62			(void) arch_irq_lock();
(gdb) 
86			k_cpu_idle();
(gdb) 
50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) 
62			(void) arch_irq_lock();
(gdb) 
86			k_cpu_idle();
(gdb) 
50			if (IS_ENABLED(CONFIG_SMP) && !IS_ENABLED(CONFIG_SCHED_IPI_SUPPORTED)) {
(gdb) 
62			(void) arch_irq_lock();
(gdb) quit
A debugging session is active.

	Inferior 1 [Remote target] will be detached.

Quit anyway? (y or n) y
Detaching from program: /home/jkiepert/work/sdk/zephyr/samples/basic/threads/build/zephyr/zephyr.elf, Remote target
[Inferior 1 (Remote target) detached]

@abrodkin abrodkin assigned kokas-a and unassigned abrodkin Mar 16, 2023
kokas-a pushed a commit to kokas-a/openocd_zephyr that referenced this issue Apr 18, 2023
In issues zephyrproject-rtos/sdk-ng#631
and zephyrproject-rtos/zephyr#55686
root case is in an attempt to access arc registers at early stage of
OpenOCD initialization process. At this stage transport is not
configured and this cause fault with error
"Assertion `jtag_trst == 0' failed".

As temporary solution this patch remove early access to ARC cores.
This also disables Zephyr RTOS suport for ARC_SEC cores.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
stephanosio pushed a commit to zephyrproject-rtos/openocd that referenced this issue Apr 19, 2023
In issues zephyrproject-rtos/sdk-ng#631
and zephyrproject-rtos/zephyr#55686
root case is in an attempt to access arc registers at early stage of
OpenOCD initialization process. At this stage transport is not
configured and this cause fault with error
"Assertion `jtag_trst == 0' failed".

As temporary solution this patch remove early access to ARC cores.
This also disables Zephyr RTOS suport for ARC_SEC cores.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
katyo pushed a commit to katyo/openocd that referenced this issue Jun 21, 2023
In issues zephyrproject-rtos/sdk-ng#631
and zephyrproject-rtos/zephyr#55686
root case is in an attempt to access arc registers at early stage of
OpenOCD initialization process. At this stage transport is not
configured and this cause fault with error
"Assertion `jtag_trst == 0' failed".

As temporary solution this patch remove early access to ARC cores.
This also disables Zephyr RTOS suport for ARC_SEC cores.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
katyo pushed a commit to katyo/openocd that referenced this issue Jun 21, 2023
In issues zephyrproject-rtos/sdk-ng#631
and zephyrproject-rtos/zephyr#55686
root case is in an attempt to access arc registers at early stage of
OpenOCD initialization process. At this stage transport is not
configured and this cause fault with error
"Assertion `jtag_trst == 0' failed".

As temporary solution this patch remove early access to ARC cores.
This also disables Zephyr RTOS suport for ARC_SEC cores.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: OpenOCD Issues related to OpenOCD bug priority: medium Medium impact/importance issue
Projects
None yet
Development

No branches or pull requests

5 participants