diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e62056f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 0000000..95cb3ee --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1 @@ +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9803be7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,21 @@ +*.py text +*.c text +*.cpp text +*.h text +*.s text +*.S text +*.ld text +*.txt text +*.xml text +*.yml text +*.yaml text +*.md text +*.rst text +*.json text +*.ini text +Makefile text +*.bat text eol=crlf +*.map text +*.elf binary +*.bin binary +.git_archival.txt export-subst diff --git a/.gitignore b/.gitignore index b6e4761..244e0e5 100644 --- a/.gitignore +++ b/.gitignore @@ -55,60 +55,17 @@ coverage.xml *.mo *.pot -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - # Sphinx documentation docs/_build/ -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - # Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ +.env* +.venv* +env*/ +venv*/ # Spyder project settings .spyderproject @@ -127,3 +84,20 @@ dmypy.json # Pyre type checker .pyre/ + +# Doxygen +html + +# VSCode +.vscode + +# pyocd +pyocd.yaml +pyocd_user.py + +# Tags +tags +.tags + +# Generated version file +pyocd_pemicro/_version.py diff --git a/HISTORY.md b/HISTORY.md deleted file mode 100644 index 4f68dff..0000000 --- a/HISTORY.md +++ /dev/null @@ -1,8 +0,0 @@ -History of PyOCD_Pemicro package versions -========================================= - - -v 0.1.0 -------- - - November 2020 - - Initial version diff --git a/pyocd_pemicro/__init__.py b/pyocd_pemicro/__init__.py index 504855e..6bb4d19 100644 --- a/pyocd_pemicro/__init__.py +++ b/pyocd_pemicro/__init__.py @@ -1,9 +1,9 @@ -#!/usr/bin/env python +# -*- coding: utf-8 -*- # -# Copyright 2020 NXP +# Copyright © 2020 NXP +# Copyright @ 2020 Chris Reed # -# SPDX-License-Identifier: -# BSD-3-Clause +# SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: @@ -30,11 +30,12 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# This is PEMicro debug probes support plugin for PyOCD project -# PEMicro company has been notified and they are agree. -"""PEMicro PyOCD plugin Python implementation by NXP. +"""PEMicro pyOCD plugin Python implementation by NXP. -The basics support of PEmicro probes under PyOCD project. +Provides basic support of PEMicro probes for the pyOCD project. +The PEMicro company has been notified and they support this effort. """ from pyocd_pemicro.pemicro_probe import * + +from ._version import version as __version__ diff --git a/pyocd_pemicro/pemicro_probe.py b/pyocd_pemicro/pemicro_probe.py index 323a9fb..3dec939 100644 --- a/pyocd_pemicro/pemicro_probe.py +++ b/pyocd_pemicro/pemicro_probe.py @@ -1,18 +1,34 @@ -# pyOCD debugger -# Copyright (c) 2020 Arm Limited -# SPDX-License-Identifier: Apache-2.0 +# -*- coding: utf-8 -*- # -# 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 +# Copyright © 2020 NXP +# Copyright @ 2020 Chris Reed # -# http://www.apache.org/licenses/LICENSE-2.0 +# SPDX-License-Identifier: BSD-3-Clause # -# 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. +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# o Redistributions of source code must retain the above copyright notice, this list +# of conditions and the following disclaimer. +# +# o Redistributions in binary form 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. +# +# o Neither the names of the copyright holders nor the names of the +# contributors may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. import six from pypemicro import PyPemicro, PEMicroException, PEMicroTransferException, PEMicroInterfaces @@ -23,14 +39,15 @@ from pyocd.core.plugin import Plugin from pyocd.core import (exceptions, memory_interface) +from ._version import version as plugin_version + LOG = logging.getLogger(__name__) TRACE = LOG.getChild("trace") TRACE.setLevel(logging.INFO) - -## @brief Wraps a PEMicro as a DebugProbe. class PEMicroProbe(DebugProbe): + """! @brief Wraps a PEMicro as a DebugProbe.""" # Address of DP's SELECT register. DP_SELECT = 0x8 @@ -43,7 +60,7 @@ class PEMicroProbe(DebugProbe): @classmethod def _get_pemicro(cls): - # TypeError is raised by pylink if the JLink DLL cannot be found. + # PEMicroException is raised by PyPemicro if the JLink DLL cannot be found. try: return PyPemicro(log_debug=TRACE.debug, log_err=TRACE.error, @@ -311,15 +328,20 @@ def _convert_exception(exc): return exc class PEMicroProbePlugin(Plugin): - """! @brief Plugin class for CMSISDAPProbe.""" - + """! @brief Plugin class for PEMicroProbe.""" + def load(self): return PEMicroProbe - + @property def name(self): return "pemicro" - + @property def description(self): - return "PEMicro debug probe" \ No newline at end of file + return "PEMicro debug probe" + + @property + def version(self): + return plugin_version + diff --git a/setup.py b/setup.py index a005645..b046871 100644 --- a/setup.py +++ b/setup.py @@ -1,22 +1,47 @@ +# -*- coding: utf-8 -*- +# +# Copyright © 2020 NXP +# Copyright @ 2020 Chris Reed +# +# SPDX-License-Identifier: BSD-3-Clause +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# o Redistributions of source code must retain the above copyright notice, this list +# of conditions and the following disclaimer. +# +# o Redistributions in binary form 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. +# +# o Neither the names of the copyright holders nor the names of the +# contributors may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. + from setuptools import setup, find_packages -with open('README.md') as readme_file: +with open('README.md', encoding='utf-8') as readme_file: README = readme_file.read() -with open('HISTORY.md') as history_file: - HISTORY = history_file.read() - -setup_args = dict( +setup( name='pyocd-pemicro', version='0.1.0', - description='PyOCD debug probe plugin for PEMicro Debug probes', + description='PyOCD debug probe plugin for PEMicro debug probes', long_description_content_type="text/markdown", - long_description=README + '\n\n' + HISTORY, + long_description=README, platforms="Windows, Linux, Mac OSX", - python_requires=">=3.6", - setup_requires=[ - 'setuptools>=40.0' - ], license='BSD-3-Clause', packages=find_packages(), author='Petr Gargulak', @@ -28,19 +53,40 @@ 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Operating System :: POSIX :: Linux', 'Operating System :: Microsoft :: Windows', 'Operating System :: MacOS :: MacOS X', 'License :: OSI Approved :: BSD License', 'Topic :: Scientific/Engineering', + "Topic :: Software Development :: Debuggers", 'Topic :: Software Development :: Embedded Systems', 'Topic :: System :: Hardware', 'Topic :: Utilities' ], + use_scm_version={ + 'local_scheme': 'dirty-tag', + 'write_to': 'pyocd_pemicro/_version.py' + }, + python_requires=">=3.6", + setup_requires=[ + 'setuptools>=40.0', + 'setuptools_scm!=1.5.3,!=1.5.4', + 'setuptools_scm_git_archive', + ], install_requires = [ - 'six>=1.0,<2.0', 'pypemicro>=0.1.2', + 'six>=1.0,<2.0', ], + entry_points={ + 'pyocd.probe': [ + 'pemicro = pyocd_pemicro:PEMicroProbePlugin', + ], + }, + zip_safe=True, + options={ + 'bdist_wheel': { + 'universal': True, + }, + }, ) - -setup(**setup_args)