Debugging with Eclipse and PyOCD: Uncaught Exception in pyocd.exe


Weber, Dominik <dominik.weber@...>
 

Hello there,

 

I’m new to Zephyr and having some trouble with debugging my application with PyOCD and Eclipse. I’m running a multithreaded application on a nRF52840 DK. I flash and want to debug the application via the onboard debugger on the DK. I followed the steps described in the tutorial: https://docs.zephyrproject.org/2.3.0/application/index.html#application in the section „Eclipse Debugging“.

 

I use:

·         Zephyr 2.3 Build 99

·         Segger J-Link OB-SAM3U128-V2-NordicSemi

·         Eclipse 2019-09

·         Python 3.8.3

·         West 0.7.2

·         C compiler GNU 9.2.1

 

All Python dependencies for Zephyr are satisfied.

 

When I try to debug the application via pyocd.exe or pyocd-gdbserver.exe I get the following error:

 

0001289:CRITICAL:__main__:uncaught exception: 'JLinkProbe' object has no attribute '_lock'

Traceback (most recent call last):

  File "c:\python38\lib\site-packages\pyocd\__main__.py", line 362, in run

    self._COMMANDS[self._args.cmd](self)

  File "c:\python38\lib\site-packages\pyocd\__main__.py", line 680, in do_gdbserver

    with session:

  File "c:\python38\lib\site-packages\pyocd\core\session.py", line 302, in __enter__

    self.open()

  File "c:\python38\lib\site-packages\pyocd\core\session.py", line 420, in open

    self._board.init()

  File "c:\python38\lib\site-packages\pyocd\board\board.py", line 85, in init

    self.target.init()

  File "c:\python38\lib\site-packages\pyocd\core\coresight_target.py", line 160, in init

    seq.invoke()

  File "c:\python38\lib\site-packages\pyocd\utility\sequencer.py", line 213, in invoke

    resultSequence.invoke()

  File "c:\python38\lib\site-packages\pyocd\utility\sequencer.py", line 208, in invoke

    resultSequence = call()

  File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 359, in power_up_debug

    self.write_reg(DP_CTRL_STAT, CSYSPWRUPREQ | CDBGPWRUPREQ | MASKLANE | TRNNORMAL)

  File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 348, in write_reg

    self.write_dp(addr, data)

  File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 528, in write_dp

    did_lock = self._set_dpbanksel(addr, True)

  File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 480, in _set_dpbanksel

    self.lock()

  File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 252, in lock

    self.probe.lock()

  File "c:\python38\lib\site-packages\pyocd\probe\debug_probe.py", line 173, in lock

    self._lock.acquire()

AttributeError: 'JLinkProbe' object has no attribute '_lock'

 

Is this a bug in the python scripts or is the debugger not supported?

 

Thanks for your help!

 

Best Regards,

Dominik

 


Bolivar, Marti
 

Hi, responses inline.

"Weber, Dominik via lists.zephyrproject.org"
<dominik.weber=iis.fraunhofer.de@lists.zephyrproject.org> writes:

Hello there,

I'm new to Zephyr and having some trouble with debugging my application with PyOCD and Eclipse. I'm running a multithreaded application on a nRF52840 DK. I flash and want to debug the application via the onboard debugger on the DK. I followed the steps described in the tutorial: https://docs.zephyrproject.org/2.3.0/application/index.html#application in the section "Eclipse Debugging".

I use:

* Zephyr 2.3 Build 99

* Segger J-Link OB-SAM3U128-V2-NordicSemi

* Eclipse 2019-09

* Python 3.8.3

* West 0.7.2

* C compiler GNU 9.2.1

All Python dependencies for Zephyr are satisfied.
Does this mean you installed the latest pyocd? The zephyr
requirements-run-test.txt file from which pyocd comes just says:

pyocd>=0.24.0

The version of this tool is likely what is at issue.


When I try to debug the application via pyocd.exe or pyocd-gdbserver.exe I get the following error:

0001289:CRITICAL:__main__:uncaught exception: 'JLinkProbe' object has no attribute '_lock'
Traceback (most recent call last):
File "c:\python38\lib\site-packages\pyocd\__main__.py", line 362, in run
self._COMMANDS[self._args.cmd](self)
File "c:\python38\lib\site-packages\pyocd\__main__.py", line 680, in do_gdbserver
with session:
File "c:\python38\lib\site-packages\pyocd\core\session.py", line 302, in __enter__
self.open()
File "c:\python38\lib\site-packages\pyocd\core\session.py", line 420, in open
self._board.init()
File "c:\python38\lib\site-packages\pyocd\board\board.py", line 85, in init
self.target.init()
File "c:\python38\lib\site-packages\pyocd\core\coresight_target.py", line 160, in init
seq.invoke()
File "c:\python38\lib\site-packages\pyocd\utility\sequencer.py", line 213, in invoke
resultSequence.invoke()
File "c:\python38\lib\site-packages\pyocd\utility\sequencer.py", line 208, in invoke
resultSequence = call()
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 359, in power_up_debug
self.write_reg(DP_CTRL_STAT, CSYSPWRUPREQ | CDBGPWRUPREQ | MASKLANE | TRNNORMAL)
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 348, in write_reg
self.write_dp(addr, data)
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 528, in write_dp
did_lock = self._set_dpbanksel(addr, True)
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 480, in _set_dpbanksel
self.lock()
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 252, in lock
self.probe.lock()
File "c:\python38\lib\site-packages\pyocd\probe\debug_probe.py", line 173, in lock
self._lock.acquire()
AttributeError: 'JLinkProbe' object has no attribute '_lock'

