labgrid icon indicating copy to clipboard operation
labgrid copied to clipboard

Resource: add Segger J-Link support

Open PaulVittorino opened this issue 1 year ago • 4 comments

Description Add a resource for the Segger J-Link debug probe. Export the J-Link resource over IP using the J-Link Remote Server. Adding support for J-Link over IP combined with pylink provides a Python interface for the J-Link over IP.

Verified by acquiring a place via the Python API and using pylink to establish an IP connection.

resource = target.get_resource(labgrid.resource.remote.NetworkJLinkDevice)
host, port = labgrid.util.proxy.proxymanager.get_host_and_port(resource)
jlink = pylink.JLink()
jlink.open(ip_addr=f"{ip_addr}:{port}")

Supported hardware includes Segger J-Link JTAG probes. Tested with J-Link Ultra+ Version 5.0 hardware.

Checklist

  • [x] Documentation for the feature
  • [x] Tests for the feature
  • [X] The arguments and description in doc/configuration.rst have been updated
  • [ ] Add a section on how to use the feature to doc/usage.rst (N/A)
  • [ ] Add a section on how to use the feature to doc/development.rst (N/A)
  • [X] PR has been tested
  • [ ] Man pages have been regenerated (N/A)

PaulVittorino avatar May 08 '23 21:05 PaulVittorino

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (2906645) 63.0% compared to head (53cdba7) 63.4%. Report is 74 commits behind head on master.

Files Patch % Lines
labgrid/remote/exporter.py 95.5% 2 Missing :warning:
labgrid/resource/udev.py 80.0% 2 Missing :warning:
labgrid/resource/suggest.py 0.0% 1 Missing :warning:
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1175     +/-   ##
========================================
+ Coverage    63.0%   63.4%   +0.4%     
========================================
  Files         160     161      +1     
  Lines       11865   11959     +94     
========================================
+ Hits         7480    7588    +108     
+ Misses       4385    4371     -14     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 16 '23 05:05 codecov[bot]

I added testing of USBJLinkExport to try and meet the code coverage goal.

PaulVittorino avatar May 17 '23 02:05 PaulVittorino

For new resources, there should also be a corresponding driver. As there is already a Python module which provides access, only a very simple driver is needed to load it and wrap the open method. Take a look at these:

* https://github.com/labgrid-project/labgrid/blob/master/labgrid/driver/modbusdriver.py

* https://github.com/labgrid-project/labgrid/blob/master/labgrid/driver/modbusrtudriver.py

@jluebbe driver added with 100% code coverage.

PaulVittorino avatar May 25 '23 13:05 PaulVittorino

@jluebbe does my driver meet your expectations?

PaulVittorino avatar Jun 07 '23 18:06 PaulVittorino