pyocd / pyocd/pyOCD

Can't start debug sesions anymore with Mbed Studio 1.1.0 on Windows 10

Open
#932 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

target
Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

Hi, I’m using Mbed Studio 1.1.0 for Windows (10) with the CY8CPROTO-062-434W development board and Mbed OS 6.2. Over the last two weeks I successfully loaded, modified and programmed several examples that worked fine. But, after a couple of short debug sessions, the debugger stop working. First it didn't start and I got a message saying that it was a timeout waiting for the debug server to start. After restarting the computer the debug session crashes more catastrophically. I uninstalled and then reinstalled Mbed Studio 1.1.0, but the problem persists. here is the long trace output printed on the debug console:


Selected port 50000 for debugging
Exception ignored in: 
Traceback (most recent call last):
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\_objfinalizer.py", line 84, in __del__
    self.finalize()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\_objfinalizer.py", line 144, in finalize
    self._finalizer()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\weakref.py", line 548, in __call__
    return info.func(*info.args, **(info.kwargs or {}))
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\_objfinalizer.py", line 104, in _do_finalize_object_ref
    obj._do_finalize_object()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\_objfinalizer.py", line 71, in _do_finalize_object
    self._finalize_object()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\backend\libusb1.py", line 604, in _finalize_object
    _lib.libusb_unref_device(self.devid)
OSError: exception: access violation writing 0x0000000000000024
0000679:INFO:board:Target type is cy8c6xxa
0000755:INFO:dap:DP IDR = 0x6ba02477 (v2 rev6)
0000762:INFO:ap:AHB-AP#0 IDR = 0x84770001 (AHB-AP var0 rev8)
0000767:INFO:ap:AHB-AP#1 IDR = 0x84770001 (AHB-AP var0 rev8)
0000779:INFO:ap:AHB-AP#2 IDR = 0x24770011 (AHB-AP var1 rev2)
Exception ignored in: 
Traceback (most recent call last):
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\_objfinalizer.py", line 84, in __del__
    self.finalize()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\_objfinalizer.py", line 144, in finalize
    self._finalizer()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\weakref.py", line 548, in __call__
    return info.func(*info.args, **(info.kwargs or {}))
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\_objfinalizer.py", line 104, in _do_finalize_object_ref
    obj._do_finalize_object()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\_objfinalizer.py", line 71, in _do_finalize_object
    self._finalize_object()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\usb\backend\libusb1.py", line 604, in _finalize_object
    _lib.libusb_unref_device(self.devid)
OSError: exception: access violation writing 0x0000000000000024
0000803:CRITICAL:__main__:uncaught exception: 
Traceback (most recent call last):
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 362, in run
    self._COMMANDS[self._args.cmd](self)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 680, in do_gdbserver
    with session:
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\session.py", line 302, in __enter__
    self.open()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\session.py", line 420, in open
    self._board.init()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\board\board.py", line 85, in init
    self.target.init()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\coresight_target.py", line 160, in init
    seq.invoke()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\utility\sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\utility\sequencer.py", line 213, in invoke
    resultSequence.invoke()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\utility\sequencer.py", line 208, in invoke
    resultSequence = call()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\ap.py", line 1021, in find_components
    super(AHB_AP, self).find_components()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\utility\concurrency.py", line 28, in _locking
    return func(self, *args, **kwargs)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\ap.py", line 649, in find_components
    cmpid.read_id_registers()
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\rom_table.py", line 111, in read_id_registers
    regs = self.ap.read_memory_block32(self.top_address + self.IDR_READ_START, self.IDR_READ_COUNT)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\utility\concurrency.py", line 28, in _locking
    return func(self, *args, **kwargs)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\ap.py", line 972, in _read_memory_block32
    resp += self._read_block32_page(addr, n//4)
  File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\ap.py", line 930, in _read_block32_page
    resp = self.dp.read_ap_multiple(self.address.address + self._reg_offset + MEM_AP_DRW, size)
      File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\dap.py", line 664, in read_ap_multiple
        return read_ap_multiple_cb()
      File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\dap.py", line 654, in read_ap_multiple_cb
        return result_cb()
      File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\cmsis_dap_probe.py", line 315, in read_ap_repeat_callback
        return result()
      File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 871, in reg_read_repeat_cb
        res = transfer.get_result()
      File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\pydapaccess\dap_access_cmsis_dap.py", line 142, in get_result
        assert not self.daplink._crnt_cmd.get_empty()
    AssertionError
"GDB server stopped unexpectedly with exit code 1"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported pyocd entry point in pyocd/main.py, then trace session initialization through core/session.py and the CMSIS-DAP access path shown in the traceback. Reproduce the CY8CPROTO-062-434W debug failure on Windows 10 and determine why the USB finalizer and dap_access assertion occur; done means the debug server starts successfully without exit code 1.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.