Troubleshooting PyOCD Issues - KBA228421

Author: DheerajK_81           Version: **

 

This article addresses issues related to PyOCD encountered when debugging Mbed™ OS applications.

 

PyOCD is an open-source Python library used for programming and debugging microcontrollers using CMSIS-DAP.

 

Support for Cypress targets was added in PyOCD release 0.16.1. Therefore, you must have PyOCD version 0.16.1 or later to debug targets manufactured by Cypress. The list of supported platforms can be found on Mbed OS Cypress Partner page.

 

Run the following command from a terminal window to determine the version of PyOCD installed:

  • pyocd –-version

 

You may note the following errors in the command output:

 

(1) Error: Unsupported board found 1901

Capture.JPG

Reason: Using versions older than 0.16.1 will result in the following error; any connection to the target using gdb will fail.

Solution: Upgrade to the latest stable version of PyOCD using the command:

    • pip install -U pyocd

           

(2) Error: Operation not supported or unimplemented on this platform

Capture.JPG

Reason: You may be using PyOCD version 0.17.0. This bug was fixed in the newer versions.

Solution: Upgrade to latest stable version of PyOCD.

 

(3) Error: AttributeError: 'CY8C6xxA' object has no attribute 'options'

Reason: PyOCD version 0.21.0 reportedly has a bug in the Cypress target scripts.

Workaround: Update the files target_CY8C6xx7.py and target_CY8C6xxA.py located in the Python installation directory at the path: C:\Python\Lib\site-packages\pyocd\target\builtin\

 

Make the following changes in line 221 and 223 in target_CY8C6xx7.py:

Make the following changes in line 412 and 414 in target_CY8C6xxA.py:

Solution: This issue is fixed in PyOCD version 0.22.0. Upgrade to this version or later. To upgrade to specific versions, use the following command

    • pip install pyocd==0.22.0

 

(4) Error: Error in services launch sequenceStarting pyOCD GDB Server timed out.

Reason: The kit is not in DAPLink mode. PyOCD requires CMSIS-DAP support on the target, which is available on Cypress kits through DAPLink mode.

Solution: Use the firmware loader to upgrade KitProg3 to the latest version which supports DAPLink, and then switch the kit into DAPLink mode using the mode switch button.