Package: pylink-square
Python interface for the SEGGER J-Link.RequirementsPython >= 2.7GNU ARM Embedded
Toolchain(for functional
tests)SEGGER J-Link Tools >=
6.0bInstallationClone the project into a local repository, then navigate to the
directory and run:$ python setup.py installExternal DependenciesIn order to use this library, you will need to have installed the SEGGER
tools. The tools can be installed from the SEGGER websitehere. This package is
compatible with versions of the SEGGER tool>= 6.0b. Download the
software underJ-LinkSoftware and Documentation Packfor your
specific hardware.PyLinkwill 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:On Mac# 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_PATHOn WindowsWindows searches for DLLs in the following order:The current directory of execution.The Windows system directory.The Windows directory.You can copy theJLinkARM.dllto any of the directories listed
above. Alternatively, add the SEGGER J-Link directory to your%PATH%.On Linux# 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_PATHUsageimport pylink

if __name__ == '__main__':
   serial_no = '123456789'
   jlink = pylink.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()TroubleshootingShould you run into any issues, refer to the documentation, as well as
check out ourtroubleshootingdocument.DocumentationDocumentation follows theGoogle Python Style
Guide, and usesSphinxdocumentation
generator with theNapoleonextension to provide Google style Python support. To generate the
documentation, these packages will need to be installed (they are
included in the providedrequirements.txtfile). With these packages
installed, you can generate the documentation as follows:$ cd docs
$ make htmlDeveloping for PyLinkFirst install the development requirements by running:$ pip install -r requirements.txtAfter you’ve installed the requirements, decide on the development work
you want to do. See the documentation aboutcontributingbefore you begin your development
work.TestingTo run tests, execute the following:# Unit tests
$ python setup.py test

# Functional tests
$ python setup.py bddtestThere are two types of tests:functionalandunit. Information
about both can be found undertests/README.md.CoverageCode coverage can be generated as follows:$ python setup.py coverage
$ open htmlcov/index.htmlContributingPlease see the documentation oncontributing.LicenseCopyright 2017 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.See terms and conditionshere.