spsdk-pemicro 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+
2
+
3
+ BSD 3-Clause "New" or "Revised" License
4
+
5
+ Copyright 2024 NXP
6
+
7
+ Redistribution and use in source and binary forms, with or without modification,
8
+ are permitted provided that the following conditions are met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice, this
11
+ list of conditions and the following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above copyright notice, this
14
+ list of conditions and the following disclaimer in the documentation and/or
15
+ other materials provided with the distribution.
16
+
17
+ * Neither the name of the copyright holder nor the names of its
18
+ contributors may be used to endorse or promote products derived from this
19
+ software without specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
28
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30
+ OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
@@ -0,0 +1,13 @@
1
+ include CONTRIBUTING.rst
2
+ include HISTORY.rst
3
+ include LICENSE
4
+ include README.rst
5
+ include SW_Content_Register_spsdk_pemicro.txt
6
+ include requirements*
7
+
8
+ recursive-include tests *
9
+ recursive-exclude * __pycache__
10
+ recursive-exclude * *.py[co]
11
+ recursive-exclude .github *
12
+
13
+ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
@@ -0,0 +1,53 @@
1
+ Metadata-Version: 2.1
2
+ Name: spsdk-pemicro
3
+ Version: 0.1.0
4
+ Summary: P&E Micro debugger probe plugin. A debugger probe plugin for SPSDK.
5
+ Author: NXP
6
+ Maintainer-email: NXP <michal.starecek@nxp.com>
7
+ License: BSD-3-Clause
8
+ Project-URL: Homepage, https://github.com/nxp-mcuxpresso/spsdk_plugins/tree/master/pemicro
9
+ Project-URL: Issues, https://github.com/nxp-mcuxpresso/spsdk_plugins/issues
10
+ Keywords: NXP,SPSDK,pemicro
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: spsdk>=2.2.0
24
+ Requires-Dist: pypemicro>=0.1.11
25
+
26
+
27
+ P&E Micro debugger probe plugin
28
+ ===============================
29
+
30
+
31
+ * Free software: BSD-3-Clause
32
+
33
+
34
+ Features
35
+ --------
36
+
37
+ * Allow SPSDK to use P&E Micro as an interface for debugger probes.
38
+
39
+
40
+ Installation
41
+ ------------
42
+
43
+ * Activate virtual env, where you have SPSDK
44
+ - if SPSDK is not installed, the latest one will be installed automatically from [PyPI](https://pypi.org/project/spsdk/)
45
+ * `pip install spsdk-pemicro`
46
+ * Verify installation by running `nxpdebugmbox --help`
47
+ - you should see `pemicro` amongst available interfaces (--interface)
48
+
49
+
50
+ Credits
51
+ -------
52
+
53
+ This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [SPSDK Debug Probe project template](https://github.com/nxp-mcuxpresso/spsdk/blob/master/examples/plugins/templates/cookiecutter-spsdk-debug-probe-plugin.zip).
@@ -0,0 +1,28 @@
1
+
2
+ P&E Micro debugger probe plugin
3
+ ===============================
4
+
5
+
6
+ * Free software: BSD-3-Clause
7
+
8
+
9
+ Features
10
+ --------
11
+
12
+ * Allow SPSDK to use P&E Micro as an interface for debugger probes.
13
+
14
+
15
+ Installation
16
+ ------------
17
+
18
+ * Activate virtual env, where you have SPSDK
19
+ - if SPSDK is not installed, the latest one will be installed automatically from [PyPI](https://pypi.org/project/spsdk/)
20
+ * `pip install spsdk-pemicro`
21
+ * Verify installation by running `nxpdebugmbox --help`
22
+ - you should see `pemicro` amongst available interfaces (--interface)
23
+
24
+
25
+ Credits
26
+ -------
27
+
28
+ This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [SPSDK Debug Probe project template](https://github.com/nxp-mcuxpresso/spsdk/blob/master/examples/plugins/templates/cookiecutter-spsdk-debug-probe-plugin.zip).
@@ -0,0 +1,10 @@
1
+ NXP Software Content Register
2
+
3
+ Package: spsdk-pemicro
4
+ Version: 0.1.0
5
+ Outgoing License: BSD-3-Clause
6
+ License Files: LICENSE
7
+ Type of content: Source code
8
+ Description and comments: NXP Secure Provisioning SDK Team - Debug Probe plugin for PEmicro probes
9
+ Origin: NXP (BSD-3-Clause)
10
+ URL: https://github.com/nxp-mcuxpresso/spsdk_plugins/tree/master/pemicro
@@ -0,0 +1,209 @@
1
+ [project]
2
+ name = "spsdk-pemicro"
3
+ description = "P&E Micro debugger probe plugin. A debugger probe plugin for SPSDK."
4
+ dynamic = ["version"]
5
+
6
+ entry-points = { "spsdk.debug_probe" = { pemicro = "spsdk_pemicro.probe" } }
7
+
8
+ requires-python = ">= 3.9"
9
+ dependencies = ["spsdk>=2.2.0", "pypemicro>=0.1.11"]
10
+
11
+ authors = [{ name = "NXP" }]
12
+ maintainers = [{ name = "NXP", email = "michal.starecek@nxp.com" }]
13
+ readme = { file = "README.md", content-type = "text/markdown" }
14
+ license = { text = "BSD-3-Clause" }
15
+
16
+ keywords = ["NXP", "SPSDK", "pemicro"]
17
+ classifiers = [
18
+ "Development Status :: 2 - Pre-Alpha",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: BSD License",
21
+ "Natural Language :: English",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ ]
28
+
29
+ [project.urls]
30
+ Homepage = "https://github.com/nxp-mcuxpresso/spsdk_plugins/tree/master/pemicro"
31
+ Issues = "https://github.com/nxp-mcuxpresso/spsdk_plugins/issues"
32
+
33
+
34
+ [build-system]
35
+ requires = ["setuptools >= 61.0", "wheel"]
36
+ build-backend = "setuptools.build_meta"
37
+
38
+ [tool.setuptools]
39
+ packages = ["spsdk_pemicro"]
40
+
41
+ [tool.setuptools.dynamic]
42
+ version = { attr = "spsdk_pemicro.__version__" }
43
+
44
+ [tool.bumpversion]
45
+ current_version = "0.1.0"
46
+
47
+ [[tool.bumpversion.files]]
48
+ filename = "spsdk_pemicro/__init__.py"
49
+ search = '__version__ = "{current_version}"'
50
+ replace = '__version__ = "{new_version}"'
51
+
52
+ [[tool.bumpversion.files]]
53
+ filename = "SW_Content_Register_spsdk_peicro.txt"
54
+ search = "{current_version}"
55
+ replace = "{new_version}"
56
+
57
+
58
+ [tool.pytest.ini_options]
59
+ testpaths = ["tests"]
60
+ junit_family = "xunit1"
61
+
62
+ [tool.coverage.report]
63
+ exclude_lines = ["pragma: no cover", "safe_main()", "sys.exit(main())"]
64
+
65
+ [tool.coverage.run]
66
+ relative_files = true
67
+
68
+ [tool.black]
69
+ line-length = 100
70
+ target-version = ["py39", "py310", "py311", "py312"]
71
+ include = '\.pyi?$'
72
+
73
+ [tool.isort]
74
+ multi_line_output = 3
75
+ include_trailing_comma = true
76
+ force_grid_wrap = 0
77
+ use_parentheses = true
78
+ ensure_newline_before_comments = true
79
+ line_length = 100
80
+
81
+ [tool.mypy]
82
+ disallow_untyped_defs = true
83
+ ignore_missing_imports = true
84
+ warn_unused_ignores = true
85
+
86
+ [tool.pydocstyle]
87
+ convention = "google"
88
+ add_ignore = "D105,D301"
89
+ match = '(?!test_|__version__).*\.py'
90
+
91
+ [tool.pylint]
92
+ format = { max-line-length = 120 }
93
+ "messages control" = { disable = ["logging-fstring-interpolation"] }
94
+
95
+
96
+ [tool.checker_depencecies.spdx]
97
+ "Apache-2.0" = [
98
+ "Apache 2.0",
99
+ "Apache-2.0 License",
100
+ "Apache Software License 2.0",
101
+ "Apache License, Version 2.0",
102
+ "Apache License 2.0",
103
+ "Apache Software License",
104
+ ]
105
+ "BSD-2-Clause" = ["BSD", "BSD 2-Clause License"]
106
+ "BSD-3-Clause" = [
107
+ "BSD",
108
+ "BSD License",
109
+ "BSD 3-Clause",
110
+ "BSD (3 clause)",
111
+ "BSD 3-Clause License",
112
+ "Modified BSD License",
113
+ ]
114
+ "MIT" = ["MIT License", "MIT license"]
115
+ "MPL-2.0" = ["MPL 2.0", "Mozilla Public License 2.0 (MPL 2.0)"]
116
+ "NLPL" = ["Public domain", "Public Domain"]
117
+ "PSF-2.0" = ["PSF", "PSFL", "Python Software Foundation License"]
118
+ "GPL-2.0-or-later" = []
119
+ "LGPL-2.0-only" = ["LGPL-2.0"]
120
+ "LGPL-2.1-or-later" = []
121
+ "LGPL-3.0-only" = ["LGPL-3.0"]
122
+ "ISC" = ["ISC license"]
123
+
124
+ [tool.nxp_codecheck]
125
+ git_parent_branch = "origin/master"
126
+ output_directory = "reports"
127
+ default_check_paths = ["spsdk_pemicro"]
128
+
129
+ # *********************************** Checker list ***********************************
130
+ [[tool.nxp_codecheck.checkers]]
131
+ name = "PYTEST"
132
+ method = "check_pytest"
133
+ # check_paths = [] # The default check paths could be overrides by local settings
134
+ info_only = false
135
+ kwargs = { disable_xdist = false }
136
+
137
+ # [[tool.nxp_codecheck.checkers]]
138
+ # name = "GITCOV"
139
+ # method = "check_gitcov"
140
+ # # check_paths = [] # The default check paths could be overrides by local settings
141
+ # info_only = true
142
+ # dependencies = ["PYTEST"]
143
+ [[tool.nxp_codecheck.checkers]]
144
+ name = "PYLINT"
145
+ method = "check_pylint"
146
+ # check_paths = [] # The default check paths could be overrides by local settings
147
+ info_only = false
148
+ [[tool.nxp_codecheck.checkers]]
149
+ name = "MYPY"
150
+ method = "check_mypy"
151
+ # check_paths = [] # The default check paths could be overrides by local settings
152
+ info_only = false
153
+ [[tool.nxp_codecheck.checkers]]
154
+ name = "DEPENDENCIES"
155
+ method = "check_dependencies"
156
+ # check_paths = [] # The default check paths could be overrides by local settings
157
+ info_only = false
158
+ fixer = "fix_dependencies"
159
+ [[tool.nxp_codecheck.checkers]]
160
+ name = "PYDOCSTYLE"
161
+ method = "check_pydocstyle"
162
+ # check_paths = [] # The default check paths could be overrides by local settings
163
+ info_only = false
164
+ [[tool.nxp_codecheck.checkers]]
165
+ name = "RADON_C"
166
+ method = "check_radon"
167
+ # check_paths = [] # The default check paths could be overrides by local settings
168
+ info_only = true
169
+ kwargs = { min_rank = "C" }
170
+ [[tool.nxp_codecheck.checkers]]
171
+ name = "RADON_D"
172
+ method = "check_radon"
173
+ # check_paths = [] # The default check paths could be overrides by local settings
174
+ info_only = false
175
+ kwargs = { min_rank = "D" }
176
+ [[tool.nxp_codecheck.checkers]]
177
+ name = "BLACK"
178
+ method = "check_black"
179
+ # check_paths = [] # The default check paths could be overrides by local settings
180
+ info_only = false
181
+ dependencies = []
182
+ fixer = "fix_black"
183
+ [[tool.nxp_codecheck.checkers]]
184
+ name = "ISORT"
185
+ method = "check_isort"
186
+ # check_paths = [] # The default check paths could be overrides by local settings
187
+ info_only = false
188
+ dependencies = []
189
+ fixer = "fix_isort"
190
+ [[tool.nxp_codecheck.checkers]]
191
+ name = "COPYRIGHT"
192
+ method = "check_copyright_year"
193
+ # check_paths = [] # The default check paths could be overrides by local settings
194
+ info_only = false
195
+ dependencies = []
196
+ fixer = "fix_copyright_year"
197
+ [[tool.nxp_codecheck.checkers]]
198
+ name = "PY_HEADERS"
199
+ method = "check_py_file_headers"
200
+ # check_paths = [] # The default check paths could be overrides by local settings
201
+ info_only = false
202
+ dependencies = []
203
+ fixer = "fix_py_file_headers"
204
+ [[tool.nxp_codecheck.checkers]]
205
+ name = "CYCLIC"
206
+ method = "check_cyclic_imports"
207
+ # check_paths = [] # The default check paths could be overrides by local settings
208
+ info_only = false
209
+ dependencies = []
@@ -0,0 +1,10 @@
1
+ # package management
2
+ build
3
+ bump-my-version
4
+ twine
5
+
6
+ # testing
7
+ tox
8
+
9
+ # code quality
10
+ nxp-codecheck
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ # Copyright 2024 NXP
5
+ #
6
+ # SPDX-License-Identifier: BSD-3-Clause
7
+ """Top-level package for P&E Micro debugger probe plugin."""
8
+
9
+ __author__ = """NXP"""
10
+ __email__ = "starecek.michal@nxp.com"
11
+ __version__ = "0.1.0"
12
+
13
+ from .probe import DebugProbePemicro
14
+
15
+ __all__ = ["DebugProbePemicro"]
@@ -0,0 +1,223 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ # Copyright 2024 NXP
5
+ #
6
+ # SPDX-License-Identifier: BSD-3-Clause
7
+ """Main module for P&E Micro debugger probe plugin."""
8
+
9
+ import logging
10
+ from typing import Dict, Optional
11
+
12
+ from pypemicro import PEMicroException, PEMicroInterfaces, PyPemicro
13
+ from spsdk.debuggers.debug_probe import (
14
+ DebugProbeCoreSightOnly,
15
+ DebugProbes,
16
+ ProbeDescription,
17
+ SPSDKDebugProbeError,
18
+ SPSDKDebugProbeNotOpenError,
19
+ SPSDKDebugProbeTransferError,
20
+ )
21
+ from spsdk.utils.misc import value_to_int
22
+
23
+ logger = logging.getLogger(__name__)
24
+ logger_pypemicro = logger.getChild("PyPemicro")
25
+
26
+
27
+ class DebugProbePemicro(DebugProbeCoreSightOnly):
28
+ """Class to define Pemicro package interface for NXP SPSDK."""
29
+
30
+ NAME = "pemicro"
31
+
32
+ @staticmethod
33
+ def get_options_help() -> Dict[str, str]:
34
+ """Get full list of options of debug probe.
35
+
36
+ :return: Dictionary with individual options. Key is parameter name and value the help text.
37
+ """
38
+ options_help = {}
39
+ options_help.update(
40
+ {
41
+ "frequency": "Set the communication frequency in Hz, default is 100_000Hz",
42
+ }
43
+ )
44
+ options_help.update(DebugProbeCoreSightOnly.get_options_help())
45
+
46
+ return options_help
47
+
48
+ @classmethod
49
+ def get_pemicro_lib(cls) -> PyPemicro:
50
+ """Get Pemicro object.
51
+
52
+ :return: The Pemicro Object
53
+ :raises SPSDKDebugProbeError: The Pemicro object get function failed.
54
+ """
55
+ try:
56
+ return PyPemicro(
57
+ log_info=logger_pypemicro.info,
58
+ log_debug=logger_pypemicro.debug,
59
+ log_err=logger_pypemicro.error,
60
+ log_war=logger_pypemicro.warn,
61
+ )
62
+ except PEMicroException as exc:
63
+ raise SPSDKDebugProbeError(f"Cannot get Pemicro library: ({str(exc)})") from exc
64
+
65
+ def __init__(self, hardware_id: str, options: Optional[Dict] = None) -> None:
66
+ """The Pemicro class initialization.
67
+
68
+ The Pemicro initialization function for SPSDK library to support various DEBUG PROBES.
69
+ """
70
+ super().__init__(hardware_id, options)
71
+
72
+ self.pemicro: Optional[PyPemicro] = None
73
+
74
+ logger.debug("The SPSDK Pemicro Interface has been initialized")
75
+
76
+ # pylint: disable=unused-argument # we need to satisfy the method signature
77
+ @classmethod
78
+ def get_connected_probes(
79
+ cls, hardware_id: Optional[str] = None, options: Optional[Dict] = None
80
+ ) -> DebugProbes:
81
+ """Get all connected probes over Pemicro.
82
+
83
+ This functions returns the list of all connected probes in system by Pemicro package.
84
+
85
+ :param hardware_id: None to list all probes, otherwise the the only probe with matching
86
+ hardware id is listed.
87
+ :param options: The options dictionary
88
+ :return: probe_description
89
+ """
90
+ probes = DebugProbes()
91
+ try:
92
+ connected_probes = PyPemicro.list_ports()
93
+ for probe in connected_probes:
94
+ if not hardware_id or hardware_id == str(probe["id"]):
95
+ probes.append(
96
+ ProbeDescription(
97
+ "PEMicro", probe["id"], probe["description"], DebugProbePemicro
98
+ )
99
+ )
100
+ except PEMicroException as exc:
101
+ logger.warning(f"Cannot get list of PEMicro probes: {str(exc)}")
102
+ return probes
103
+
104
+ def open(self) -> None:
105
+ """Open Pemicro interface for NXP SPSDK.
106
+
107
+ The Pemicro opening function for SPSDK library to support various DEBUG PROBES.
108
+ The function is used to initialize the connection to target and enable using debug probe
109
+ for DAT purposes.
110
+
111
+ :raises SPSDKDebugProbeError: Opening of the debug probe failed
112
+ """
113
+ try:
114
+ self.pemicro = DebugProbePemicro.get_pemicro_lib()
115
+ if self.pemicro is None:
116
+ raise SPSDKDebugProbeError("Getting of Pemicro library failed.")
117
+ except SPSDKDebugProbeError as exc:
118
+ raise SPSDKDebugProbeError(f"Getting of Pemicro library failed({str(exc)}).") from exc
119
+ try:
120
+ self.pemicro.open(debug_hardware_name_ip_or_serialnum=self.hardware_id)
121
+ except PEMicroException as exc:
122
+ raise SPSDKDebugProbeError(f"Opening the debug probe failed ({str(exc)})") from exc
123
+
124
+ def connect(self) -> None:
125
+ """Connect to target.
126
+
127
+ The Pemicro connecting function for SPSDK library to support various DEBUG PROBES.
128
+ The function is used to initialize the connection to target
129
+
130
+ :raises SPSDKDebugProbeError: The Pemicro cannot establish communication with target
131
+ """
132
+ if self.pemicro is None:
133
+ raise SPSDKDebugProbeError("Debug probe must be opened first")
134
+ try:
135
+ self.pemicro.connect(PEMicroInterfaces.SWD)
136
+ self.pemicro.set_debug_frequency(value_to_int(self.options.get("frequency", 100000)))
137
+ self.clear_sticky_errors()
138
+ self.power_up_target()
139
+
140
+ except PEMicroException as exc:
141
+ raise SPSDKDebugProbeError(
142
+ f"Pemicro cannot establish communication with target({str(exc)})."
143
+ ) from exc
144
+
145
+ def close(self) -> None:
146
+ """Close Pemicro interface.
147
+
148
+ The Pemicro closing function for SPSDK library to support various DEBUG PROBES.
149
+ """
150
+ if self.pemicro:
151
+ self.pemicro.close()
152
+
153
+ def coresight_reg_read(self, access_port: bool = True, addr: int = 0) -> int:
154
+ """Read coresight register over Pemicro interface.
155
+
156
+ The Pemicro read coresight register function for SPSDK library to support various DEBUG PROBES.
157
+
158
+ :param access_port: if True, the Access Port (AP) register will be read(default), otherwise the Debug Port
159
+ :param addr: the register address
160
+ :return: The read value of addressed register (4 bytes)
161
+ :raises SPSDKDebugProbeTransferError: The IO operation failed
162
+ :raises SPSDKDebugProbeNotOpenError: The Pemicro probe is NOT opened
163
+ """
164
+ if self.pemicro is None:
165
+ raise SPSDKDebugProbeNotOpenError("The Pemicro debug probe is not opened yet")
166
+
167
+ try:
168
+ if access_port:
169
+ ap_ix = (addr & self.APSEL_APBANKSEL) >> self.APSEL_SHIFT
170
+ ret = self.pemicro.read_ap_register(apselect=ap_ix, addr=addr)
171
+ else:
172
+ ret = self.pemicro.read_dp_register(addr=addr)
173
+ return ret
174
+ except PEMicroException as exc:
175
+ self._reinit_target()
176
+ raise SPSDKDebugProbeTransferError(
177
+ f"The Coresight read operation failed({str(exc)})."
178
+ ) from exc
179
+
180
+ def coresight_reg_write(self, access_port: bool = True, addr: int = 0, data: int = 0) -> None:
181
+ """Write coresight register over Pemicro interface.
182
+
183
+ The Pemicro write coresight register function for SPSDK library to support various DEBUG PROBES.
184
+
185
+ :param access_port: if True, the Access Port (AP) register will be write(default), otherwise the Debug Port
186
+ :param addr: the register address
187
+ :param data: the data to be written into register
188
+ :raises SPSDKDebugProbeTransferError: The IO operation failed
189
+ :raises SPSDKDebugProbeNotOpenError: The Pemicro probe is NOT opened
190
+ """
191
+ if self.pemicro is None:
192
+ raise SPSDKDebugProbeNotOpenError("The Pemicro debug probe is not opened yet")
193
+
194
+ try:
195
+ if access_port:
196
+ ap_ix = (addr & self.APSEL_APBANKSEL) >> self.APSEL_SHIFT
197
+ self.pemicro.write_ap_register(apselect=ap_ix, addr=addr, value=data)
198
+ else:
199
+ self.pemicro.write_dp_register(addr=addr, value=data)
200
+
201
+ except PEMicroException as exc:
202
+ self._reinit_target()
203
+ raise SPSDKDebugProbeTransferError(
204
+ f"The Coresight write operation failed({str(exc)})."
205
+ ) from exc
206
+
207
+ def assert_reset_line(self, assert_reset: bool = False) -> None:
208
+ """Control reset line at a target.
209
+
210
+ :param assert_reset: If True, the reset line is asserted(pulled down), if False the reset line is not affected.
211
+ :raises SPSDKDebugProbeNotOpenError: The Pemicro debug probe is not opened yet
212
+ :raises SPSDKDebugProbeError: The PyPEMicro probe RESET function failed
213
+ """
214
+ if self.pemicro is None:
215
+ raise SPSDKDebugProbeNotOpenError("The Pemicro debug probe is not opened yet")
216
+
217
+ try:
218
+ if assert_reset:
219
+ self.pemicro.control_reset_line(True)
220
+ else:
221
+ self.pemicro.control_reset_line(False)
222
+ except PEMicroException as exc:
223
+ raise SPSDKDebugProbeError(f"Pemicro reset operation failed: {str(exc)}") from exc
@@ -0,0 +1,53 @@
1
+ Metadata-Version: 2.1
2
+ Name: spsdk-pemicro
3
+ Version: 0.1.0
4
+ Summary: P&E Micro debugger probe plugin. A debugger probe plugin for SPSDK.
5
+ Author: NXP
6
+ Maintainer-email: NXP <michal.starecek@nxp.com>
7
+ License: BSD-3-Clause
8
+ Project-URL: Homepage, https://github.com/nxp-mcuxpresso/spsdk_plugins/tree/master/pemicro
9
+ Project-URL: Issues, https://github.com/nxp-mcuxpresso/spsdk_plugins/issues
10
+ Keywords: NXP,SPSDK,pemicro
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: BSD License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: spsdk>=2.2.0
24
+ Requires-Dist: pypemicro>=0.1.11
25
+
26
+
27
+ P&E Micro debugger probe plugin
28
+ ===============================
29
+
30
+
31
+ * Free software: BSD-3-Clause
32
+
33
+
34
+ Features
35
+ --------
36
+
37
+ * Allow SPSDK to use P&E Micro as an interface for debugger probes.
38
+
39
+
40
+ Installation
41
+ ------------
42
+
43
+ * Activate virtual env, where you have SPSDK
44
+ - if SPSDK is not installed, the latest one will be installed automatically from [PyPI](https://pypi.org/project/spsdk/)
45
+ * `pip install spsdk-pemicro`
46
+ * Verify installation by running `nxpdebugmbox --help`
47
+ - you should see `pemicro` amongst available interfaces (--interface)
48
+
49
+
50
+ Credits
51
+ -------
52
+
53
+ This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [SPSDK Debug Probe project template](https://github.com/nxp-mcuxpresso/spsdk/blob/master/examples/plugins/templates/cookiecutter-spsdk-debug-probe-plugin.zip).
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ SW_Content_Register_spsdk_pemicro.txt
5
+ pyproject.toml
6
+ requirements_dev.txt
7
+ spsdk_pemicro/__init__.py
8
+ spsdk_pemicro/probe.py
9
+ spsdk_pemicro.egg-info/PKG-INFO
10
+ spsdk_pemicro.egg-info/SOURCES.txt
11
+ spsdk_pemicro.egg-info/dependency_links.txt
12
+ spsdk_pemicro.egg-info/entry_points.txt
13
+ spsdk_pemicro.egg-info/requires.txt
14
+ spsdk_pemicro.egg-info/top_level.txt
15
+ tests/__init__.py
16
+ tests/test_integration.py
@@ -0,0 +1,2 @@
1
+ [spsdk.debug_probe]
2
+ pemicro = spsdk_pemicro.probe
@@ -0,0 +1,2 @@
1
+ spsdk>=2.2.0
2
+ pypemicro>=0.1.11
@@ -0,0 +1 @@
1
+ spsdk_pemicro
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ # Copyright 2024 NXP
5
+ #
6
+ # SPDX-License-Identifier: BSD-3-Clause
7
+ """Unit test package for spsdk_pemicro."""
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: UTF-8 -*-
3
+ #
4
+ # Copyright 2024 NXP
5
+ #
6
+ # SPDX-License-Identifier: BSD-3-Clause
7
+ """Tests for `spsdk_pemicro` package integration in SPSDK."""
8
+
9
+ from click.testing import CliRunner
10
+ from spsdk.apps import nxpdebugmbox
11
+
12
+
13
+ def test_integration():
14
+ runner = CliRunner()
15
+ result = runner.invoke(nxpdebugmbox.main, "--help")
16
+ assert "pemicro" in result.output