Python interface for the SEGGER J-Link.
- Python >= 3.8
- GNU ARM Embedded Toolchain (for functional tests)
- SEGGER J-Link Tools >= 6.0b
$ pip install ragnarok-pyjlink
To install the latest development version
$ pip install git+https://github/durufle/pyjlink
In order to use this library, you will need to have installed the SEGGER tools. The tools can be installed from
the SEGGER website here. This package is compatible
with versions of the SEGGER tool >= 6.0b
. Download the software under J-Link Software and Documentation Pack
for your specific hardware. PyJLink
will automatically find the library if you have installed it this way, but for
best results, you should use one of the two methods listed below depending on your operating system:
# Option A: Copy the library to your libraries directory.
$ cp libjlinkarm.dylib /usr/local/lib/
# Option B: Add SEGGER's J-Link directory to your dynamic libraries path.
$ export DYLD_LIBRARY_PATH=/Applications/SEGGER/JLink:$DYLD_LIBRARY_PATH
Windows searches for DLLs in the following order:
- The current directory of execution.
- The Windows system directory.
- The Windows directory.
You can copy the JLinkARM.dll
to any of the directories listed above.
Alternatively, add the SEGGER J-Link directory to your %PATH%
.
# Option A: Copy the library to your libraries directory.
$ cp libjlinkarm.so /usr/local/lib/
# Option B: Add SEGGER's J-Link library path to your libraries path.
$ export LD_LIBRARY_PATH=/path/to/SEGGER/JLink:$LD_LIBRARY_PATH
import pyjlink
if __name__ == '__main__':
serial_no = '123456789'
jlink = pyjlink.JLink()
# Open a connection to your J-Link.
jlink.open(serial_no)
# Connect to the target device.
jlink.connect('device', verbose=True)
# Do whatever you want from here on in.
jlink.flash(firmware, 0x0)
jlink.reset()
Should you run into any issues, refer to the documentation, as well as check out our troubleshooting document.
Documentation follows the
Google Python Style Guide,
and uses Sphinx documentation generator with the
Napoleon extension
to provide Google style Python support. To generate the documentation, these
packages will need to be installed (they are included in the provided
requirements.txt
file). With these packages installed, you can generate the
documentation as follows:
$ cd docs
$ make html
First install the development requirements by running:
$ pip install -r requirements.txt
After you've installed the requirements, decide on the development work you want to do. See the documentation about contributing before you begin your development work.
To run tests, execute the following:
# Unit tests
$ python setup.py test
# Functional tests
$ python setup.py bddtest
There are two types of tests: functional
and unit
. Information about both
can be found under tests/README.md.
Code coverage can be generated as follows:
$ python setup.py coverage
$ open htmlcov/index.html
See terms and conditions here.