PyLink is a Python package that provides an interface to SEGGER J-Link debug probes, allowing control and interaction with embedded targets from Python. It was developed by Square to integrate J-Link functionality into Python-based test infrastructure. The library is actively maintained, with the current version being 2.0.1, and typically sees updates for new features and bug fixes.
pip install pylink-squareVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to establish a connection to a SEGGER J-Link debug probe and then connect to a target device. It then performs a basic operation, such as reading the target's IDCODE. Ensure `JLINK_SERIAL_NO` and `JLINK_TARGET_DEVICE` environment variables are set with your specific J-Link serial number and target CPU name, or replace the placeholder values. The SEGGER J-Link Software and Development Pack must be installed on your system.
Migrate your project to Python 3.x. If unable, pin `pylink-square<2.0.0`.
Download and install the appropriate J-Link Software and Development Pack from SEGGER's website for your operating system. Ensure the J-Link library path is correctly configured (e.g., via `PATH`, `LD_LIBRARY_PATH`, `DYLD_LIBRARY_PATH` environment variables, or by copying to a system library directory).
Refer to the `pylink` troubleshooting guide. Verify physical connections, ensure J-Link is not in use elsewhere, confirm target device name, interface, and power. For flash/erase, ensure the CPU is halted; sometimes a specific `set_reset_strategy` is needed for Cortex-M devices.
Ensure that file paths are handled as expected by `os.fsencode()`. In most standard Python 3 applications, this change should be transparent or beneficial for UTF-8 paths.
Install the module using pip: 'pip install pylink-square'.
Ensure the J-Link device is properly connected and not in use by other applications. Refer to the troubleshooting guide for more details.
Verify that the correct target device is specified and that it is supported by the J-Link. Consult the device's documentation for compatibility information.
Install the module using pip: 'pip install pylink-square'. Ensure the import statement is correct: 'import pylink'.
Reinstall the module using pip: 'pip install --force-reinstall pylink-square'. Ensure the import statement is correct: 'from pylink import JLink'.