Is this a bug in the python scripts or is the debugger not supported?
This error is coming from pyocd itself. Since it's an AttributeError it
looks like there's probably a bug in the tool. Knowing the exact version
is the next step. I would try manually installing the 0.24.0 version
given in the requirements file if the latest release is buggy here.

I don't understand if "When I try to debug the application via pyocd.exe
or pyocd-gdbserver.exe" means you are using 'west debug' or 'west
debugserver', but if so, you can run in verbose mode to see the pyocd
commands under the hood:

west -v debug

Example output:

$ west -v debug
[...]
-- west debug: using runner pyocd
-- runners.pyocd: pyOCD GDB server running on port 3333
runners.pyocd: pyocd gdbserver -p 3333 -T 4444 -t nrf52840 -f 4000000
runners.pyocd: /home/mbolivar/bin/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gdb /home/mbolivar/zp/zephyr/build/zephyr/zephyr.elf -ex 'target remote :3333' -ex 'monitor halt' -ex 'monitor reset' -ex load

Thanks,
Martí


Thanks for your help!

Best Regards,
Dominik



Weber, Dominik <dominik.weber@...>
 

Hey Marti,

Thanks for your help. The version 0.24.0 of pyocd was in fact the problem (obviously there was a bug). I installed the latest version and it works now!

Thanks!

Best Regards,
Dominik

-----Ursprüngliche Nachricht-----
Von: Bolivar, Marti <Marti.Bolivar@nordicsemi.no>
Gesendet: Dienstag, 11. August 2020 18:47
An: Weber, Dominik <dominik.weber@iis.fraunhofer.de>;
users@lists.zephyrproject.org
Betreff: Re: [Zephyr-users] Debugging with Eclipse and PyOCD: Uncaught
Exception in pyocd.exe

Hi, responses inline.

"Weber, Dominik via lists.zephyrproject.org"
<dominik.weber=iis.fraunhofer.de@lists.zephyrproject.org> writes:

Hello there,

I'm new to Zephyr and having some trouble with debugging my application
with PyOCD and Eclipse. I'm running a multithreaded application on a
nRF52840 DK. I flash and want to debug the application via the onboard
debugger on the DK. I followed the steps described in the tutorial:
https://docs.zephyrproject.org/2.3.0/application/index.html#application in
the section "Eclipse Debugging".

I use:

* Zephyr 2.3 Build 99

* Segger J-Link OB-SAM3U128-V2-NordicSemi

* Eclipse 2019-09

* Python 3.8.3

* West 0.7.2

* C compiler GNU 9.2.1

All Python dependencies for Zephyr are satisfied.
Does this mean you installed the latest pyocd? The zephyr
requirements-run-test.txt file from which pyocd comes just says:

pyocd>=0.24.0

The version of this tool is likely what is at issue.


When I try to debug the application via pyocd.exe or pyocd-gdbserver.exe I
get the following error:

0001289:CRITICAL:__main__:uncaught exception: 'JLinkProbe' object has no
attribute '_lock'
Traceback (most recent call last):
File "c:\python38\lib\site-packages\pyocd\__main__.py", line 362, in run
self._COMMANDS[self._args.cmd](self)
File "c:\python38\lib\site-packages\pyocd\__main__.py", line 680, in
do_gdbserver
with session:
File "c:\python38\lib\site-packages\pyocd\core\session.py", line 302, in
__enter__
self.open()
File "c:\python38\lib\site-packages\pyocd\core\session.py", line 420, in
open
self._board.init()
File "c:\python38\lib\site-packages\pyocd\board\board.py", line 85, in init
self.target.init()
File "c:\python38\lib\site-packages\pyocd\core\coresight_target.py", line
160, in init
seq.invoke()
File "c:\python38\lib\site-packages\pyocd\utility\sequencer.py", line 213,
in invoke
resultSequence.invoke()
File "c:\python38\lib\site-packages\pyocd\utility\sequencer.py", line 208,
in invoke
resultSequence = call()
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 359, in
power_up_debug
self.write_reg(DP_CTRL_STAT, CSYSPWRUPREQ | CDBGPWRUPREQ |
MASKLANE | TRNNORMAL)
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 348, in
write_reg
self.write_dp(addr, data)
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 528, in
write_dp
did_lock = self._set_dpbanksel(addr, True)
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 480, in
_set_dpbanksel
self.lock()
File "c:\python38\lib\site-packages\pyocd\coresight\dap.py", line 252, in
lock
self.probe.lock()
File "c:\python38\lib\site-packages\pyocd\probe\debug_probe.py", line
173, in lock
self._lock.acquire()
AttributeError: 'JLinkProbe' object has no attribute '_lock'

Is this a bug in the python scripts or is the debugger not supported?
This error is coming from pyocd itself. Since it's an AttributeError it
looks like there's probably a bug in the tool. Knowing the exact version
is the next step. I would try manually installing the 0.24.0 version
given in the requirements file if the latest release is buggy here.

I don't understand if "When I try to debug the application via pyocd.exe
or pyocd-gdbserver.exe" means you are using 'west debug' or 'west
debugserver', but if so, you can run in verbose mode to see the pyocd
commands under the hood:

west -v debug

Example output:

$ west -v debug
[...]
-- west debug: using runner pyocd
-- runners.pyocd: pyOCD GDB server running on port 3333
runners.pyocd: pyocd gdbserver -p 3333 -T 4444 -t nrf52840 -f 4000000
runners.pyocd: /home/mbolivar/bin/zephyr-sdk/arm-zephyr-eabi/bin/arm-
zephyr-eabi-gdb /home/mbolivar/zp/zephyr/build/zephyr/zephyr.elf -ex
'target remote :3333' -ex 'monitor halt' -ex 'monitor reset' -ex load

Thanks,
Martí


Thanks for your help!

Best Regards,
Dominik