-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathPKG-INFO
More file actions
162 lines (138 loc) · 7.39 KB
/
Copy pathPKG-INFO
File metadata and controls
162 lines (138 loc) · 7.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
Metadata-Version: 2.1
Name: pynrfjprog
Version: 10.24.2
Summary: A simple Python interface for the nrfjprog functionality
Author-email: Nordic Semiconductor ASA <sagtools@nordicsemi.no>
License: Copyright (c) 2010 - 2024, Nordic Semiconductor ASA
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form, except as embedded into a Nordic
Semiconductor ASA integrated circuit in a product or a software update for
such product, must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
3. Neither the name of Nordic Semiconductor ASA nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
4. This software, with or without modification, must only be used with a
Nordic Semiconductor ASA integrated circuit.
5. Any software provided in binary form under this license must not be reverse
engineered, decompiled, modified and/or disassembled.
THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Project-URL: Homepage, https://www.nordicsemi.com/Products/Development-tools/nrf-pynrfjprog/
Project-URL: Bug Tracker, https://github.com/NordicSemiconductor/pynrfjprog/issues
Keywords: nrfjprog,pynrfjprog
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Software Development :: Embedded Systems
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: Other/Proprietary License
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: future
Requires-Dist: tomli-w
[](https://github.com/NordicSemiconductor/pynrfjprog/blob/master/LICENSE)

 [](https://pypi.org/project/pynrfjprog/)
# pynrfjprog
Python wrapper around the nrfjprog dynamic link libraries (DLL). Use of this API allows developers to program/debug nRF SOC and SIP devices from the interpreter, write simple scripts for a more efficient development work flow, or write automated test frameworks. It can also be used to create applications in Python (i.e. command-line tools).
## Use-cases
* Maximizing development efficiency: i.e. a script to perform various operations every time an application is built and run (could be hooked into a Makefile or automated build system etc...).
* Automated testing: [Testing Production Programming tools on nRF5 using pynrfjprog](https://github.com/NordicSemiconductor/nrf52-production-programming/blob/master/tests/example_test_script.py).
## Dependencies
* [SEGGER JLink DLL] (https://www.segger.com/jlink-software.html)
* (Windows-only) [Microsoft Visual C++ Redistributable] (https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist)
## Structure
```pynrfjprog
pynrfjprog
├── pynrfjprog
│ ├──__init__.py # Package marker to make pynrfjprog a module. Also defines the version number
│ ├── API.py # (Deprecated; included only for backwards compatibility) Alias for LowLevel.py
│ ├── APIError.py # Wrapper for the error return codes of the DLL
│ ├── Hex.py # (Deprecated; included only for backwards compatibility) Hex parsing library
│ ├── HighLevel.py # (Deprecated; included only for backwards compatibility) Wrapper for the nrfjprog highlevel DLL
│ ├── JLink.py # (Deprecated; included only for backwards compatibility) Finds the JLinkARM DLL
│ ├── LowLevel.py # Wrapper for the nrfjprog DLL, previously API.py
│ ├── MultiAPI.py # Allow multiple devices (up to 128) to be programmed simultaneously with a LowLevel API
│ ├── lib_armhf
│ │ └── # armhf nrfjprog libraries
│ ├── lib_x64
│ │ └── # 64-bit nrfjprog libraries
│ ├── lib_x86
│ │ └── # 32-bit nrfjprog libraries
│ ├── docs
│ │ └── # Header files of the nrfjprog DLL to provide in-depth documentation of the functions that are wrapped
│ └── examples
│ └── # Example scripts to show off the different APIs
├── LICENSE
├── README.md
├── requirements.txt
└── pyproject.toml
```
## Getting started
To install the latest release from PyPI:
```
python -m pip install pynrfjprog
```
To install from source:
```
python -m pip install path_to_unzipped_pynrfjprog
```
Open the Python interpreter and connect nRF device to PC:
```
from pynrfjprog import LowLevel
with LowLevel.API('NRF52') as api:
api.enum_emu_snr()
api.connect_to_emu_without_snr()
api.erase_all()
api.write_u32(ADDRESS, DATA, IS_FLASH)
api.disconnect_from_emu()
```
To work with multiple nRF devices at once:
```
import LowLevel
api = LowLevel.API('NRF52')
api.open()
api2 = LowLevel.API('NRF52')
api2.open()
api3 = LowLevel.API('NRF52')
api3.open()
api.close()
api2.close()
api3.close()
```
To program firmware into the devices:
```
from pynrfjprog import LowLevel
with LowLevel.API() as api:
api.program_file(<hex_file>)
# Optional
api.verify_file(<hex_file>)
```
## Contributing
Contributing is encouraged along with the following coding standards.
* [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html)
* http://www.clifford.at/style.html
* [Semantic versioning](http://semver.org/)