Skip to content

Commit

Permalink
Miscellaneous cleanup.
Browse files Browse the repository at this point in the history
- Add .editorconfig.
- Add .git_archival.txt and .gitattributes.
- Update .gitignore.
- Trailing whitespace cleanup.
- Remove HISTORY.md.
- Correct/cleanup license headers.
- Plugin reports the version from the generated _version.py.
- Fix a few comments with stale names.
- Export plugin via pyocd.probe entry point in setup.
- Add use_scm_version config to setup.
  • Loading branch information
flit committed Nov 14, 2020
1 parent 604e6ec commit afe6f98
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 97 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref-names: $Format:%D$
21 changes: 21 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
68 changes: 21 additions & 47 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 0 additions & 8 deletions HISTORY.md

This file was deleted.

17 changes: 9 additions & 8 deletions pyocd_pemicro/__init__.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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__
62 changes: 42 additions & 20 deletions pyocd_pemicro/pemicro_probe.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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"
return "PEMicro debug probe"

@property
def version(self):
return plugin_version

74 changes: 60 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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)

0 comments on commit afe6f98

Please sign in to comment.