pyocd
Cortex-M debugger for Python
What it is and what it does
pyOCD is a cross-platform Python tool and library for programming and debugging Arm Cortex-M microcontrollers using a wide range of debug probes. It provides both a command-line interface with subcommands for common tasks (gdbserver, load, erase, reset, rtt, etc.) and a Python API for custom control and automation. The tool supports more than 70 popular MCUs natively and can extend support through CMSIS Device Family Packs to cover nearly every Cortex-M device on the market.
The package is built on 17 runtime dependencies including capstone for disassembly, hidapi and pyusb for USB communication, pyelftools for ELF parsing, and cmsis-pack-manager for device pack handling. It offers memory read/write, register access, breakpoint and watchpoint management, flash programming, binary/hex/ELF file loading, SWO/SWV support, and CoreSight DP/AP access. Configuration is supported through config files, user scripts, and direct API use, making it suitable for both interactive debugging and CI/CD test automation.
Use it for:
- Debug Arm Cortex-M firmware interactively using gdb via the gdbserver subcommand with GUI debugger support.
- Automate flash programming and testing in CI pipelines by loading binaries and controlling device execution via the Python API.
- Stream Segger RTT I/O from any supported debug probe without needing vendor-specific tools.
- Inspect and modify MCU memory and registers in real time using the commander interactive REPL.
- Program multiple MCU variants by managing CMSIS Device Family Packs for devices without built-in support.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pyOCD is a Python-based debugger and programmer for Arm Cortex-M microcontrollers that works with many debug probes across Linux, macOS, Windows, and FreeBSD.
Yes. pyOCD is actively maintained, has low install friction, carries no security vulnerabilities, and is licensed permissively. It is the right choice if you need a Python-native, cross-platform debugger for Cortex-M development or CI automation. The only prerequisite is a supported debug probe and libusb; if you have those, installation and basic use are straightforward.
Install
pyocd on PyPI
pip
pip install pyocduv
uv add pyocdpoetry
poetry add pyocdInstalling pyocd
Before you install
Low install friction with a pure-Python wheel and 17 runtime dependencies that are widely available. Active maintenance with a release 24 days ago and ongoing repository activity.
License in practice
Apache 2.0 is permissive, allowing commercial and private use without restriction or copyleft obligation.
Quickstart
pip install pyocd
from pyocd.core.target import Target
from pyocd.probe.pydaplink import DAPLink
probe = DAPLink.get_connected_probes()[0]
target = Target(probe.create_target())
target.halt()
memory = target.read_memory(0x0, 4)
target.resume()
Requires libusb and a supported debug probe (CMSIS-DAP, J-Link, STLink, etc.) connected via USB. Python 3.9.0 or later required.
Verify before relying
- Whether the 70+ built-in MCU support claim is current or if that list has grown since v0.45.1.
- Specific performance characteristics when handling large binary or ELF files during flash programming.
- Compatibility matrix detail for all listed debug probes across different OS versions.
Package facts
| License | Apache 2.0 (permissive) |
| Python support | supports the current Python release (>=3.9.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 17 — capstone, cmsis-pack-manager, colorama, hidapi, importlib_metadata, importlib_resources, intelhex, intervaltree, lark, libusb-package, natsort, prettytable, pyelftools, pylink-square, pyusb, pyyaml, typing-extensions |
| Maintenance | actively maintained — 24 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,372,352/month — #3,991 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyocd-0.45.1-py3-none-any.whl
Keywords: embedded, debug, debugger, arm, gdb, gdbserver, flash, test
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pyocd-pemicroA PyOCD plugin that adds support for PEMicro…
permissive · top 15,000 on PyPI
spsdk-pyocdIntegrates PyOCD as a debugger probe interface…
permissive · top 15,000 on PyPI
pyudevpyudev is a pure Python binding for libudev…
copyleft · top 5,000 on PyPI
pypemicroProvides a Python interface to PEMicro debug…
permissive · top 15,000 on PyPI
pylink-squareProvides a Python interface to control SEGGER…
permissive · top 5,000 on PyPI
freertos-gdbA GDB Python plugin that adds commands to…
permissive · top 5,000 on PyPI
pygdbmiParses GDB machine interface output into…
permissive · top 5,000 on PyPI
Adafruit-BlinkaAdafruit-Blinka emulates CircuitPython APIs on…
permissive · top 15,000 on PyPI
libusbsioProvides a Python wrapper around NXP's…
permissive · top 15,000 on PyPI
spsdk-mcu-linkA plugin for SPSDK that adds support for NXP…
permissive · top 15,000 on PyPI