Segger J-Link的Python接口。
pylink-square的Python项目详细描述
Segger J-Link的Python接口。
安装
将项目克隆到本地存储库中,然后导航到 目录并运行:
$ python setup.py install
外部依赖性
为了使用这个库,您需要安装segger 工具。这些工具可以从Segger网站安装 here。这个包裹是 与segger工具的版本>= 6.0b兼容。下载 在J-Link Software and Documentation Pack下为您的 特定硬件。PyLink将自动找到库 以这种方式安装,但为了获得最佳效果,您应该使用 下面列出的两种方法取决于您的操作系统:
在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.
$ exportDYLD_LIBRARY_PATH=/Applications/SEGGER/JLink:$DYLD_LIBRARY_PATH
在Windows上
Windows按以下顺序搜索DLL:
- 当前执行目录。
- Windows系统目录。
- Windows目录。
您可以将JLinkARM.dll复制到列出的任何目录 上面。或者,将segger j-link目录添加到 %PATH%。
在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.
$ exportLD_LIBRARY_PATH=/path/to/SEGGER/JLink:$LD_LIBRARY_PATH
用法
importpylinkif__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()
故障排除
如果遇到任何问题,请参阅文档,以及 查看我们的troubleshooting文档。
文档
文档遵循Google Python Style Guide,并使用 `Sphinx<;http://www.sphinx-doc.org/en/stable/>;``文档 发电机 `Napoleon<;http://www.sphinx-doc.org/en/stable/ext/napoleon.html>;。`_ 扩展以提供google风格的python支持。生成 文档中,需要安装这些包(它们是 包含在提供的requirements.txt文件中)。带着这些包裹 安装后,您可以按如下方式生成文档:
$ cd docs $ make html
为Pylink开发
首先运行以下命令安装开发需求:
$ pip install -r requirements.txt
安装完需求后,决定开发工作 你想这么做。请参阅有关的文档 contributing开始开发之前 工作。
测试
要运行测试,请执行以下操作:
# Unit tests $ python setup.py test # Functional tests $ python setup.py bddtest
有两种类型的测试:functional和unit。信息 在`tests/README.md<;tests/readme.md>;`\
覆盖范围
代码覆盖率可以如下生成:
$ python setup.py coverage $ open htmlcov/index.html
贡献
请参阅contributing上的文档。
许可证
Copyright 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.
见条款和条件here。