├── docs ├── .nojekyll ├── objects.inv ├── _static │ ├── file.png │ ├── minus.png │ ├── plus.png │ ├── microchip.png │ ├── mchp-brandingelement-rgb2.png │ ├── documentation_options.js │ └── microchip.css ├── .buildinfo └── _sources │ ├── index.rst.txt │ ├── pymcuprog.deviceinfo.rst.txt │ └── pymcuprog.serialupdi.rst.txt ├── doc ├── source │ ├── _static │ │ └── .keep │ ├── _templates │ │ ├── toc.rst_t │ │ ├── module.rst_t │ │ └── package.rst_t │ ├── index.rst │ ├── pymcuprog.deviceinfo.rst │ ├── conf.py │ └── pymcuprog.serialupdi.rst ├── requirements.txt ├── Makefile └── make.bat ├── pymcuprog ├── tests │ ├── __init__.py │ ├── readme.md │ ├── test_nvmdebugwire.py │ ├── test_nvmavr32.py │ ├── test_nvmmzeroplus.py │ ├── test_nvmspi.py │ ├── test_nvmpic.py │ └── cmsisupdi_test_with_hardware.py ├── deviceinfo │ ├── __init__.py │ ├── devices │ │ ├── __init__.py │ │ ├── attiny104.py │ │ ├── uc3a3256.py │ │ ├── atmega324pb.py │ │ ├── pic24fj64gu205.py │ │ ├── pic24fj128ga705.py │ │ ├── atsamd21e18a.py │ │ ├── atxmega128a1u.py │ │ ├── dspic33ck64mc105.py │ │ ├── atsamd21g18a.py │ │ ├── pic16f1768.py │ │ ├── pic16f1779.py │ │ ├── atsamd21j18a.py │ │ ├── pic16f1769.py │ │ ├── pic18f47k40.py │ │ ├── pic18f47q10.py │ │ ├── dspic33ak512mps506.py │ │ ├── pic16f13145.py │ │ ├── attiny84a.py │ │ ├── pic16f15244.py │ │ ├── pic16f15376.py │ │ ├── pic18f47k42.py │ │ ├── pic16lf18456.py │ │ ├── pic16f15276.py │ │ ├── pic16f18456.py │ │ ├── atmega328p.py │ │ ├── pic16f18076.py │ │ ├── pic16f18146.py │ │ ├── pic16f17146.py │ │ ├── pic16f17556.py │ │ ├── pic16f17576.py │ │ ├── pic16f18446.py │ │ ├── pic18f47q43.py │ │ ├── pic18f57q43.py │ │ ├── pic18f46q71.py │ │ ├── pic18f56q71.py │ │ ├── pic18f06q20.py │ │ ├── pic18f16q20.py │ │ ├── pic18f16q40.py │ │ ├── pic18f16q41.py │ │ ├── pic18f57q84.py │ │ ├── pic18f46q24.py │ │ ├── pic18f56q24.py │ │ ├── avr16dd14.py │ │ ├── avr16dd20.py │ │ ├── avr16dd28.py │ │ ├── avr16dd32.py │ │ ├── avr32dd14.py │ │ ├── avr32dd20.py │ │ ├── avr32dd28.py │ │ ├── avr32dd32.py │ │ ├── avr32da28.py │ │ ├── avr32da32.py │ │ ├── avr32da48.py │ │ ├── avr32db28.py │ │ ├── avr32db32.py │ │ ├── avr32db48.py │ │ ├── avr64da28.py │ │ ├── avr64da32.py │ │ ├── avr64da48.py │ │ ├── avr64da64.py │ │ ├── avr64db28.py │ │ ├── avr64db32.py │ │ ├── avr64db48.py │ │ ├── avr64db64.py │ │ ├── avr64dd14.py │ │ └── avr64dd20.py │ ├── eraseflags.py │ ├── memorynames.py │ ├── generateconfig.py │ └── deviceinfokeys.py ├── serialupdi │ ├── __init__.py │ ├── timeout.py │ ├── constants.py │ └── nvm.py ├── logging.yaml ├── avr32target.py ├── toolconnection.py ├── nvmtpi.py ├── nvmavr32.py └── nvmdebugwire.py ├── images └── microchip.png ├── pyproject.toml ├── LICENSE.txt └── setup.cfg /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/source/_static/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pymcuprog/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pymcuprog/serialupdi/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | # No requirements - all are mocked. 2 | -------------------------------------------------------------------------------- /docs/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microchip-pic-avr-tools/pymcuprog/HEAD/docs/objects.inv -------------------------------------------------------------------------------- /docs/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microchip-pic-avr-tools/pymcuprog/HEAD/docs/_static/file.png -------------------------------------------------------------------------------- /docs/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microchip-pic-avr-tools/pymcuprog/HEAD/docs/_static/minus.png -------------------------------------------------------------------------------- /docs/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microchip-pic-avr-tools/pymcuprog/HEAD/docs/_static/plus.png -------------------------------------------------------------------------------- /images/microchip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microchip-pic-avr-tools/pymcuprog/HEAD/images/microchip.png -------------------------------------------------------------------------------- /docs/_static/microchip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microchip-pic-avr-tools/pymcuprog/HEAD/docs/_static/microchip.png -------------------------------------------------------------------------------- /docs/_static/mchp-brandingelement-rgb2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microchip-pic-avr-tools/pymcuprog/HEAD/docs/_static/mchp-brandingelement-rgb2.png -------------------------------------------------------------------------------- /doc/source/_templates/toc.rst_t: -------------------------------------------------------------------------------- 1 | {{ header | heading }} 2 | 3 | .. toctree:: 4 | :maxdepth: {{ maxdepth }} 5 | {% for docname in docnames %} 6 | {{ docname }} 7 | {%- endfor %} 8 | 9 | -------------------------------------------------------------------------------- /doc/source/_templates/module.rst_t: -------------------------------------------------------------------------------- 1 | {%- if show_headings %} 2 | {{- basename | e | heading }} 3 | 4 | {% endif -%} 5 | .. automodule:: {{ qualname }} 6 | {%- for option in automodule_options %} 7 | :{{ option }}: 8 | {%- endfor %} 9 | 10 | -------------------------------------------------------------------------------- /docs/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file records the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 2839ac348d5e0d8d5b1c6fe644f6f653 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | # Note project parameters are given in the setup.cfg file to support older setuptools versions ( < 61.0.0 ) with no PEP 621 support 2 | [build-system] 3 | # python 2.7 can't go higher than setuptools major version 44 4 | requires = ["setuptools>=44.1.1", "wheel"] 5 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /docs/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | const DOCUMENTATION_OPTIONS = { 2 | VERSION: '', 3 | LANGUAGE: 'en', 4 | COLLAPSE_INDEX: false, 5 | BUILDER: 'html', 6 | FILE_SUFFIX: '.html', 7 | LINK_SUFFIX: '.html', 8 | HAS_SOURCE: true, 9 | SOURCELINK_SUFFIX: '.txt', 10 | NAVIGATION_WITH_KEYS: false, 11 | SHOW_SEARCH_SUMMARY: true, 12 | ENABLE_SEARCH_SHORTCUTS: true, 13 | }; -------------------------------------------------------------------------------- /doc/source/index.rst: -------------------------------------------------------------------------------- 1 | pymcuprog documentation 2 | ======================= 3 | 4 | .. automodule:: pymcuprog 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | :noindex: 9 | 10 | .. toctree:: 11 | :maxdepth: 4 12 | :caption: Contents: 13 | 14 | pymcuprog 15 | 16 | Indices and tables 17 | ================== 18 | 19 | * :ref:`genindex` 20 | * :ref:`modindex` 21 | * :ref:`search` 22 | -------------------------------------------------------------------------------- /docs/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | pymcuprog documentation 2 | ======================= 3 | 4 | .. automodule:: pymcuprog 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | :noindex: 9 | 10 | .. toctree:: 11 | :maxdepth: 4 12 | :caption: Contents: 13 | 14 | pymcuprog 15 | 16 | Indices and tables 17 | ================== 18 | 19 | * :ref:`genindex` 20 | * :ref:`modindex` 21 | * :ref:`search` 22 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/attiny104.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the ATtiny104 device 4 | Note: this model is incomplete and is for Microchip internal regression test purposes only 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'TPI', 11 | 'name': 'attiny104', 12 | 'architecture': 'avrtinytiny', 13 | 14 | # Some extra AVR specific fields 15 | 'device_id': 0x1E900B, 16 | } 17 | -------------------------------------------------------------------------------- /pymcuprog/tests/readme.md: -------------------------------------------------------------------------------- 1 | This folder contains tests based on Python unittest. Tests are run from the root of the repo (pymcuprog not pymcuprog/pymcuprog or pymcuprog/pymcuprog/tests) 2 | 3 | To run all tests: 4 | ~~~~ 5 | \pymcuprog>python -m unittest discover 6 | ~~~~ 7 | 8 | To run a specific test module: 9 | ~~~~ 10 | \pymcuprog>python -m unittest pymcuprog.tests.test_pymcuprogcli 11 | ~~~~ 12 | 13 | To run a specific test: 14 | ~~~~ 15 | \pymcuprog>python -m unittest pymcuprog.tests.test_pymcuprogcli.TestPymcuprogCLI.test_ping_nedbg_pic16f18446 16 | ~~~~ -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/uc3a3256.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the EDBG / UC3A3 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'uc3a3256', 8 | 'architecture': 'avr32', 9 | 'reset_domains': 5, 10 | 11 | # Flash 12 | 'flash_address_byte': 0, 13 | 'flash_size_bytes': 0x40000, 14 | 'flash_page_size_bytes': 512, 15 | 'flash_write_size_bytes': 1, 16 | 'flash_read_size_bytes': 1, 17 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 18 | 'flash_isolated_erase': False, 19 | } 20 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /pymcuprog/serialupdi/timeout.py: -------------------------------------------------------------------------------- 1 | """ 2 | Simple timer helper for UPDI stack 3 | """ 4 | import time 5 | 6 | #pylint: disable=too-few-public-methods 7 | class Timeout: 8 | """ 9 | Simple timeout helper in milliseconds. 10 | """ 11 | 12 | def __init__(self, timeout_ms): 13 | """ 14 | Start the expired counter instantly 15 | 16 | :param timeout_ms: milliseconds to count 17 | :type timeout_ms: int 18 | """ 19 | 20 | self.timeout_ms = timeout_ms 21 | self.start_time = time.time() 22 | 23 | def expired(self): 24 | """ 25 | Check if the timeout has expired 26 | 27 | :returns: True if expired, False otherwise 28 | :rtype: bool 29 | """ 30 | return time.time() - self.start_time > self.timeout_ms / 1000.0 31 | -------------------------------------------------------------------------------- /doc/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /pymcuprog/tests/test_nvmdebugwire.py: -------------------------------------------------------------------------------- 1 | #pylint: disable=too-many-lines 2 | #pylint: disable=too-many-public-methods 3 | #pylint: disable=missing-docstring 4 | 5 | import unittest 6 | from mock import MagicMock 7 | from mock import patch 8 | 9 | from pymcuprog.nvmdebugwire import NvmAccessProviderCmsisDapDebugwire 10 | 11 | class TestNvmAccessProviderCmsisDapDebugwire(unittest.TestCase): 12 | @patch("pymcuprog.nvmdebugwire.TinyAvrTarget") 13 | def test_read_device_id_returns_bytearray_with_raw_id(self, mock_tinyavrtarget): 14 | id_expected = bytearray([0x01, 0x02]) 15 | mock_tinyavrtarget_instance = MagicMock() 16 | mock_tinyavrtarget.return_value = mock_tinyavrtarget_instance 17 | mock_tinyavrtarget_instance.activate_physical.return_value = id_expected 18 | 19 | dwtarget = NvmAccessProviderCmsisDapDebugwire(None, None) 20 | 21 | id_read = dwtarget.read_device_id() 22 | 23 | self.assertEqual(id_expected, id_read) 24 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/atmega324pb.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the ATmega324PB device 3 | Note: this model is incomplete and is for Microchip internal regression test purposes only 4 | 5 | """ 6 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 7 | 8 | DEVICE_INFO = { 9 | 'name': 'atmega324pb', 10 | 'architecture': 'avr8', 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 0x8000, 15 | 'flash_page_size_bytes': 0x80, 16 | 'flash_write_size_bytes': 0x80, 17 | 'flash_read_size_bytes': 0x80, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # eeprom 22 | 'eeprom_address_byte': 0x0000, 23 | 'eeprom_size_bytes': 0x0400, 24 | 'eeprom_page_size_bytes': 0x04, 25 | 'eeprom_read_size_bytes': 1, 26 | 'eeprom_write_size_bytes': 1, 27 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 28 | 'eeprom_isolated_erase': False, 29 | 30 | # Some extra AVR specific fields 31 | 'interface': 'jtag', 32 | 'device_id': 0x1E9517, 33 | } 34 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic24fj64gu205.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC24FJ64GU205 device 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic24fj64gu205', 8 | 'device_id': '9A19', 9 | 'architecture': 'PIC24', 10 | 'interface' : 'icsp', 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_words': 0xB000, # 22 * 1024 * 2 15 | 'flash_page_size_bytes': 512, 16 | 'flash_write_size_bytes': 16, 17 | 'flash_read_size_bytes': 16, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | # Configuration words are integrated in the flash, but since they are not represented 20 | # as a separate memory it is correct to state that flash can be erased in isolation 21 | 'flash_isolated_erase': True, 22 | 23 | # ICD memory 24 | 'icd_address_byte': 0x800000 * 2, 25 | 'icd_size_bytes': 512 * 8, # 4KiB 26 | 'icd_page_size_bytes': 512, 27 | 'icd_write_size_bytes': 16, 28 | 'icd_read_size_bytes': 16, 29 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 30 | 'icd_isolated_erase': True, 31 | } 32 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic24fj128ga705.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC24FJ128GA705 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic24fj128ga705', 8 | 'device_id': '750B', 9 | 'architecture': 'PIC24', 10 | 'interface' : 'icsp', 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_words': 0x16000, # 44K * 1024 * 2 15 | 'flash_page_size_bytes': 512, 16 | 'flash_write_size_bytes': 16, 17 | 'flash_read_size_bytes': 16, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | # Configuration words are integrated in the flash, but since they are not represented 20 | # as a separate memory it is correct to state that flash can be erased in isolation 21 | 'flash_isolated_erase': True, 22 | 23 | # ICD memory 24 | 'icd_address_byte': 0x800000 * 2, 25 | 'icd_size_bytes': 512 * 8, # 4KiB 26 | 'icd_page_size_bytes': 512, 27 | 'icd_write_size_bytes': 16, 28 | 'icd_read_size_bytes': 16, 29 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 30 | 'icd_isolated_erase': True, 31 | } 32 | -------------------------------------------------------------------------------- /doc/source/pymcuprog.deviceinfo.rst: -------------------------------------------------------------------------------- 1 | pymcuprog.deviceinfo package 2 | ============================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | pymcuprog.deviceinfo.deviceinfo module 8 | -------------------------------------- 9 | 10 | .. automodule:: pymcuprog.deviceinfo.deviceinfo 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pymcuprog.deviceinfo.deviceinfokeys module 16 | ------------------------------------------ 17 | 18 | .. automodule:: pymcuprog.deviceinfo.deviceinfokeys 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pymcuprog.deviceinfo.eraseflags module 24 | -------------------------------------- 25 | 26 | .. automodule:: pymcuprog.deviceinfo.eraseflags 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pymcuprog.deviceinfo.memorynames module 32 | --------------------------------------- 33 | 34 | .. automodule:: pymcuprog.deviceinfo.memorynames 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | Module contents 40 | --------------- 41 | 42 | .. automodule:: pymcuprog.deviceinfo 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | -------------------------------------------------------------------------------- /docs/_sources/pymcuprog.deviceinfo.rst.txt: -------------------------------------------------------------------------------- 1 | pymcuprog.deviceinfo package 2 | ============================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | pymcuprog.deviceinfo.deviceinfo module 8 | -------------------------------------- 9 | 10 | .. automodule:: pymcuprog.deviceinfo.deviceinfo 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pymcuprog.deviceinfo.deviceinfokeys module 16 | ------------------------------------------ 17 | 18 | .. automodule:: pymcuprog.deviceinfo.deviceinfokeys 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pymcuprog.deviceinfo.eraseflags module 24 | -------------------------------------- 25 | 26 | .. automodule:: pymcuprog.deviceinfo.eraseflags 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pymcuprog.deviceinfo.memorynames module 32 | --------------------------------------- 33 | 34 | .. automodule:: pymcuprog.deviceinfo.memorynames 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | Module contents 40 | --------------- 41 | 42 | .. automodule:: pymcuprog.deviceinfo 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2025 Microchip Technology Inc. and its subsidiaries. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /doc/source/_templates/package.rst_t: -------------------------------------------------------------------------------- 1 | {%- macro automodule(modname, options) -%} 2 | .. automodule:: {{ modname }} 3 | {%- for option in options %} 4 | :{{ option }}: 5 | {%- endfor %} 6 | {%- endmacro %} 7 | 8 | {%- macro toctree(docnames) -%} 9 | .. toctree:: 10 | :maxdepth: {{ maxdepth }} 11 | {% for docname in docnames %} 12 | {{ docname }} 13 | {%- endfor %} 14 | {%- endmacro %} 15 | 16 | {%- if is_namespace %} 17 | {{- [pkgname, "namespace"] | join(" ") | e | heading }} 18 | {% else %} 19 | {{- pkgname | e | heading }} 20 | {% endif %} 21 | 22 | {%- if modulefirst and not is_namespace %} 23 | {{ automodule(pkgname, automodule_options) }} 24 | {% endif %} 25 | 26 | {%- if subpackages %} 27 | 28 | {{ toctree(subpackages) }} 29 | {% endif %} 30 | 31 | {%- if submodules %} 32 | {% if separatemodules %} 33 | {{ toctree(submodules) }} 34 | {%- else %} 35 | {%- for submodule in submodules %} 36 | {% if show_headings %} 37 | {{- submodule | e | heading(2) }} 38 | {% endif %} 39 | {{ automodule(submodule, automodule_options) }} 40 | {% endfor %} 41 | {%- endif %} 42 | {% endif %} 43 | 44 | {%- if not modulefirst and not is_namespace %} 45 | 46 | {{ automodule(pkgname, automodule_options) }} 47 | {% endif %} 48 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/eraseflags.py: -------------------------------------------------------------------------------- 1 | """ 2 | Definitions of erase related flags for the device models 3 | """ 4 | import inspect 5 | 6 | from pymcuprog.utils import enum 7 | 8 | # Flag used to specify if a memory type will be erased by a chip erase (AVR) or the widest/default bulk erase (PIC) 9 | ChiperaseEffect = enum( 10 | ALWAYS_ERASED='always erased', 11 | CONDITIONALLY_ERASED_AVR='conditionally erased (depending upon EESAVE fuse setting)', 12 | CONDITIONALLY_ERASED_PIC='conditionally erased (depending upon Code Protect configuration bit(s) settings)', 13 | NOT_ERASED='not erased') 14 | 15 | def get_list_of_chiperase_effects(): 16 | """Return a list of all ChiperaseEffect values""" 17 | chiperase_effect_attributes = inspect.getmembers(ChiperaseEffect, lambda a: not inspect.isroutine(a)) 18 | chiperase_effect_values = [] 19 | for attribute in chiperase_effect_attributes: 20 | # Builtin routines always starts and ends with double underscore (__) 21 | if not (attribute[0].startswith('__') and attribute[0].endswith('__')): 22 | # Only the attribute values are returned 23 | chiperase_effect_values.append(attribute[1]) 24 | 25 | return chiperase_effect_values 26 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/atsamd21e18a.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the ATSAMD21E18A devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'atsamd21e18a', 8 | 'architecture': 'CORTEX-M0PLUS', 9 | 10 | # Flash 11 | 'flash_address_byte': 0, 12 | 'flash_size_bytes': 0x40000, 13 | 'flash_page_size_bytes': 0x40, 14 | 'flash_write_size_bytes': 4, 15 | 'flash_read_size_bytes': 4, 16 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 17 | 'flash_isolated_erase': False, 18 | 19 | # user_row 20 | 'user_row_address_byte': 0x00804000, 21 | 'user_row_size_bytes': 256, 22 | 'user_row_page_size_bytes': 64, 23 | 'user_row_read_size_bytes': 4, 24 | 'user_row_write_size_bytes': 4, 25 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 26 | 'user_row_isolated_erase': True, 27 | 28 | # calibration data AKA OTP4 29 | 'calibration_row_address_byte': 0x00806020, 30 | 'calibration_row_size_bytes': 64, 31 | 'calibration_row_page_size_bytes': 64, 32 | 'calibration_row_read_size_bytes': 4, 33 | 'calibration_row_write_size_bytes': 0, 34 | 'calibration_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 35 | 'calibration_row_isolated_erase': False, 36 | } 37 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/atxmega128a1u.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the ATxmega128A1U device 3 | Note: this model is incomplete and is for Microchip internal regression test purposes only 4 | """ 5 | 6 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 7 | 8 | DEVICE_INFO = { 9 | 'name': 'atxmega128a1u', 10 | 'architecture': 'xmega', 11 | 12 | # flash 13 | 'flash_address_byte': 0x00800000, 14 | 'flash_size_bytes': 0x22000, 15 | 'flash_page_size_bytes': 512, 16 | 'flash_read_size_bytes': 2, 17 | 'flash_write_size_bytes': 512, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': True, 20 | 21 | # eeprom 22 | 'eeprom_address_byte': 0x008C0000, 23 | 'eeprom_size_bytes': 0x0800, 24 | 'eeprom_page_size_bytes': 0x20, 25 | 'eeprom_read_size_bytes': 1, 26 | 'eeprom_write_size_bytes': 1, 27 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 28 | 'eeprom_isolated_erase': True, 29 | 30 | # Some extra AVR specific fields 31 | 'nvmctrl_base': 0x00001000, 32 | 'syscfg_base': 0x00000F00, 33 | 'ocd_base': 0x0F80, 34 | 'data_space_base': 0x0090, 35 | 'interface': 'pdi+jtag', 36 | 'address_size': '16-bit', 37 | 'prog_clock_khz': 4000, 38 | 'device_id': 0x1E974C, 39 | } 40 | -------------------------------------------------------------------------------- /pymcuprog/tests/test_nvmavr32.py: -------------------------------------------------------------------------------- 1 | #pylint: disable=too-many-lines 2 | #pylint: disable=too-many-public-methods 3 | #pylint: disable=missing-docstring 4 | 5 | import unittest 6 | from mock import MagicMock 7 | from mock import patch 8 | 9 | from pymcuprog.nvmavr32 import NvmAccessProviderCmsisDapAvr32 10 | from pymcuprog.deviceinfo.deviceinfokeys import DeviceInfoKeysAvr32 11 | 12 | class TestNvmAccessProviderCmsisDapAvr32(unittest.TestCase): 13 | def _mock_avr32_device(self): 14 | mock_avr32device_patch = patch("pymcuprog.nvmavr32.Avr32Device") 15 | self.addCleanup(mock_avr32device_patch.stop) 16 | mock_avr32device = mock_avr32device_patch.start() 17 | mock_avr32device_instance = MagicMock() 18 | mock_avr32device.return_value = mock_avr32device_instance 19 | 20 | return mock_avr32device_instance 21 | 22 | def test_read_device_id_returns_bytearray_with_raw_id(self): 23 | id_expected = bytearray([0x01, 0x02, 0x03, 0x04]) 24 | mock_avr32device_instance = self._mock_avr32_device() 25 | mock_avr32device_instance.activate_physical.return_value = id_expected 26 | 27 | avr32 = NvmAccessProviderCmsisDapAvr32(None, {DeviceInfoKeysAvr32.RESET_DOMAINS: 5}) 28 | 29 | id_read = avr32.read_device_id() 30 | 31 | self.assertEqual(id_expected, id_read) 32 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/memorynames.py: -------------------------------------------------------------------------------- 1 | #pylint: disable=too-few-public-methods 2 | """ 3 | Memory name definitions 4 | """ 5 | 6 | class MemoryNameAliases(object): 7 | """ 8 | Memory names that are actually not real memories but an alias for several memories 9 | """ 10 | ALL = 'all' 11 | 12 | class MemoryNames(object): 13 | """ 14 | Memory names corresponding to target device memories 15 | """ 16 | # Real memories 17 | FLASH = 'flash' 18 | CONFIG_WORD = 'config_words' 19 | USER_ID = 'user_id' 20 | USER_ROW = 'user_row' 21 | BOOT_ROW = 'boot_row' 22 | EEPROM = 'eeprom' 23 | FUSES = 'fuses' 24 | CALIBRATION_ROW = 'calibration_row' 25 | ICD = 'icd' 26 | LOCKBITS = 'lockbits' 27 | SIGNATURES = 'signatures' 28 | INTERNAL_SRAM = 'internal_sram' 29 | DIA = 'dia' 30 | DCI = 'dci' 31 | 32 | @classmethod 33 | def get_all(cls): 34 | """ 35 | Get a list of all memories representing actual device memories 36 | 37 | :return List of all memory names representing actual device memories 38 | """ 39 | all_memories = [] 40 | for attribute in dir(cls): 41 | if not attribute.startswith('__') and not callable(getattr(cls, attribute)): 42 | all_memories.append(getattr(cls, attribute)) 43 | 44 | return all_memories 45 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/dspic33ck64mc105.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the dspic33ck64mc105 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'dspic33ck64mc105', 8 | 'device_id': 0x9912, 9 | 'architecture': 'dsPIC33', 10 | 'interface' : 'icsp', 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_words': 0x00B000, 15 | 'flash_page_size_bytes': 8, # This architecture has 2-word latches (6 packed bytes / 8 flat bytes) 16 | 'flash_write_size_bytes': 8, # The GEN4 byte-code writes chunks of 6 packed bytes / 2 words / 8 flat bytes 17 | 'flash_read_size_bytes': 16, # The GEN4 byte-code reads chunks of 12 packed bytes / 4 words / 16 flat bytes 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | # Configuration words are integrated in the flash, but since they are not represented 20 | # as a separate memory it is correct to state that flash can be erased in isolation 21 | 'flash_isolated_erase': True, 22 | 23 | # ICD memory 24 | 'icd_address_byte': 0x800000 * 2, 25 | 'icd_size_bytes': 512 * 16, # 8KiB 26 | 'icd_page_size_bytes': 8, 27 | 'icd_write_size_bytes': 8, 28 | 'icd_read_size_bytes': 16, 29 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 30 | 'icd_isolated_erase': True, 31 | } 32 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/atsamd21g18a.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the ATSAMD21G18A devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'atsamd21g18a', 8 | 'architecture': 'CORTEX-M0PLUS', 9 | 10 | # Flash 11 | 'flash_address_byte': 0, 12 | 'flash_size_bytes': 0x40000, 13 | 'flash_page_size_bytes': 0x100, # Note: this represents the optimal transfer size, not actual flash page. 14 | 'flash_write_size_bytes': 4, 15 | 'flash_read_size_bytes': 4, 16 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 17 | 'flash_isolated_erase': False, 18 | 19 | # user_row 20 | 'user_row_address_byte': 0x00804000, 21 | 'user_row_size_bytes': 256, 22 | 'user_row_page_size_bytes': 64, 23 | 'user_row_read_size_bytes': 4, 24 | 'user_row_write_size_bytes': 4, 25 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 26 | 'user_row_isolated_erase': True, 27 | 28 | # calibration data AKA OTP4 29 | 'calibration_row_address_byte': 0x00806020, 30 | 'calibration_row_size_bytes': 64, 31 | 'calibration_row_page_size_bytes': 64, 32 | 'calibration_row_read_size_bytes': 4, 33 | 'calibration_row_write_size_bytes': 0, 34 | 'calibration_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 35 | 'calibration_row_isolated_erase': False, 36 | } 37 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f1768.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F1768 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f1768', 8 | 'architecture': 'PIC16', 9 | # Will erase Flash, User ID and Config words 10 | 'default_bulk_erase_address_word': 0x8000, 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 4*1024, # 4KW 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_word': 0x8000, 23 | 'user_id_size_words': 4, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 28 | 'user_id_isolated_erase': False, 29 | 30 | # Config words 31 | 'config_words_address_word': 0x8007, 32 | 'config_words_size_words': 2, 33 | 'config_words_page_size_words': 1, 34 | 'config_words_write_size_words': 1, 35 | 'config_words_read_size_words': 1, 36 | 'config_words_erase_address_word': 0, 37 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 38 | 'config_words_isolated_erase': False, 39 | } 40 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f1779.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F1779 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f1779', 8 | 'architecture': 'PIC16', 9 | # Will erase Flash, User ID and Config words 10 | 'default_bulk_erase_address_word': 0x8000, 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 16*1024, # 16KW 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_word': 0x8000, 23 | 'user_id_size_words': 4, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 28 | 'user_id_isolated_erase': False, 29 | 30 | # Config words 31 | 'config_words_address_word': 0x8007, 32 | 'config_words_size_words': 2, 33 | 'config_words_page_size_words': 1, 34 | 'config_words_write_size_words': 1, 35 | 'config_words_read_size_words': 1, 36 | 'config_words_erase_address_word': 0, 37 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 38 | 'config_words_isolated_erase': False, 39 | } 40 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/atsamd21j18a.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the ATSAMD21J18A devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'atsamd21j18a', 8 | 'architecture': 'CORTEX-M0PLUS', 9 | 10 | # Flash 11 | 'flash_address_byte': 0, 12 | 'flash_size_bytes': 0x40000, 13 | 'flash_page_size_bytes': 0x100, # Note: this represents the optimal transfer size, not actual flash page. 14 | 'flash_write_size_bytes': 4, 15 | 'flash_read_size_bytes': 4, 16 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 17 | 'flash_isolated_erase': False, 18 | 19 | # user_row 20 | 'user_row_address_byte': 0x00804000, 21 | 'user_row_size_bytes': 256, 22 | 'user_row_page_size_bytes': 64, 23 | 'user_row_read_size_bytes': 4, 24 | 'user_row_write_size_bytes': 4, 25 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 26 | 'user_row_isolated_erase': True, 27 | 28 | # calibration data AKA OTP4 29 | 'calibration_row_address_byte': 0x00806020, 30 | 'calibration_row_size_bytes': 64, 31 | 'calibration_row_page_size_bytes': 64, 32 | 'calibration_row_read_size_bytes': 4, 33 | 'calibration_row_write_size_bytes': 0, 34 | 'calibration_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 35 | 'calibration_row_isolated_erase': False, 36 | } 37 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f1769.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F1769 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f1769', 8 | 'architecture': 'PIC16', 9 | 'device_id': 0x3085, 10 | # Will erase Flash, User ID and Config words 11 | 'default_bulk_erase_address_word': 0x8000, 12 | 13 | # Flash 14 | 'flash_address_word': 0, 15 | 'flash_size_words': 8*1024, # 4KW 16 | 'flash_page_size_words': 32, 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_word': 0x8000, 24 | 'user_id_size_words': 4, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 29 | 'user_id_isolated_erase': False, 30 | 31 | # Config words 32 | 'config_words_address_word': 0x8007, 33 | 'config_words_size_words': 2, 34 | 'config_words_page_size_words': 1, 35 | 'config_words_write_size_words': 1, 36 | 'config_words_read_size_words': 1, 37 | 'config_words_erase_address_word': 0, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | } 41 | -------------------------------------------------------------------------------- /pymcuprog/tests/test_nvmmzeroplus.py: -------------------------------------------------------------------------------- 1 | #pylint: disable=too-many-lines 2 | #pylint: disable=too-many-public-methods 3 | #pylint: disable=missing-docstring 4 | 5 | import unittest 6 | from mock import MagicMock 7 | from mock import patch 8 | 9 | from pymcuprog.nvmmzeroplus import NvmAccessProviderCmsisDapMZeroPlus 10 | 11 | class TestNvmAccessProviderCmsisDapMZeroPlus(unittest.TestCase): 12 | 13 | def setUp(self): 14 | self.mock_samd2xtarget_patch = patch('pymcuprog.nvmmzeroplus.SamD2xTarget') 15 | self.addCleanup(self.mock_samd2xtarget_patch.stop) 16 | self.mock_samd2xtarget = self.mock_samd2xtarget_patch.start() 17 | self.mock_samd2xtarget_instance = MagicMock() 18 | self.mock_samd2xtarget.return_value = self.mock_samd2xtarget_instance 19 | 20 | def test_read_device_id_returns_bytearray_with_raw_id(self): 21 | id_expected = bytearray([0x01, 0x02, 0x03, 0x04]) 22 | self.mock_samd2xtarget_instance.read_device_id.return_value = int.from_bytes(id_expected, 23 | byteorder='little', 24 | signed=False) 25 | self.mock_samd2xtarget_instance.read_idcode.return_value = 0 26 | 27 | mzeroplus = NvmAccessProviderCmsisDapMZeroPlus(None, None) 28 | 29 | id_read = mzeroplus.read_device_id() 30 | 31 | self.assertEqual(id_expected, id_read) 32 | 33 | def test_erase_when_memory_info_is_none_performs_chiperase(self): 34 | mzeroplus = NvmAccessProviderCmsisDapMZeroPlus(None, None) 35 | 36 | mzeroplus.erase(memory_info=None, address=None) 37 | 38 | self.mock_samd2xtarget_instance.chip_erase_dsu.assert_called() 39 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f47k40.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F47K40 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f47k40', 8 | 'architecture': 'PIC18', 9 | # Will erase Flash, User ID, Config words and EEPROM (if CPD_bar config bit is disabled) 10 | 'default_bulk_erase_address_byte': 0x300000, 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 128*1024, # 128KB 15 | 'flash_page_size_bytes': 128, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_byte': 0x200000, 23 | 'user_id_size_words': 8, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_erase_address_byte': 0x300000, 28 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 29 | 'user_id_isolated_erase': False, 30 | 31 | # Config words 32 | 'config_words_address_byte': 0x300000, 33 | 'config_words_size_words': 6, 34 | 'config_words_page_size_words': 1, 35 | 'config_words_write_size_words': 1, 36 | 'config_words_read_size_words': 1, 37 | 'config_words_erase_address_byte': 0, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x310000, 43 | 'eeprom_size_bytes': 1024, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_PIC, 48 | 'eeprom_isolated_erase': True, 49 | } 50 | -------------------------------------------------------------------------------- /pymcuprog/logging.yaml: -------------------------------------------------------------------------------- 1 | version: 1 2 | disable_existing_loggers: False 3 | formatters: 4 | timestamped: 5 | format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s" 6 | detailed: 7 | format: "%(name)s - %(levelname)s - %(message)s" 8 | simple: 9 | format: "%(message)s" 10 | 11 | handlers: 12 | # Logging to the console is default to WARNING with detailed output: 13 | console: 14 | class: logging.StreamHandler 15 | level: WARNING 16 | formatter: detailed 17 | stream: ext://sys.stdout 18 | 19 | # Logging debug output to file 20 | # Handler disabled by default - for reference only 21 | debug_file_handler: 22 | class: logging.FileHandler 23 | level: DEBUG 24 | formatter: timestamped 25 | # File path will be user log directory for this application 26 | filename: debug.log 27 | encoding: utf8 28 | 29 | # Logging errors to file 30 | # Handler disabled by default - for reference only 31 | error_file_handler: 32 | class: logging.handlers.RotatingFileHandler 33 | level: ERROR 34 | formatter: timestamped 35 | # File path will be user log directory for this application 36 | filename: errors.log 37 | maxBytes: 10485760 # 10MB 38 | backupCount: 20 39 | encoding: utf8 40 | 41 | loggers: 42 | # pyedbglib library should be kept to critical errors to console only 43 | pyedbglib: 44 | level: ERROR 45 | handlers: [console] 46 | propagate: no 47 | 48 | root: 49 | # Default level is warning 50 | # this is increased with -v in CLI usage 51 | level: WARNING 52 | # Default handlers is console only 53 | handlers: [console] 54 | # Add debug_file_handler for debug output to file 55 | # Add error_file_handler for error output to file 56 | # See configuration in handlers section above 57 | #handlers: [console, debug_file_handler, error_file_handler] 58 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f47q10.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F47Q10 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f47q10', 8 | 'architecture': 'PIC18', 9 | # Will erase Flash, User ID, Config words and EEPROM (if CPD_bar config bit is disabled) 10 | 'default_bulk_erase_address_byte': 0x300000, 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 128*1024, # 64KW 15 | 'flash_page_size_words': 128, # No page buffer so this is for sector erase 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_byte': 0x200000, 23 | 'user_id_size_words': 128, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_erase_address_byte': 0x300000, 28 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 29 | 'user_id_isolated_erase': False, 30 | 31 | # Config words 32 | 'config_words_address_byte': 0x300000, 33 | 'config_words_size_words': 6, 34 | 'config_words_page_size_words': 1, 35 | 'config_words_write_size_words': 1, 36 | 'config_words_read_size_words': 1, 37 | 'config_words_erase_address_byte': 0, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x310000, 43 | 'eeprom_size_bytes': 1024, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_PIC, 48 | 'eeprom_isolated_erase': True, 49 | } 50 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/dspic33ak512mps506.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the dspic33ak512mps506 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'dspic33ak512mps506', 8 | 'device_id': 0xA779, 9 | 'architecture': 'dsPIC33A', 10 | 'interface' : 'icsp', 11 | 12 | # Flash 13 | 'flash_address_byte': 0x800000, 14 | 'flash_size_bytes': 0x080000, # 512KiB 15 | 'flash_page_size_bytes': 0x1000, 16 | # Limited to 512 bytes due to USB chunk size limitation 17 | 'flash_write_size_bytes': 0x200, 18 | 'flash_read_size_bytes': 4, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | # Configuration words are integrated in the flash, but since they are not represented 21 | # as a separate memory it is correct to state that flash can be erased in isolation 22 | 'flash_isolated_erase': True, 23 | 24 | # ICD memory 25 | 'icd_address_byte': 0x7F0000, 26 | 'icd_size_bytes': 512 * 16, # 8KiB 27 | 'icd_page_size_bytes': 0x1000, 28 | # Limited to 512 bytes due to USB chunk size limitation 29 | 'icd_write_size_bytes': 0x200, 30 | 'icd_read_size_bytes': 4, 31 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 32 | 'icd_isolated_erase': True, 33 | 34 | # Config words 35 | 'config_words_address_byte': 0x7F3000, 36 | 'config_words_size_bytes': 0x2000, 37 | # Strictly speaking config words have same page size as normal flash, but since quad-word writes are used for 38 | # config words the write size can be 16 bytes (4 words * 4 bytes per word) and a page size of 16 bytes makes the 39 | # output more readable 40 | 'config_words_page_size_bytes': 16, 41 | 'config_words_write_size_bytes': 16, 42 | 'config_words_read_size_bytes': 4, 43 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 44 | 'config_words_isolated_erase': False, 45 | } 46 | -------------------------------------------------------------------------------- /pymcuprog/avr32target.py: -------------------------------------------------------------------------------- 1 | """ 2 | Device Specific Classes which use AVR32Protocol implementation 3 | """ 4 | from pyedbglib.protocols.avr32protocol import Avr32Protocol 5 | 6 | class Avr32Device(object): 7 | """ 8 | Generic AVR32 device wrapper (maps to avr32 protocol) 9 | """ 10 | def __init__(self, transport, reset_domains=5): 11 | """ 12 | :param transport: Transport layer object 13 | :param reset_domains: Number of bits in the RESET register. 14 | This number is device dependant 15 | """ 16 | self.protocol = Avr32Protocol(transport) 17 | self.interface = Avr32Protocol.AVR32_PHY_INTF_JTAG 18 | self.reset_domains = reset_domains 19 | 20 | def setup_prog_session(self, interface="jtag"): 21 | """ 22 | Setup a programming session on AVR32 23 | 24 | :param interface: jtag or awire 25 | """ 26 | if interface == "awire": 27 | self.interface = Avr32Protocol.AVR32_PHY_INTF_AWIRE 28 | else: 29 | self.interface = Avr32Protocol.AVR32_PHY_INTF_JTAG 30 | # Set clock frequency 31 | self.protocol.set_le16(Avr32Protocol.AVR32_CONTEXT_PHYSICAL, Avr32Protocol.AVR32_PHYSICAL_JTAG_CLOCK, 8000) 32 | 33 | # Set interface 34 | self.protocol.set_byte(Avr32Protocol.AVR32_CONTEXT_PHYSICAL, Avr32Protocol.AVR32_PHYSICAL_PHYSICAL, 35 | self.interface) 36 | 37 | # Set number of reset domains 38 | self.protocol.set_byte(Avr32Protocol.AVR32_CONTEXT_DEVICE, Avr32Protocol.AVR32_RESET_DOMAINS, 39 | self.reset_domains) 40 | 41 | def activate_physical(self): 42 | """ 43 | Activate the physical interface 44 | """ 45 | return self.protocol.activate_physical() 46 | 47 | def deactivate_physical(self): 48 | """ 49 | Deactivate the physical interface 50 | """ 51 | return self.protocol.deactivate_physical() 52 | -------------------------------------------------------------------------------- /pymcuprog/toolconnection.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module includes wrapper classes for Tool connection parameters 3 | """ 4 | 5 | from .serialupdi.physical import DEFAULT_SERIALUPDI_BAUD 6 | 7 | #pylint: disable=too-few-public-methods 8 | class ToolConnection(object): 9 | """ 10 | Base class for ToolConnection classes used to wrap configuration parameters for tool connections 11 | """ 12 | 13 | #pylint: disable=too-few-public-methods 14 | class ToolUsbHidConnection(ToolConnection): 15 | """ 16 | Helper class wrapping configuration parameters for a connection to a USB HID tool 17 | """ 18 | serialnumber = None 19 | tool_name = None 20 | 21 | def __init__(self, serialnumber=None, tool_name=None): 22 | """ 23 | :param tool_name: Tool name as given in USB Product string. Some shortnames are also supported 24 | as defined in pyedbglib.hidtransport.toolinfo.py. Set to None if don't care 25 | :param serialnumber: USB serial number string. Set to None if don't care 26 | """ 27 | self.serialnumber = serialnumber 28 | self.tool_name = tool_name 29 | 30 | #pylint: disable=too-few-public-methods 31 | class ToolSerialConnection(ToolConnection): 32 | """ 33 | Helper class wrapping configuration parameters for a connection to a serial port 34 | """ 35 | serialport = None 36 | 37 | def __init__(self, serialport="COM1", baudrate=DEFAULT_SERIALUPDI_BAUD, timeout=None): 38 | """ 39 | :param serialport: Serial port name to connect to. 40 | :type serialport: str 41 | :param baudrate: baud rate in bps to use for communications 42 | :type baudrate: int (defaults to 115200) 43 | :param timeout: timeout value for serial reading. 44 | When UPDI is not enabled, attempting to read will return after this timeout period. 45 | :type timeout: float 46 | """ 47 | self.serialport = serialport 48 | self.baudrate = baudrate 49 | self.timeout = timeout 50 | -------------------------------------------------------------------------------- /pymcuprog/serialupdi/constants.py: -------------------------------------------------------------------------------- 1 | """ 2 | UPDI protocol constants 3 | """ 4 | # UPDI commands and control definitions 5 | UPDI_BREAK = 0x00 6 | 7 | UPDI_LDS = 0x00 8 | UPDI_STS = 0x40 9 | UPDI_LD = 0x20 10 | UPDI_ST = 0x60 11 | UPDI_LDCS = 0x80 12 | UPDI_STCS = 0xC0 13 | UPDI_REPEAT = 0xA0 14 | UPDI_KEY = 0xE0 15 | 16 | UPDI_PTR = 0x00 17 | UPDI_PTR_INC = 0x04 18 | UPDI_PTR_ADDRESS = 0x08 19 | 20 | UPDI_ADDRESS_8 = 0x00 21 | UPDI_ADDRESS_16 = 0x04 22 | UPDI_ADDRESS_24 = 0x08 23 | 24 | UPDI_DATA_8 = 0x00 25 | UPDI_DATA_16 = 0x01 26 | UPDI_DATA_24 = 0x02 27 | 28 | UPDI_KEY_SIB = 0x04 29 | UPDI_KEY_KEY = 0x00 30 | 31 | UPDI_KEY_64 = 0x00 32 | UPDI_KEY_128 = 0x01 33 | UPDI_KEY_256 = 0x02 34 | 35 | UPDI_SIB_8BYTES = UPDI_KEY_64 36 | UPDI_SIB_16BYTES = UPDI_KEY_128 37 | UPDI_SIB_32BYTES = UPDI_KEY_256 38 | 39 | UPDI_REPEAT_BYTE = 0x00 40 | UPDI_REPEAT_WORD = 0x01 41 | 42 | UPDI_PHY_SYNC = 0x55 43 | UPDI_PHY_ACK = 0x40 44 | 45 | UPDI_MAX_REPEAT_SIZE = (0xFF+1) # Repeat counter of 1-byte, with off-by-one counting 46 | 47 | # CS and ASI Register Address map 48 | UPDI_CS_STATUSA = 0x00 49 | UPDI_CS_STATUSB = 0x01 50 | UPDI_CS_CTRLA = 0x02 51 | UPDI_CS_CTRLB = 0x03 52 | UPDI_ASI_KEY_STATUS = 0x07 53 | UPDI_ASI_RESET_REQ = 0x08 54 | UPDI_ASI_CTRLA = 0x09 55 | UPDI_ASI_SYS_CTRLA = 0x0A 56 | UPDI_ASI_SYS_STATUS = 0x0B 57 | UPDI_ASI_CRC_STATUS = 0x0C 58 | 59 | UPDI_CTRLA_IBDLY_BIT = 7 60 | UPDI_CTRLA_RSD_BIT = 3 61 | 62 | UPDI_CTRLB_CCDETDIS_BIT = 3 63 | UPDI_CTRLB_UPDIDIS_BIT = 2 64 | 65 | UPDI_KEY_NVM = b"NVMProg " 66 | UPDI_KEY_CHIPERASE = b"NVMErase" 67 | UPDI_KEY_UROW = b"NVMUs&te" 68 | 69 | UPDI_ASI_STATUSA_REVID = 4 70 | UPDI_ASI_STATUSB_PESIG = 0 71 | 72 | UPDI_ASI_KEY_STATUS_CHIPERASE = 3 73 | UPDI_ASI_KEY_STATUS_NVMPROG = 4 74 | UPDI_ASI_KEY_STATUS_UROWWRITE = 5 75 | 76 | UPDI_ASI_SYS_STATUS_RSTSYS = 5 77 | UPDI_ASI_SYS_STATUS_INSLEEP = 4 78 | UPDI_ASI_SYS_STATUS_NVMPROG = 3 79 | UPDI_ASI_SYS_STATUS_UROWPROG = 2 80 | UPDI_ASI_SYS_STATUS_LOCKSTATUS = 0 81 | 82 | UPDI_ASI_SYS_CTRLA_UROW_FINAL = 1 83 | 84 | UPDI_RESET_REQ_VALUE = 0x59 85 | -------------------------------------------------------------------------------- /pymcuprog/tests/test_nvmspi.py: -------------------------------------------------------------------------------- 1 | #pylint: disable=too-many-lines 2 | #pylint: disable=too-many-public-methods 3 | #pylint: disable=missing-docstring 4 | 5 | import unittest 6 | from mock import MagicMock 7 | from mock import patch 8 | 9 | from pymcuprog.nvmspi import NvmAccessProviderCmsisDapSpi 10 | 11 | class TestNvmAccessProviderCmsisDapSpi(unittest.TestCase): 12 | def _mock_avrispprotocol(self): 13 | """ 14 | Create a mock of the AvrIspProtocol in pymcuprog.nvmspi 15 | 16 | :returns: Mock of AvrIspProtocol instance 17 | """ 18 | mock_avrispprotocol_patch = patch("pymcuprog.nvmspi.AvrIspProtocol") 19 | self.addCleanup(mock_avrispprotocol_patch.stop) 20 | mock_avrispprotocol = mock_avrispprotocol_patch.start() 21 | mock_avrispprotocol_instance = MagicMock() 22 | mock_avrispprotocol.return_value = mock_avrispprotocol_instance 23 | 24 | return mock_avrispprotocol_instance 25 | 26 | def test_read_device_id_returns_bytearray_with_raw_id(self): 27 | id_expected = bytearray([0x01, 0x02, 0x03]) 28 | mock_avrispprotocol_instance = self._mock_avrispprotocol() 29 | mock_avrispprotocol_instance.get_id.return_value = bytearray([id_expected[2], id_expected[1], id_expected[0]]) 30 | 31 | isp = NvmAccessProviderCmsisDapSpi(None, None) 32 | 33 | id_read = isp.read_device_id() 34 | 35 | self.assertEqual(id_expected, id_read) 36 | 37 | def test_hold_in_reset_does_nothing(self): 38 | mock_avrispprotocol_instance = self._mock_avrispprotocol() 39 | 40 | isp = NvmAccessProviderCmsisDapSpi(None, None) 41 | isp.hold_in_reset() 42 | 43 | mock_avrispprotocol_instance.hold_in_reset.assert_not_called() 44 | 45 | def test_release_from_reset_leaves_progmode(self): 46 | mock_avrispprotocol_instance = self._mock_avrispprotocol() 47 | 48 | isp = NvmAccessProviderCmsisDapSpi(None, None) 49 | isp.release_from_reset() 50 | 51 | mock_avrispprotocol_instance.leave_progmode.assert_called() 52 | -------------------------------------------------------------------------------- /docs/_static/microchip.css: -------------------------------------------------------------------------------- 1 | @import url(basic.css); 2 | 3 | body { 4 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 5 | font-size: 100%; 6 | color: #000; 7 | padding: 0; 8 | margin: 0; 9 | } 10 | 11 | a { 12 | color: #075184; 13 | text-decoration: none; 14 | } 15 | 16 | header { 17 | background-image: url(mchp-brandingelement-rgb2.png); 18 | background-repeat: no-repeat; 19 | background-size: auto 80px; 20 | } 21 | 22 | header div.logo { 23 | max-width: 1200px; 24 | margin: 0 auto; 25 | padding: 10px 0 8px 0; 26 | } 27 | 28 | header div.branding-element img{ 29 | height: 80px; 30 | float: left; 31 | } 32 | 33 | .related-wrapper { 34 | background-color: black; 35 | } 36 | 37 | div.related { 38 | max-width: 1200px; 39 | margin: 0 auto; 40 | color: white; 41 | padding: 8px 0; 42 | font-weight: 600; 43 | } 44 | 45 | div.related a { 46 | color: white; 47 | text-decoration: none; 48 | } 49 | 50 | div.document { 51 | max-width: 1200px; 52 | margin: 0 auto; 53 | 54 | display: flex; 55 | flex-direction: row; 56 | margin: 20px auto 0 auto ; 57 | } 58 | 59 | div.body { 60 | max-width: none; 61 | min-width: none; 62 | padding: 0 10px; 63 | } 64 | 65 | div.sphinxsidebar { 66 | float: none; 67 | width: 230px; 68 | margin-left: 0; 69 | flex-shrink: 0; 70 | } 71 | 72 | div.sphinxsidebar ul { 73 | flex-shrink: 0; 74 | margin: 10px; 75 | padding: 0; 76 | color: black; 77 | } 78 | 79 | div.sphinxsidebar ul ul, 80 | div.sphinxsidebar ul.want-points { 81 | margin-left: 20px; 82 | list-style: square; 83 | } 84 | 85 | .sphinxsidebar a { 86 | text-decoration: none; 87 | color: black; 88 | } 89 | 90 | 91 | .highlight { 92 | background: #e0e0e0; 93 | padding: 6px; 94 | border: 1px solid #bbb; 95 | } 96 | 97 | .footer-wrapper { 98 | background: #333; 99 | } 100 | 101 | .footer { 102 | margin: 0 auto; 103 | color: #c3c3c3; 104 | margin-top: 8px; 105 | padding: 8px; 106 | text-align: center; 107 | } 108 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f13145.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F13145 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f13145', 8 | 'architecture': 'PIC16', 9 | 'device_id': 0x3129, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 8*1024, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_word': 0x8000, 23 | 'user_id_size_words': 4, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 28 | 'user_id_isolated_erase': False, 29 | 30 | # Config words 31 | 'config_words_address_word': 0x8007, 32 | 'config_words_size_words': 5, 33 | 'config_words_page_size_words': 1, 34 | 'config_words_write_size_words': 1, 35 | 'config_words_read_size_words': 1, 36 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 37 | 'config_words_isolated_erase': False, 38 | 39 | # ICD 40 | 'icd_address_word': 0x8600, 41 | 'icd_size_words': 512, 42 | 'icd_page_size_words': 32, 43 | 'icd_write_size_words': 1, 44 | 'icd_read_size_words': 1, 45 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 46 | 'icd_isolated_erase': True, 47 | 48 | # DIA 49 | 'dia_address_word': 0x8100, 50 | 'dia_size_words': 30, 51 | 'dia_page_size_words': 1, 52 | 'dia_write_size_words': 0, 53 | 'dia_read_size_words': 1, 54 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 55 | 'dia_isolated_erase': False, 56 | 57 | # DCI 58 | 'dci_address_word': 0x8200, 59 | 'dci_size_words': 5, 60 | 'dci_page_size_words': 1, 61 | 'dci_write_size_words': 0, 62 | 'dci_read_size_words': 1, 63 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 64 | 'dci_isolated_erase': False, 65 | 66 | } 67 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/generateconfig.py: -------------------------------------------------------------------------------- 1 | """ 2 | Generate drag-and-drop configuration files for PIC devices through device support scripts 3 | 4 | The generated device blob can be used to provide drag and drop programming support for kits with 5 | onboard debuggers 6 | """ 7 | # Python 3 compatibility for Python 2 8 | from __future__ import print_function 9 | 10 | # args, logging 11 | import argparse 12 | import logging 13 | import os 14 | import sys 15 | 16 | from pymcuprog.deviceinfo.configgenerator import ConfigGenerator 17 | 18 | def main(args, loglevel): 19 | """ 20 | Main program 21 | """ 22 | logging.basicConfig(format="%(levelname)s: %(message)s", level=loglevel) 23 | 24 | # Enforce XML output 25 | if args.filename: 26 | if os.path.splitext(args.filename)[1] != '.xml': 27 | print ("Target filename (-f) must be of type .xml") 28 | sys.exit(-1) 29 | 30 | generator = ConfigGenerator() 31 | 32 | generator.load_device_model(args.device, args.packpath) 33 | generator.process_programming_functions() 34 | contents = generator.get_xml_string() 35 | if args.filename: 36 | print(f"Writing to file '{args.filename:s}'") 37 | with open(args.filename, "w", encoding='utf-8') as xmlfile: 38 | xmlfile.write(contents) 39 | else: 40 | print("Config generator output:") 41 | print(contents) 42 | print("Done") 43 | 44 | PARSER = argparse.ArgumentParser(description="Config generator") 45 | 46 | # Device to program 47 | PARSER.add_argument("device", 48 | help="device to use") 49 | 50 | # Pack path 51 | PARSER.add_argument("-p", "--packpath", 52 | type=str, 53 | help="path to pack") 54 | 55 | PARSER.add_argument("-f", "--filename", 56 | type=str, 57 | help="file to write") 58 | 59 | PARSER.add_argument("-v", "--verbose", 60 | help="verbose output", 61 | action="store_true") 62 | 63 | ARGUMENTS = PARSER.parse_args() 64 | 65 | # Setup logging 66 | if ARGUMENTS.verbose: 67 | LOGGING_LEVEL = logging.INFO 68 | else: 69 | LOGGING_LEVEL = logging.WARNING 70 | 71 | main(ARGUMENTS, LOGGING_LEVEL) 72 | -------------------------------------------------------------------------------- /doc/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | import os 14 | import sys 15 | sys.path.insert(0, os.path.abspath('../..')) 16 | 17 | # -- Project information ----------------------------------------------------- 18 | 19 | project = 'pymcuprog' 20 | copyright = '2025, Microchip Technology Inc' 21 | author = 'Microchip Technology Inc' 22 | 23 | 24 | # -- General configuration --------------------------------------------------- 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be 27 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 28 | # ones. 29 | extensions = ['sphinx.ext.autodoc'] 30 | 31 | # Add any paths that contain templates here, relative to this directory. 32 | templates_path = ['_templates'] 33 | 34 | # List of patterns, relative to source directory, that match files and 35 | # directories to ignore when looking for source files. 36 | # This pattern also affects html_static_path and html_extra_path. 37 | exclude_patterns = [] 38 | 39 | # Mock out these objects (note: modules, not packages) 40 | autodoc_mock_imports = ['pyedbglib', 'intelhex', 'appdirs', 'yaml', 'serial'] 41 | 42 | # -- Options for HTML output ------------------------------------------------- 43 | 44 | # The theme to use for HTML and HTML Help pages. See the documentation for 45 | # a list of builtin themes. 46 | # 47 | html_theme = 'Microchip' 48 | html_theme_path = ['../../themes'] 49 | pygments_style = 'default' 50 | 51 | # Add any paths that contain custom static files (such as style sheets) here, 52 | # relative to this directory. They are copied after the builtin static files, 53 | # so a file named "default.css" will overwrite the builtin "default.css". 54 | html_static_path = ['_static'] 55 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/attiny84a.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the ATtiny84A devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'attiny84a', 8 | 'architecture': 'avr8', 9 | 10 | # Flash 11 | 'flash_address_byte': 0, 12 | 'flash_size_bytes': 0x2000, 13 | 'flash_page_size_bytes': 0x40, 14 | 'flash_write_size_bytes': 2, 15 | 'flash_read_size_bytes': 2, 16 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 17 | 'flash_isolated_erase': False, 18 | 19 | # signatures 20 | 'signatures_address_byte': 0, 21 | 'signatures_size_bytes': 3, 22 | 'signatures_page_size_bytes': 1, 23 | 'signatures_read_size_bytes': 1, 24 | 'signatures_write_size_bytes': 0, 25 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 26 | 'signatures_isolated_erase': False, 27 | 28 | # calibration 29 | 'calibration_row_address_byte': 0, 30 | 'calibration_row_size_bytes': 1, 31 | 'calibration_row_page_size_bytes': 1, 32 | 'calibration_row_read_size_bytes': 1, 33 | 'calibration_row_write_size_bytes': 1, 34 | 'calibration_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 35 | 'calibration_row_isolated_erase': False, 36 | 37 | # fuses 38 | 'fuses_address_byte': 0, 39 | 'fuses_size_bytes': 0x0003, 40 | 'fuses_page_size_bytes': 1, 41 | 'fuses_read_size_bytes': 1, 42 | 'fuses_write_size_bytes': 1, 43 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 44 | 'fuses_isolated_erase': False, 45 | 46 | # lockbits 47 | 'lockbits_address_byte': 0, 48 | 'lockbits_size_bytes': 0x0001, 49 | 'lockbits_page_size_bytes': 1, 50 | 'lockbits_write_size_bytes': 1, 51 | 'lockbits_read_size_bytes': 1, 52 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 53 | 'lockbits_isolated_erase': False, 54 | 55 | # eeprom 56 | 'eeprom_address_byte': 0x0000, 57 | 'eeprom_size_bytes': 0x0200, 58 | 'eeprom_page_size_bytes': 0x04, 59 | 'eeprom_read_size_bytes': 1, 60 | 'eeprom_write_size_bytes': 1, 61 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 62 | 'eeprom_isolated_erase': False, 63 | 64 | # Some extra AVR specific fields 65 | 'interface': 'ISP', 66 | 'device_id': 0x1E930C, 67 | } 68 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f15244.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F15244 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f15244', 8 | 'architecture': 'PIC16', 9 | # Will erase Flash, User ID and Config words 10 | 'default_bulk_erase_address_word': 0x8000, 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 4096, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | # This address will erase only flash 19 | 'flash_erase_address_word': 0x80FE, 20 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 21 | 'flash_isolated_erase': True, 22 | 23 | # User ID 24 | 'user_id_address_word': 0x8000, 25 | 'user_id_size_words': 4, 26 | 'user_id_page_size_words': 1, 27 | 'user_id_write_size_words': 1, 28 | 'user_id_read_size_words': 1, 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config words 33 | 'config_words_address_word': 0x8007, 34 | 'config_words_size_words': 5, 35 | 'config_words_page_size_words': 1, 36 | 'config_words_write_size_words': 1, 37 | 'config_words_read_size_words': 1, 38 | 'config_words_erase_address_word': 0, 39 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 40 | 'config_words_isolated_erase': False, 41 | 42 | # ICD 43 | 'icd_address_word': 0x8600, 44 | 'icd_size_words': 512, 45 | 'icd_page_size_words': 32, 46 | 'icd_write_size_words': 1, 47 | 'icd_read_size_words': 1, 48 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 49 | 'icd_isolated_erase': True, 50 | 51 | # DIA 52 | 'dia_address_word': 0x8100, 53 | 'dia_size_words': 27, 54 | 'dia_page_size_words': 1, 55 | 'dia_write_size_words': 0, 56 | 'dia_read_size_words': 1, 57 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 58 | 'dia_isolated_erase': False, 59 | 60 | # DCI 61 | 'dci_address_word': 0x8200, 62 | 'dci_size_words': 5, 63 | 'dci_page_size_words': 1, 64 | 'dci_write_size_words': 0, 65 | 'dci_read_size_words': 1, 66 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 67 | 'dci_isolated_erase': False, 68 | 69 | } 70 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f15376.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F15376 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f15376', 8 | 'architecture': 'PIC16', 9 | # Will erase Flash, User ID and Config words 10 | 'default_bulk_erase_address_word': 0x8000, 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 16384, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | # This address will erase only flash 19 | 'flash_erase_address_word': 0x80FE, 20 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 21 | 'flash_isolated_erase': True, 22 | 23 | 24 | # User ID 25 | 'user_id_address_word': 0x8000, 26 | 'user_id_size_words': 4, 27 | 'user_id_page_size_words': 1, 28 | 'user_id_write_size_words': 1, 29 | 'user_id_read_size_words': 1, 30 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 31 | 'user_id_isolated_erase': False, 32 | 33 | # Config words 34 | 'config_words_address_word': 0x8007, 35 | 'config_words_size_words': 5, 36 | 'config_words_page_size_words': 1, 37 | 'config_words_write_size_words': 1, 38 | 'config_words_read_size_words': 1, 39 | 'config_words_erase_address_word': 0, 40 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 41 | 'config_words_isolated_erase': False, 42 | 43 | # ICD 44 | 'icd_address_word': 0x8600, 45 | 'icd_size_words': 512, 46 | 'icd_page_size_words': 32, 47 | 'icd_write_size_words': 1, 48 | 'icd_read_size_words': 1, 49 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 50 | 'icd_isolated_erase': True, 51 | 52 | # DIA 53 | 'dia_address_word': 0x8100, 54 | 'dia_size_words': 30, 55 | 'dia_page_size_words': 1, 56 | 'dia_write_size_words': 0, 57 | 'dia_read_size_words': 1, 58 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 59 | 'dia_isolated_erase': False, 60 | 61 | # DCI 62 | 'dci_address_word': 0x8200, 63 | 'dci_size_words': 5, 64 | 'dci_page_size_words': 1, 65 | 'dci_write_size_words': 0, 66 | 'dci_read_size_words': 1, 67 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 68 | 'dci_isolated_erase': False, 69 | } 70 | -------------------------------------------------------------------------------- /doc/source/pymcuprog.serialupdi.rst: -------------------------------------------------------------------------------- 1 | pymcuprog.serialupdi package 2 | ============================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | pymcuprog.serialupdi.application module 8 | --------------------------------------- 9 | 10 | .. automodule:: pymcuprog.serialupdi.application 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pymcuprog.serialupdi.constants module 16 | ------------------------------------- 17 | 18 | .. automodule:: pymcuprog.serialupdi.constants 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pymcuprog.serialupdi.link module 24 | -------------------------------- 25 | 26 | .. automodule:: pymcuprog.serialupdi.link 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pymcuprog.serialupdi.nvm module 32 | ------------------------------- 33 | 34 | .. automodule:: pymcuprog.serialupdi.nvm 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | pymcuprog.serialupdi.nvmp0 module 40 | --------------------------------- 41 | 42 | .. automodule:: pymcuprog.serialupdi.nvmp0 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | pymcuprog.serialupdi.nvmp2 module 48 | --------------------------------- 49 | 50 | .. automodule:: pymcuprog.serialupdi.nvmp2 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | pymcuprog.serialupdi.nvmp3 module 56 | --------------------------------- 57 | 58 | .. automodule:: pymcuprog.serialupdi.nvmp3 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | pymcuprog.serialupdi.physical module 64 | ------------------------------------ 65 | 66 | .. automodule:: pymcuprog.serialupdi.physical 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | pymcuprog.serialupdi.readwrite module 72 | ------------------------------------- 73 | 74 | .. automodule:: pymcuprog.serialupdi.readwrite 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | pymcuprog.serialupdi.timeout module 80 | ----------------------------------- 81 | 82 | .. automodule:: pymcuprog.serialupdi.timeout 83 | :members: 84 | :undoc-members: 85 | :show-inheritance: 86 | 87 | Module contents 88 | --------------- 89 | 90 | .. automodule:: pymcuprog.serialupdi 91 | :members: 92 | :undoc-members: 93 | :show-inheritance: 94 | -------------------------------------------------------------------------------- /docs/_sources/pymcuprog.serialupdi.rst.txt: -------------------------------------------------------------------------------- 1 | pymcuprog.serialupdi package 2 | ============================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | pymcuprog.serialupdi.application module 8 | --------------------------------------- 9 | 10 | .. automodule:: pymcuprog.serialupdi.application 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | pymcuprog.serialupdi.constants module 16 | ------------------------------------- 17 | 18 | .. automodule:: pymcuprog.serialupdi.constants 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | pymcuprog.serialupdi.link module 24 | -------------------------------- 25 | 26 | .. automodule:: pymcuprog.serialupdi.link 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | pymcuprog.serialupdi.nvm module 32 | ------------------------------- 33 | 34 | .. automodule:: pymcuprog.serialupdi.nvm 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | pymcuprog.serialupdi.nvmp0 module 40 | --------------------------------- 41 | 42 | .. automodule:: pymcuprog.serialupdi.nvmp0 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | pymcuprog.serialupdi.nvmp2 module 48 | --------------------------------- 49 | 50 | .. automodule:: pymcuprog.serialupdi.nvmp2 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | pymcuprog.serialupdi.nvmp3 module 56 | --------------------------------- 57 | 58 | .. automodule:: pymcuprog.serialupdi.nvmp3 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | pymcuprog.serialupdi.physical module 64 | ------------------------------------ 65 | 66 | .. automodule:: pymcuprog.serialupdi.physical 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | pymcuprog.serialupdi.readwrite module 72 | ------------------------------------- 73 | 74 | .. automodule:: pymcuprog.serialupdi.readwrite 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | pymcuprog.serialupdi.timeout module 80 | ----------------------------------- 81 | 82 | .. automodule:: pymcuprog.serialupdi.timeout 83 | :members: 84 | :undoc-members: 85 | :show-inheritance: 86 | 87 | Module contents 88 | --------------- 89 | 90 | .. automodule:: pymcuprog.serialupdi 91 | :members: 92 | :undoc-members: 93 | :show-inheritance: 94 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f47k42.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F47K42 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f47k42', 8 | 'architecture': 'PIC18', 9 | # Will erase Flash, User ID, Config words and EEPROM (if CPD_bar config bit is disabled) 10 | 'default_bulk_erase_address_byte': 0x300000, 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 128*1024, # 128KB 15 | 'flash_page_size_bytes': 128, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_byte': 0x200000, 23 | 'user_id_size_words': 8, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_erase_address_byte': 0x300000, 28 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 29 | 'user_id_isolated_erase': False, 30 | 31 | # Config words 32 | 'config_words_address_byte': 0x300000, 33 | 'config_words_size_words': 5, 34 | 'config_words_page_size_words': 1, 35 | 'config_words_write_size_words': 1, 36 | 'config_words_read_size_words': 1, 37 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 38 | 'config_words_isolated_erase': False, 39 | 40 | # EEPROM 41 | 'eeprom_address_byte': 0x310000, 42 | 'eeprom_size_bytes': 1024, 43 | 'eeprom_page_size_bytes': 1, 44 | 'eeprom_write_size_bytes': 1, 45 | 'eeprom_read_size_bytes': 1, 46 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_PIC, 47 | 'eeprom_isolated_erase': True, 48 | 49 | # DIA 50 | 'dia_address_byte': 0x3F0000, 51 | 'dia_size_bytes': 60, 52 | 'dia_page_size_bytes': 1, 53 | 'dia_write_size_bytes': 0, 54 | 'dia_read_size_bytes': 1, 55 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 56 | 'dia_isolated_erase': False, 57 | 58 | # DCI 59 | 'dci_address_byte': 0x3FFF00, 60 | 'dci_size_bytes': 10, 61 | 'dci_page_size_bytes': 1, 62 | 'dci_write_size_bytes': 0, 63 | 'dci_read_size_bytes': 1, 64 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 65 | 'dci_isolated_erase': False, 66 | } 67 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16lf18456.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16LF18456 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16lf18456', 8 | 'architecture': 'PIC16', 9 | # Will erase Flash, User ID and Config words 10 | 'default_bulk_erase_address_word': 0x8000, 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 16384, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | # This address will erase only flash 19 | 'flash_erase_address_word': 0x80FE, 20 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 21 | 'flash_isolated_erase': True, 22 | 23 | # User ID 24 | 'user_id_address_word': 0x8000, 25 | 'user_id_size_words': 4, 26 | 'user_id_page_size_words': 1, 27 | 'user_id_write_size_words': 1, 28 | 'user_id_read_size_words': 1, 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config words 33 | 'config_words_address_word': 0x8007, 34 | 'config_words_size_words': 5, 35 | 'config_words_page_size_words': 1, 36 | 'config_words_write_size_words': 1, 37 | 'config_words_read_size_words': 1, 38 | 'config_words_erase_address_word': 0, 39 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 40 | 'config_words_isolated_erase': False, 41 | 42 | # EEPROM 43 | 'eeprom_address_word': 0xF000, 44 | 'eeprom_size_bytes': 256, 45 | 'eeprom_page_size_words': 1, 46 | 'eeprom_write_size_words': 1, 47 | 'eeprom_read_size_words': 1, 48 | 'eeprom_chiperase_effect': ChiperaseEffect.NOT_ERASED, 49 | 'eeprom_isolated_erase': False, 50 | 51 | # DIA 52 | 'dia_address_word': 0x8100, 53 | 'dia_size_words': 30, 54 | 'dia_page_size_words': 1, 55 | 'dia_write_size_words': 0, 56 | 'dia_read_size_words': 1, 57 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 58 | 'dia_isolated_erase': False, 59 | 60 | # DCI 61 | 'dci_address_word': 0x8200, 62 | 'dci_size_words': 5, 63 | 'dci_page_size_words': 1, 64 | 'dci_write_size_words': 0, 65 | 'dci_read_size_words': 1, 66 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 67 | 'dci_isolated_erase': False, 68 | } 69 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f15276.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F15276 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f15276', 8 | 'architecture': 'PIC16', 9 | 'device_id': 0x30EC, 10 | # Will erase Flash, User ID and Config words 11 | 'default_bulk_erase_address_word': 0x8000, 12 | 13 | # Flash 14 | 'flash_address_word': 0, 15 | 'flash_size_words': 16*1024, 16 | 'flash_page_size_words': 32, 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | # This address will erase only flash 20 | 'flash_erase_address_word': 0x80FE, 21 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 22 | 'flash_isolated_erase': True, 23 | 24 | # User ID 25 | 'user_id_address_word': 0x8000, 26 | 'user_id_size_words': 4, 27 | 'user_id_page_size_words': 1, 28 | 'user_id_write_size_words': 1, 29 | 'user_id_read_size_words': 1, 30 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 31 | 'user_id_isolated_erase': False, 32 | 33 | # Config words 34 | 'config_words_address_word': 0x8007, 35 | 'config_words_size_words': 5, 36 | 'config_words_page_size_words': 1, 37 | 'config_words_write_size_words': 1, 38 | 'config_words_read_size_words': 1, 39 | 'config_words_erase_address_word': 0, 40 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 41 | 'config_words_isolated_erase': False, 42 | 43 | # ICD 44 | 'icd_address_word': 0x8600, 45 | 'icd_size_words': 512, 46 | 'icd_page_size_words': 32, 47 | 'icd_write_size_words': 1, 48 | 'icd_read_size_words': 1, 49 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 50 | 'icd_isolated_erase': True, 51 | 52 | # DIA 53 | 'dia_address_word': 0x8100, 54 | 'dia_size_words': 27, 55 | 'dia_page_size_words': 1, 56 | 'dia_write_size_words': 0, 57 | 'dia_read_size_words': 1, 58 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 59 | 'dia_isolated_erase': False, 60 | 61 | # DCI 62 | 'dci_address_word': 0x8200, 63 | 'dci_size_words': 5, 64 | 'dci_page_size_words': 1, 65 | 'dci_write_size_words': 0, 66 | 'dci_read_size_words': 1, 67 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 68 | 'dci_isolated_erase': False, 69 | } 70 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f18456.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F18456 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f18456', 8 | 'architecture': 'PIC16', 9 | # Will erase Flash, User ID and Config words 10 | 'default_bulk_erase_address_word': 0x8000, 11 | 12 | 13 | # Flash 14 | 'flash_address_word': 0, 15 | 'flash_size_words': 16384, 16 | 'flash_page_size_words': 32, 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | # This address will erase only flash 20 | 'flash_erase_address_word': 0x80FE, 21 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 22 | 'flash_isolated_erase': True, 23 | 24 | # User ID 25 | 'user_id_address_word': 0x8000, 26 | 'user_id_size_words': 4, 27 | 'user_id_page_size_words': 1, 28 | 'user_id_write_size_words': 1, 29 | 'user_id_read_size_words': 1, 30 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 31 | 'user_id_isolated_erase': False, 32 | 33 | # Config words 34 | 'config_words_address_word': 0x8007, 35 | 'config_words_size_words': 5, 36 | 'config_words_page_size_words': 1, 37 | 'config_words_write_size_words': 1, 38 | 'config_words_read_size_words': 1, 39 | 'config_words_erase_address_word': 0, 40 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 41 | 'config_words_isolated_erase': False, 42 | 43 | # EEPROM 44 | 'eeprom_address_word': 0xF000, 45 | 'eeprom_size_bytes': 256, 46 | 'eeprom_page_size_words': 1, 47 | 'eeprom_write_size_words': 1, 48 | 'eeprom_read_size_words': 1, 49 | 'eeprom_chiperase_effect': ChiperaseEffect.NOT_ERASED, 50 | 'eeprom_isolated_erase': False, 51 | 52 | # DIA 53 | 'dia_address_word': 0x8100, 54 | 'dia_size_words': 30, 55 | 'dia_page_size_words': 1, 56 | 'dia_write_size_words': 0, 57 | 'dia_read_size_words': 1, 58 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 59 | 'dia_isolated_erase': False, 60 | 61 | # DCI 62 | 'dci_address_word': 0x8200, 63 | 'dci_size_words': 5, 64 | 'dci_page_size_words': 1, 65 | 'dci_write_size_words': 0, 66 | 'dci_read_size_words': 1, 67 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 68 | 'dci_isolated_erase': False, 69 | } 70 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/atmega328p.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the ATmega328P device 3 | Note: this model is incomplete and is for Microchip internal regression test purposes only 4 | """ 5 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 6 | 7 | DEVICE_INFO = { 8 | 'name': 'atmega328p', 9 | 'architecture': 'avr8', 10 | 11 | # Flash 12 | 'flash_address_byte': 0, 13 | 'flash_size_bytes': 0x8000, 14 | 'flash_page_size_bytes': 0x80, 15 | 'flash_write_size_bytes': 0x80, 16 | 'flash_read_size_bytes': 0x80, 17 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 18 | 'flash_isolated_erase': False, 19 | 20 | # signatures 21 | 'signatures_address_byte': 0, 22 | 'signatures_size_bytes': 3, 23 | 'signatures_page_size_bytes': 1, 24 | 'signatures_read_size_bytes': 1, 25 | 'signatures_write_size_bytes': 0, 26 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 27 | 'signatures_isolated_erase': False, 28 | 29 | # calibration 30 | 'calibration_row_address_byte': 0, 31 | 'calibration_row_size_bytes': 1, 32 | 'calibration_row_page_size_bytes': 1, 33 | 'calibration_row_read_size_bytes': 1, 34 | 'calibration_row_write_size_bytes': 1, 35 | 'calibration_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 36 | 'calibration_row_isolated_erase': False, 37 | 38 | # fuses 39 | 'fuses_address_byte': 0, 40 | 'fuses_size_bytes': 0x0003, 41 | 'fuses_page_size_bytes': 1, 42 | 'fuses_read_size_bytes': 1, 43 | 'fuses_write_size_bytes': 1, 44 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 45 | 'fuses_isolated_erase': False, 46 | 47 | # lockbits 48 | 'lockbits_address_byte': 0, 49 | 'lockbits_size_bytes': 0x0001, 50 | 'lockbits_page_size_bytes': 1, 51 | 'lockbits_write_size_bytes': 1, 52 | 'lockbits_read_size_bytes': 1, 53 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 54 | 'lockbits_isolated_erase': False, 55 | 56 | # eeprom 57 | 'eeprom_address_byte': 0x0000, 58 | 'eeprom_size_bytes': 0x0400, 59 | 'eeprom_page_size_bytes': 0x04, 60 | 'eeprom_read_size_bytes': 1, 61 | 'eeprom_write_size_bytes': 1, 62 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 63 | 'eeprom_isolated_erase': False, 64 | 65 | # Some extra AVR specific fields 66 | 'interface': 'ISP+DW', 67 | 'device_id': 0x1E950F, 68 | } 69 | -------------------------------------------------------------------------------- /pymcuprog/serialupdi/nvm.py: -------------------------------------------------------------------------------- 1 | """ 2 | NVM implementations on various UPDI device families 3 | """ 4 | from logging import getLogger 5 | 6 | class NvmUpdi(object): 7 | """ 8 | Base class for NVM 9 | """ 10 | def __init__(self, readwrite, device): 11 | self.logger = getLogger(__name__) 12 | self.readwrite = readwrite 13 | self.device = device 14 | 15 | def chip_erase(self): 16 | """ 17 | Does a chip erase using the NVM controller 18 | """ 19 | raise NotImplementedError("NVM stack not ready") 20 | 21 | def erase_flash_page(self, address): 22 | """ 23 | Erasing single flash page using the NVM controller 24 | 25 | :param address: Start address of page to erase 26 | :type address: int 27 | """ 28 | raise NotImplementedError("NVM stack not ready") 29 | 30 | def erase_eeprom(self): 31 | """ 32 | Erase EEPROM memory only 33 | """ 34 | raise NotImplementedError("NVM stack not ready") 35 | 36 | def erase_user_row(self, address, size): 37 | """ 38 | Erase User Row memory only 39 | 40 | :param address: Start address of user row 41 | :type address: int 42 | :param size: Size of user row 43 | :type size: int 44 | """ 45 | raise NotImplementedError("NVM stack not ready") 46 | 47 | def write_flash(self, address, data): 48 | """ 49 | Writes data to flash 50 | 51 | :param address: address to write to 52 | :param data: data to write 53 | """ 54 | raise NotImplementedError("NVM stack not ready") 55 | 56 | def write_user_row(self, address, data): 57 | """ 58 | Writes data to user row 59 | 60 | :param address: address to write to 61 | :param data: data to write 62 | """ 63 | raise NotImplementedError("NVM stack not ready") 64 | 65 | def write_eeprom(self, address, data): 66 | """ 67 | Write data to EEPROM 68 | 69 | :param address: address to write to 70 | :param data: data to write 71 | """ 72 | raise NotImplementedError("NVM stack not ready") 73 | 74 | def write_fuse(self, address, data): 75 | """ 76 | Writes one fuse value 77 | 78 | :param address: address to write to 79 | :param data: data to write 80 | """ 81 | raise NotImplementedError("NVM stack not ready") 82 | -------------------------------------------------------------------------------- /pymcuprog/tests/test_nvmpic.py: -------------------------------------------------------------------------------- 1 | # The intention is to make the test names descriptive enough to not need any docstrings for most of them 2 | #pylint: disable=missing-docstring 3 | # It seems better to have all tests for one module in the same file than to split across multiple files, 4 | # so accepting many public methods and many lines makes sense 5 | #pylint: disable=too-many-lines 6 | #pylint: disable=too-many-public-methods 7 | import sys 8 | import unittest 9 | from mock import MagicMock 10 | 11 | from pymcuprog.nvmpic import NvmAccessProviderCmsisDapPic 12 | from pymcuprog.deviceinfo.deviceinfokeys import DeviceInfoKeys 13 | 14 | class TestNvmAccessProviderCmsisDapPic(unittest.TestCase): 15 | 16 | @staticmethod 17 | def _mock_pic_model(): 18 | """ 19 | Create a mock for the device support scripts debugger model 20 | 21 | :returns: Mock object of the device model instance 22 | """ 23 | # Mock out the debugprovider 24 | sys.modules['common.debugprovider'] = MagicMock() 25 | 26 | # Create the mock for provide_debugger_model, 27 | # this will be the same mock that will be imported by the module under test. 28 | from common.debugprovider import provide_debugger_model # pylint: disable=import-error, import-outside-toplevel 29 | 30 | mock_pic_model = provide_debugger_model.return_value 31 | 32 | return mock_pic_model 33 | 34 | 35 | def test_read_device_id_returns_bytearray_with_raw_id(self): 36 | id_expected = bytearray([0x01, 0x02]) 37 | 38 | mock_pic_model = self._mock_pic_model() 39 | mock_pic_model.read_id.return_value = id_expected[0] + (id_expected[1] << 8) 40 | 41 | pic = NvmAccessProviderCmsisDapPic(None, {DeviceInfoKeys.NAME: 'pic'}, '') 42 | 43 | id_read = pic.read_device_id() 44 | 45 | self.assertEqual(id_expected, id_read) 46 | 47 | def test_hold_in_reset_propagates(self): 48 | mock_pic_model = self._mock_pic_model() 49 | 50 | pic = NvmAccessProviderCmsisDapPic(None, {DeviceInfoKeys.NAME: 'pic'}, '') 51 | pic.hold_in_reset() 52 | 53 | mock_pic_model.hold_in_reset.assert_called() 54 | 55 | def test_release_from_reset_propagates(self): 56 | mock_pic_model = self._mock_pic_model() 57 | 58 | pic = NvmAccessProviderCmsisDapPic(None, {DeviceInfoKeys.NAME: 'pic'}, '') 59 | pic.release_from_reset() 60 | 61 | mock_pic_model.release_from_reset.assert_called() 62 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f18076.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F18076 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f18076', 8 | 'architecture': 'PIC16', 9 | 'device_id': 0x3100, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 16*1024, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_word': 0x8000, 23 | 'user_id_size_words': 4, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 28 | 'user_id_isolated_erase': False, 29 | 30 | # Config words 31 | 'config_words_address_word': 0x8007, 32 | 'config_words_size_words': 5, 33 | 'config_words_page_size_words': 1, 34 | 'config_words_write_size_words': 1, 35 | 'config_words_read_size_words': 1, 36 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 37 | 'config_words_isolated_erase': False, 38 | 39 | # EEPROM 40 | 'eeprom_address_word': 0xF000, 41 | 'eeprom_size_bytes': 256, 42 | 'eeprom_page_size_bytes': 1, 43 | 'eeprom_write_size_bytes': 1, 44 | 'eeprom_read_size_bytes': 1, 45 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 46 | 'eeprom_isolated_erase': False, 47 | 48 | # ICD 49 | 'icd_address_word': 0x8600, 50 | 'icd_size_words': 512, 51 | 'icd_page_size_words': 32, 52 | 'icd_write_size_words': 1, 53 | 'icd_read_size_words': 1, 54 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 55 | 'icd_isolated_erase': True, 56 | 57 | # DIA 58 | 'dia_address_word': 0x8100, 59 | 'dia_size_words': 30, 60 | 'dia_page_size_words': 1, 61 | 'dia_write_size_words': 0, 62 | 'dia_read_size_words': 1, 63 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 64 | 'dia_isolated_erase': False, 65 | 66 | # DCI 67 | 'dci_address_word': 0x8200, 68 | 'dci_size_words': 5, 69 | 'dci_page_size_words': 1, 70 | 'dci_write_size_words': 0, 71 | 'dci_read_size_words': 1, 72 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 73 | 'dci_isolated_erase': False, 74 | } 75 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f18146.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F18146 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f18146', 8 | 'architecture': 'PIC16', 9 | 'device_id': 0x3112, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 16*1024, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_word': 0x8000, 23 | 'user_id_size_words': 4, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 28 | 'user_id_isolated_erase': False, 29 | 30 | # Config words 31 | 'config_words_address_word': 0x8007, 32 | 'config_words_size_words': 5, 33 | 'config_words_page_size_words': 1, 34 | 'config_words_write_size_words': 1, 35 | 'config_words_read_size_words': 1, 36 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 37 | 'config_words_isolated_erase': False, 38 | 39 | # EEPROM 40 | 'eeprom_address_word': 0xF000, 41 | 'eeprom_size_bytes': 256, 42 | 'eeprom_page_size_bytes': 1, 43 | 'eeprom_write_size_bytes': 1, 44 | 'eeprom_read_size_bytes': 1, 45 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 46 | 'eeprom_isolated_erase': False, 47 | 48 | # ICD 49 | 'icd_address_word': 0x8600, 50 | 'icd_size_words': 512, 51 | 'icd_page_size_words': 32, 52 | 'icd_write_size_words': 1, 53 | 'icd_read_size_words': 1, 54 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 55 | 'icd_isolated_erase': True, 56 | 57 | # DIA 58 | 'dia_address_word': 0x8100, 59 | 'dia_size_words': 30, 60 | 'dia_page_size_words': 1, 61 | 'dia_write_size_words': 0, 62 | 'dia_read_size_words': 1, 63 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 64 | 'dia_isolated_erase': False, 65 | 66 | # DCI 67 | 'dci_address_word': 0x8200, 68 | 'dci_size_words': 5, 69 | 'dci_page_size_words': 1, 70 | 'dci_write_size_words': 0, 71 | 'dci_read_size_words': 1, 72 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 73 | 'dci_isolated_erase': False, 74 | } 75 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f17146.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F17146 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f17146', 8 | 'architecture': 'PIC16', 9 | 'device_id': 0x30E1, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 16*1024, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_word': 0x8000, 23 | 'user_id_size_words': 4, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 28 | 'user_id_isolated_erase': False, 29 | 30 | # Config words 31 | 'config_words_address_word': 0x8007, 32 | 'config_words_size_words': 5, 33 | 'config_words_page_size_words': 1, 34 | 'config_words_write_size_words': 1, 35 | 'config_words_read_size_words': 1, 36 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 37 | 'config_words_isolated_erase': False, 38 | 39 | # EEPROM 40 | 'eeprom_address_word': 0xF000, 41 | 'eeprom_size_bytes': 256, 42 | 'eeprom_page_size_bytes': 1, 43 | 'eeprom_write_size_bytes': 1, 44 | 'eeprom_read_size_bytes': 1, 45 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 46 | 'eeprom_isolated_erase': False, 47 | 48 | # ICD 49 | 'icd_address_word': 0x8600, 50 | 'icd_size_words': 512, 51 | 'icd_page_size_words': 32, 52 | 'icd_write_size_words': 1, 53 | 'icd_read_size_words': 1, 54 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 55 | 'icd_isolated_erase': True, 56 | 57 | # DIA 58 | 'dia_address_word': 0x8100, 59 | 'dia_size_words': 30, 60 | 'dia_page_size_words': 1, 61 | 'dia_write_size_words': 0, 62 | 'dia_read_size_words': 1, 63 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 64 | 'dia_isolated_erase': False, 65 | 66 | # DCI 67 | 'dci_address_word': 0x8200, 68 | 'dci_size_words': 5, 69 | 'dci_page_size_words': 1, 70 | 'dci_write_size_words': 0, 71 | 'dci_read_size_words': 1, 72 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 73 | 'dci_isolated_erase': False, 74 | 75 | } 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f17556.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F17556 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f17556', 8 | 'architecture': 'PIC16', 9 | 'device_id': 0x311F, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 16*1024, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 32, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_word': 0x8000, 23 | 'user_id_size_words': 4, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 28 | 'user_id_isolated_erase': False, 29 | 30 | # Config words 31 | 'config_words_address_word': 0x8007, 32 | 'config_words_size_words': 5, 33 | 'config_words_page_size_words': 1, 34 | 'config_words_write_size_words': 1, 35 | 'config_words_read_size_words': 1, 36 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 37 | 'config_words_isolated_erase': False, 38 | 39 | # EEPROM 40 | 'eeprom_address_word': 0xF000, 41 | 'eeprom_size_bytes': 256, 42 | 'eeprom_page_size_bytes': 1, 43 | 'eeprom_write_size_bytes': 1, 44 | 'eeprom_read_size_bytes': 1, 45 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 46 | 'eeprom_isolated_erase': False, 47 | 48 | # ICD 49 | 'icd_address_word': 0x8600, 50 | 'icd_size_words': 512, 51 | 'icd_page_size_words': 32, 52 | 'icd_write_size_words': 32, 53 | 'icd_read_size_words': 1, 54 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 55 | 'icd_isolated_erase': True, 56 | 57 | # DIA 58 | 'dia_address_word': 0x8100, 59 | 'dia_size_words': 30, 60 | 'dia_page_size_words': 1, 61 | 'dia_write_size_words': 0, 62 | 'dia_read_size_words': 1, 63 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 64 | 'dia_isolated_erase': False, 65 | 66 | # DCI 67 | 'dci_address_word': 0x8200, 68 | 'dci_size_words': 5, 69 | 'dci_page_size_words': 1, 70 | 'dci_write_size_words': 0, 71 | 'dci_read_size_words': 1, 72 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 73 | 'dci_isolated_erase': False, 74 | 75 | } 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f17576.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F17576 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f17576', 8 | 'architecture': 'PIC16', 9 | 'device_id': 0x3120, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 16*1024, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 32, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_word': 0x8000, 23 | 'user_id_size_words': 4, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 28 | 'user_id_isolated_erase': False, 29 | 30 | # Config words 31 | 'config_words_address_word': 0x8007, 32 | 'config_words_size_words': 5, 33 | 'config_words_page_size_words': 1, 34 | 'config_words_write_size_words': 1, 35 | 'config_words_read_size_words': 1, 36 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 37 | 'config_words_isolated_erase': False, 38 | 39 | # EEPROM 40 | 'eeprom_address_word': 0xF000, 41 | 'eeprom_size_bytes': 256, 42 | 'eeprom_page_size_bytes': 1, 43 | 'eeprom_write_size_bytes': 1, 44 | 'eeprom_read_size_bytes': 1, 45 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 46 | 'eeprom_isolated_erase': False, 47 | 48 | # ICD 49 | 'icd_address_word': 0x8600, 50 | 'icd_size_words': 512, 51 | 'icd_page_size_words': 32, 52 | 'icd_write_size_words': 32, 53 | 'icd_read_size_words': 1, 54 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 55 | 'icd_isolated_erase': True, 56 | 57 | # DIA 58 | 'dia_address_word': 0x8100, 59 | 'dia_size_words': 30, 60 | 'dia_page_size_words': 1, 61 | 'dia_write_size_words': 0, 62 | 'dia_read_size_words': 1, 63 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 64 | 'dia_isolated_erase': False, 65 | 66 | # DCI 67 | 'dci_address_word': 0x8200, 68 | 'dci_size_words': 5, 69 | 'dci_page_size_words': 1, 70 | 'dci_write_size_words': 0, 71 | 'dci_read_size_words': 1, 72 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 73 | 'dci_isolated_erase': False, 74 | 75 | } 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /pymcuprog/tests/cmsisupdi_test_with_hardware.py: -------------------------------------------------------------------------------- 1 | """ 2 | Test for UPDI over CMSIS-DAP 3 | 4 | Requires an UPDI device with at least 1k flash and 64b EEPROM 5 | """ 6 | import os 7 | from random import randint 8 | from intelhex import IntelHex 9 | # import pytest 10 | 11 | FLASHSIZE = 1 * 1024 12 | EEPROMSIZE = 64 13 | USERROWSIZE = 32 14 | TESTFILE = "testtemp.hex" 15 | 16 | 17 | def do_cli_test(teststring): 18 | """ 19 | Executes a CLI command directly on the OS 20 | """ 21 | retcode = os.system(teststring) 22 | if retcode != 0: 23 | raise Exception("Failed!") 24 | 25 | 26 | def generate_test_hexfile(filename, size): 27 | """ 28 | Generates a random hex file 29 | 30 | :param filename: location and name to generate 31 | :param size: number of bytes of data 32 | """ 33 | hexfile = IntelHex() 34 | # Add some data to the hexfile 35 | for i in range(size): 36 | hexfile[i] = randint(0, 255) 37 | # Turn the hexfile object into an actual file 38 | hexfile.write_hex_file(filename) 39 | 40 | 41 | def test_cli(tmpdir, capfd): 42 | """ 43 | Runs the test suite 44 | """ 45 | test_filename = os.path.normpath(tmpdir + '/' + TESTFILE) 46 | 47 | do_cli_test("python pymcuprog.py ping") 48 | assert "Ping response: 1E" in capfd.readouterr().out 49 | 50 | do_cli_test("python pymcuprog.py erase -m eeprom") 51 | assert "Erasing eeprom\r\nErased" in capfd.readouterr().out 52 | 53 | do_cli_test("python pymcuprog.py read -m eeprom -b {} -o 0".format(EEPROMSIZE)) 54 | assert "0x0000: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" in capfd.readouterr().out 55 | 56 | do_cli_test("python pymcuprog.py erase -m user_row") 57 | assert "Erasing user_row\r\nErased" in capfd.readouterr().out 58 | 59 | do_cli_test("python pymcuprog.py read -m user_row -b {} -o 0".format(USERROWSIZE)) 60 | assert "0x0000: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF" in capfd.readouterr().out 61 | 62 | do_cli_test("python pymcuprog.py erase") 63 | assert "Erasing...\r\nErased" in capfd.readouterr().out 64 | 65 | generate_test_hexfile(test_filename, FLASHSIZE) 66 | do_cli_test("python pymcuprog.py write -f {}".format(test_filename)) 67 | assert "Writing...\r\nReading...\r\nVerifying...\r\nOK" in capfd.readouterr().out 68 | 69 | generate_test_hexfile(test_filename, EEPROMSIZE) 70 | do_cli_test("python pymcuprog.py write -m eeprom -f {}".format(test_filename)) 71 | assert "Writing...\r\nReading...\r\nVerifying...\r\nOK" in capfd.readouterr().out 72 | -------------------------------------------------------------------------------- /pymcuprog/nvmtpi.py: -------------------------------------------------------------------------------- 1 | """ 2 | TPI/tinytiny NVM implementation 3 | NB: This is a stub - not all features are implemented 4 | """ 5 | from pyedbglib.util import binary 6 | from pyedbglib.protocols.tpiprotocol import TpiProtocol 7 | from .nvm import NvmAccessProviderCmsisDapAvr 8 | 9 | class NvmAccessProviderCmsisDapTpi(NvmAccessProviderCmsisDapAvr): 10 | """ 11 | NVM Access the TPI way 12 | """ 13 | 14 | def __init__(self, transport, device_info): 15 | NvmAccessProviderCmsisDapAvr.__init__(self, device_info) 16 | 17 | self._log_incomplete_stack('AVR-TPI') 18 | self.avr = TpiProtocol(transport) 19 | self.avr.enter_progmode() 20 | 21 | def __del__(self): 22 | pass 23 | 24 | def stop(self): 25 | """ 26 | Stop programming session 27 | """ 28 | self.logger.info("TPI-specific de-initialiser") 29 | self.avr.leave_progmode() 30 | 31 | def read_device_id(self): 32 | """ 33 | Read the device ID 34 | 35 | :returns: Device ID raw bytes (little endian) 36 | """ 37 | sig = self.avr.read_memory(TpiProtocol.XPRG_MEM_TYPE_APPL, 0x3FC0, 3) 38 | device_id_read = binary.unpack_be24(sig) 39 | self.logger.info("Device ID: '%06X'", device_id_read) 40 | return bytearray([sig[2], sig[1], sig[0]]) 41 | 42 | def erase(self, memory_info=None, address=None): 43 | """ 44 | Do a chip erase of the device 45 | """ 46 | _dummy = memory_info 47 | _dummy = address 48 | raise NotImplementedError("NVM erase is not supported for TPI stack") 49 | 50 | @staticmethod 51 | def write(memory_info, offset, data): 52 | """ 53 | Write the memory with data 54 | 55 | :param memory_info: dictionary for the memory as provided by the DeviceMemoryInfo class 56 | :param offset: relative offset within the memory type 57 | :param data: the data to program 58 | """ 59 | _dummy = memory_info 60 | _dummy = offset 61 | _dummy = data 62 | raise NotImplementedError("NVM write is not supported for TPI stack") 63 | 64 | def read(self, memory_info, offset, numbytes): 65 | """ 66 | Read the memory in chunks 67 | 68 | :param memory_info: dictionary for the memory as provided by the DeviceMemoryInfo class 69 | :param offset: relative offset in the memory type 70 | :param numbytes: number of bytes to read 71 | :return: array of bytes read 72 | """ 73 | raise NotImplementedError("NVM read is not supported for TPI stack") 74 | -------------------------------------------------------------------------------- /pymcuprog/nvmavr32.py: -------------------------------------------------------------------------------- 1 | """ 2 | AVR32 NVM implementation 3 | NB: This is a stub - not all features are implemented 4 | """ 5 | from abc import abstractmethod 6 | 7 | from .nvm import NvmAccessProviderCmsisDapAvr 8 | from .avr32target import Avr32Device 9 | from .pymcuprog_errors import PymcuprogError 10 | from .deviceinfo.deviceinfokeys import DeviceInfoKeysAvr32 11 | 12 | class NvmAccessProviderCmsisDapAvr32(NvmAccessProviderCmsisDapAvr): 13 | """ 14 | AVR32 programmer 15 | """ 16 | 17 | def __init__(self, transport, device_info, interface="jtag"): 18 | NvmAccessProviderCmsisDapAvr.__init__(self, device_info) 19 | 20 | self._log_incomplete_stack('AVR32') 21 | 22 | if DeviceInfoKeysAvr32.RESET_DOMAINS in device_info: 23 | self.avr = Avr32Device(transport, device_info[DeviceInfoKeysAvr32.RESET_DOMAINS]) 24 | else: 25 | self.avr = Avr32Device(transport) 26 | self.avr.setup_prog_session(interface) 27 | 28 | def __del__(self): 29 | pass 30 | 31 | def read_device_id(self): 32 | """ 33 | Read the device info 34 | 35 | :returns: Device ID raw bytes (little endian) 36 | """ 37 | resp = self.avr.activate_physical() 38 | self.logger.info("JTAG ID read: %02X%02X%02X%02X", resp[3], resp[2], resp[1], resp[0]) 39 | self.avr.deactivate_physical() 40 | return bytearray(resp[0:4]) 41 | 42 | @abstractmethod 43 | def read(self, memory_info, offset, numbytes): 44 | """ 45 | Read the memory in chunks 46 | 47 | :param memory_info: dictionary for the memory as provided by the DeviceMemoryInfo class 48 | :param offset: relative offset in the memory type 49 | :param numbytes: number of bytes to read 50 | :return: array of bytes read 51 | """ 52 | raise PymcuprogError("Implement read") 53 | 54 | @abstractmethod 55 | def write(self, memory_info, offset, data): 56 | """ 57 | Write the memory with data 58 | 59 | :param memory_info: dictionary for the memory as provided by the DeviceMemoryInfo class 60 | :param offset: relative offset within the memory type 61 | :param data: the data to program 62 | """ 63 | raise PymcuprogError("Implement write") 64 | 65 | @abstractmethod 66 | def erase(self, memory_info=None, address=None): 67 | """ 68 | Do an erase of the device 69 | """ 70 | raise PymcuprogError("Implement erase") 71 | 72 | def stop(self): 73 | """ 74 | Stop programming session 75 | """ 76 | return 77 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | # All this infomation could be moved into pyproject.toml (from setuptools major version 61), 2 | # but setup.cfg is used for backwards compatibility with pyhton 2.7 (which is only supported by setuptools major version 44 and older) 3 | [metadata] 4 | name = pymcuprog 5 | # Get version from package source (__version__ variable in __init__.py) 6 | version = attr: pymcuprog.__version__ 7 | author = Microchip Technology 8 | author_email = support@microchip.com 9 | description = Tools for programming of MCUs using Microchip CMSIS-DAP based debuggers 10 | long_description = file: pypi.md, CHANGELOG.md 11 | long_description_content_type = text/markdown 12 | license = MIT 13 | keywords = Microchip, nEDBG, Curiosity Nano, PKOB nano, debugger 14 | classifiers = 15 | Development Status :: 5 - Production/Stable 16 | Intended Audience :: Developers 17 | Topic :: Software Development :: Embedded Systems 18 | # Note that Python 2.7 support is intentionally left out here as Python 2.7 support is only for internal use, 19 | # and is not tested before release, so it is not advertised externally 20 | Programming Language :: Python :: 3 21 | Programming Language :: Python :: 3.9 22 | Programming Language :: Python :: 3.10 23 | Programming Language :: Python :: 3.11 24 | Programming Language :: Python :: 3.12 25 | Programming Language :: Python :: 3.13 26 | Operating System :: Microsoft :: Windows 27 | Operating System :: POSIX :: Linux 28 | Operating System :: MacOS 29 | License :: OSI Approved :: MIT License 30 | 31 | [options] 32 | install_requires = 33 | # External packages 34 | pyserial 35 | IntelHex 36 | PyYAML 37 | appdirs 38 | # pathlib2 is needed for Python 2.7 compatibility 39 | pathlib2; python_version < "3" 40 | 41 | # Microchip packages 42 | pyedbglib~=2.24 43 | python_requires = >=2.7 44 | include_package_data = True 45 | packages = find: 46 | 47 | [options.extras_require] 48 | dev = 49 | pylint>=2.15 50 | test = 51 | mock 52 | parameterized 53 | pytest 54 | doc = 55 | # To avoid missing modules when generating documentation the mock module used by the tests is needed. 56 | # The mock module could also be useful if some imports need to be mocked out when generating documentation. 57 | mock 58 | sphinx 59 | 60 | [options.entry_points] 61 | console_scripts = 62 | pymcuprog = pymcuprog.pymcuprog:main 63 | 64 | [options.packages.find] 65 | exclude = 66 | pymcuprog.tests* 67 | doc* 68 | build* 69 | 70 | [options.package_data] 71 | pymcuprog = logging.yaml 72 | -------------------------------------------------------------------------------- /pymcuprog/nvmdebugwire.py: -------------------------------------------------------------------------------- 1 | """ 2 | DebugWIRE NVM implementation 3 | NB: This is a stub - not all features are implemented 4 | """ 5 | from pyedbglib.protocols.jtagice3protocol import Jtagice3ResponseError 6 | 7 | from .nvm import NvmAccessProviderCmsisDapAvr 8 | from .avr8target import TinyAvrTarget 9 | from .pymcuprog_errors import PymcuprogError 10 | 11 | class NvmAccessProviderCmsisDapDebugwire(NvmAccessProviderCmsisDapAvr): 12 | """ 13 | NVM Access the DW way 14 | """ 15 | 16 | def __init__(self, transport, device_info): 17 | NvmAccessProviderCmsisDapAvr.__init__(self, device_info) 18 | 19 | self._log_incomplete_stack('AVR-debugWIRE') 20 | 21 | self.avr = TinyAvrTarget(transport) 22 | self.avr.setup_debug_session() 23 | 24 | def __del__(self): 25 | pass 26 | 27 | def read_device_id(self): 28 | """ 29 | Read the device info 30 | 31 | :returns: Device ID raw bytes (little endian) 32 | """ 33 | try: 34 | resp = self.avr.activate_physical() 35 | except Jtagice3ResponseError: 36 | msg = "Unable to activate debugWIRE. Maybe ISP is active?" 37 | self.logger.error(msg) 38 | raise PymcuprogError(msg) 39 | self.logger.info("ID read: %02X%02X", resp[1], resp[0]) 40 | self.avr.deactivate_physical() 41 | return bytearray(resp[0:2]) 42 | 43 | def erase(self, memory_info=None, address=None): 44 | """ 45 | Do a chip erase of the device 46 | """ 47 | _dummy = memory_info 48 | _dummy = address 49 | self.logger.info("Unable to erase device using debugWIRE") 50 | 51 | @staticmethod 52 | def write(memory_info, offset, data): 53 | """ 54 | Write the memory with data 55 | 56 | :param memory_info: dictionary for the memory as provided by the DeviceMemoryInfo class 57 | :param offset: relative offset within the memory type 58 | :param data: the data to program 59 | """ 60 | _dummy = memory_info 61 | _dummy = offset 62 | _dummy = data 63 | # return None 64 | 65 | @staticmethod 66 | def read(memory_info, offset, numbytes): 67 | """ 68 | Read the memory in chunks 69 | 70 | :param memory_info: dictionary for the memory as provided by the DeviceMemoryInfo class 71 | :param offset: relative offset in the memory type 72 | :param numbytes: number of bytes to read 73 | :return: array of bytes read 74 | """ 75 | _dummy = memory_info 76 | _dummy = offset 77 | _dummy = numbytes 78 | return [] 79 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic16f18446.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC16F18446 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic16f18446', 8 | 'architecture': 'PIC16', 9 | # Will erase Flash, User ID and Config words 10 | 'default_bulk_erase_address_word': 0x8000, 11 | 12 | # Flash 13 | 'flash_address_word': 0, 14 | 'flash_size_words': 16384, 15 | 'flash_page_size_words': 32, 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | # This address will erase only flash 19 | 'flash_erase_address_word': 0x80FE, 20 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 21 | 'flash_isolated_erase': True, 22 | 23 | # User ID 24 | 'user_id_address_word': 0x8000, 25 | 'user_id_size_words': 4, 26 | 'user_id_page_size_words': 1, 27 | 'user_id_write_size_words': 1, 28 | 'user_id_read_size_words': 1, 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config words 33 | 'config_words_address_word': 0x8007, 34 | 'config_words_size_words': 5, 35 | 'config_words_page_size_words': 1, 36 | 'config_words_write_size_words': 1, 37 | 'config_words_read_size_words': 1, 38 | 'config_words_erase_address_word': 0, 39 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 40 | 'config_words_isolated_erase': False, 41 | 42 | # EEPROM 43 | 'eeprom_address_word': 0xF000, 44 | 'eeprom_size_bytes': 256, 45 | 'eeprom_page_size_words': 1, 46 | 'eeprom_write_size_words': 1, 47 | 'eeprom_read_size_words': 1, 48 | 'eeprom_chiperase_effect': ChiperaseEffect.NOT_ERASED, 49 | 'eeprom_isolated_erase': False, 50 | 51 | # ICD memory 52 | 'icd_address_byte': 0x8600*2, 53 | 'icd_size_bytes': 512*2, # 1KiB 54 | 'icd_page_size_words': 32, 55 | 'icd_write_size_words': 1, 56 | 'icd_read_size_words': 1, 57 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 58 | 'icd_isolated_erase': True, 59 | 60 | # DIA 61 | 'dia_address_word': 0x8100, 62 | 'dia_size_words': 30, 63 | 'dia_page_size_words': 1, 64 | 'dia_write_size_words': 0, 65 | 'dia_read_size_words': 1, 66 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 67 | 'dia_isolated_erase': False, 68 | 69 | # DCI 70 | 'dci_address_word': 0x8200, 71 | 'dci_size_words': 5, 72 | 'dci_page_size_words': 1, 73 | 'dci_write_size_words': 0, 74 | 'dci_read_size_words': 1, 75 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 76 | 'dci_isolated_erase': False, 77 | } 78 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f47q43.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F47Q43 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f47q43', 8 | 'architecture': 'PIC18', 9 | # This device does not use an address as parameter for the bulk erase 10 | 11 | # Flash 12 | 'flash_address_byte': 0, 13 | 'flash_size_bytes': 128*1024, # 128KB 14 | 'flash_erase_size_words': 128, # Sector erase 15 | 'flash_page_size_words': 1, # No page buffer 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_byte': 0x200000, 23 | 'user_id_size_words': 32, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_erase_address_byte': 0x300000, # not used kept for compatibility 28 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 29 | 'user_id_isolated_erase': False, 30 | 31 | # Config words 32 | 'config_words_address_byte': 0x300000, 33 | 'config_words_size_words': 5, 34 | 'config_words_page_size_words': 1, 35 | 'config_words_write_size_words': 1, 36 | 'config_words_read_size_words': 1, 37 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 38 | 'config_words_isolated_erase': False, 39 | 40 | # EEPROM 41 | 'eeprom_address_byte': 0x380000, 42 | 'eeprom_size_bytes': 1024, 43 | 'eeprom_page_size_bytes': 1, 44 | 'eeprom_write_size_bytes': 1, 45 | 'eeprom_read_size_bytes': 1, 46 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 47 | 'eeprom_isolated_erase': False, 48 | 49 | # ICD memory 50 | 'icd_address_byte': 0x240000, 51 | 'icd_size_bytes': 128*4*2, # 1KiB 52 | 'icd_page_size_words': 128,# No page buffer so this is for sector erase 53 | 'icd_write_size_words': 1, 54 | 'icd_read_size_words': 1, 55 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 56 | 'icd_isolated_erase': False, 57 | 58 | # DIA 59 | 'dia_address_byte': 0x2C0000, 60 | 'dia_size_bytes': 60, 61 | 'dia_page_size_bytes': 1, 62 | 'dia_write_size_bytes': 0, 63 | 'dia_read_size_bytes': 1, 64 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 65 | 'dia_isolated_erase': False, 66 | 67 | # DCI 68 | 'dci_address_byte': 0x3C0000, 69 | 'dci_size_bytes': 10, 70 | 'dci_page_size_bytes': 1, 71 | 'dci_write_size_bytes': 0, 72 | 'dci_read_size_bytes': 1, 73 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 74 | 'dci_isolated_erase': False, 75 | } 76 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f57q43.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F57Q43 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f57q43', 8 | 'architecture': 'PIC18', 9 | # This device does not use an address as parameter for the bulk erase 10 | 11 | # Flash 12 | 'flash_address_byte': 0, 13 | 'flash_size_bytes': 128*1024, # 128KB 14 | 'flash_erase_size_words': 128, # Sector erase 15 | 'flash_page_size_words': 1, # No page buffer 16 | 'flash_write_size_words': 1, 17 | 'flash_read_size_words': 1, 18 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 19 | 'flash_isolated_erase': False, 20 | 21 | # User ID 22 | 'user_id_address_byte': 0x200000, 23 | 'user_id_size_words': 32, 24 | 'user_id_page_size_words': 1, 25 | 'user_id_write_size_words': 1, 26 | 'user_id_read_size_words': 1, 27 | 'user_id_erase_address_byte': 0x300000, # not used kept for compatibility 28 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 29 | 'user_id_isolated_erase': False, 30 | 31 | # Config words 32 | 'config_words_address_byte': 0x300000, 33 | 'config_words_size_words': 5, 34 | 'config_words_page_size_words': 1, 35 | 'config_words_write_size_words': 1, 36 | 'config_words_read_size_words': 1, 37 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 38 | 'config_words_isolated_erase': False, 39 | 40 | # EEPROM 41 | 'eeprom_address_byte': 0x380000, 42 | 'eeprom_size_bytes': 1024, 43 | 'eeprom_page_size_bytes': 1, 44 | 'eeprom_write_size_bytes': 1, 45 | 'eeprom_read_size_bytes': 1, 46 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 47 | 'eeprom_isolated_erase': False, 48 | 49 | # ICD memory 50 | 'icd_address_byte': 0x240000, 51 | 'icd_size_bytes': 128*4*2, # 1KiB 52 | 'icd_page_size_words': 128, # No page buffer so this is for sector erase 53 | 'icd_write_size_words': 1, 54 | 'icd_read_size_words': 1, 55 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 56 | 'icd_isolated_erase': False, 57 | 58 | # DIA 59 | 'dia_address_byte': 0x2C0000, 60 | 'dia_size_bytes': 60, 61 | 'dia_page_size_bytes': 1, 62 | 'dia_write_size_bytes': 0, 63 | 'dia_read_size_bytes': 1, 64 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 65 | 'dia_isolated_erase': False, 66 | 67 | # DCI 68 | 'dci_address_byte': 0x3C0000, 69 | 'dci_size_bytes': 10, 70 | 'dci_page_size_bytes': 1, 71 | 'dci_write_size_bytes': 0, 72 | 'dci_read_size_bytes': 1, 73 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 74 | 'dci_isolated_erase': False, 75 | } 76 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f46q71.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F46Q71 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f46q71', 8 | 'architecture': 'PIC18', 9 | 'device_id': 0x7720, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 64*1024, 15 | 'flash_erase_size_words': 128, # Sector erase 16 | 'flash_page_size_words': 1, # No page buffer 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_byte': 0x200000, 24 | 'user_id_size_words': 32, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_erase_address_byte': 0x300000, # not used kept for compatibility 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config bytes 33 | 'config_words_address_byte': 0x300000, 34 | 'config_words_size_bytes': 11, 35 | 'config_words_page_size_bytes': 1, 36 | 'config_words_write_size_bytes': 1, 37 | 'config_words_read_size_bytes': 1, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x380000, 43 | 'eeprom_size_bytes': 256, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 48 | 'eeprom_isolated_erase': False, 49 | 50 | # ICD memory 51 | 'icd_address_byte': 0x240000, 52 | 'icd_size_bytes': 128*4*2, # 1KiB 53 | 'icd_page_size_words': 128,# No page buffer so this is for sector erase 54 | 'icd_write_size_words': 1, 55 | 'icd_read_size_words': 1, 56 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 57 | 'icd_isolated_erase': False, 58 | 59 | # DIA 60 | 'dia_address_byte': 0x2C0000, 61 | 'dia_size_bytes': 60, 62 | 'dia_page_size_bytes': 1, 63 | 'dia_write_size_bytes': 0, 64 | 'dia_read_size_bytes': 1, 65 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'dia_isolated_erase': False, 67 | 68 | # DCI 69 | 'dci_address_byte': 0x3C0000, 70 | 'dci_size_bytes': 10, 71 | 'dci_page_size_bytes': 1, 72 | 'dci_write_size_bytes': 0, 73 | 'dci_read_size_bytes': 1, 74 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'dci_isolated_erase': False, 76 | } 77 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f56q71.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F56Q71 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f56q71', 8 | 'architecture': 'PIC18', 9 | 'device_id': 0x7760, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 64*1024, 15 | 'flash_erase_size_words': 128, # Sector erase 16 | 'flash_page_size_words': 1, # No page buffer 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_byte': 0x200000, 24 | 'user_id_size_words': 32, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_erase_address_byte': 0x300000, # not used kept for compatibility 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config bytes 33 | 'config_words_address_byte': 0x300000, 34 | 'config_words_size_bytes': 11, 35 | 'config_words_page_size_bytes': 1, 36 | 'config_words_write_size_bytes': 1, 37 | 'config_words_read_size_bytes': 1, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x380000, 43 | 'eeprom_size_bytes': 256, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 48 | 'eeprom_isolated_erase': False, 49 | 50 | # ICD memory 51 | 'icd_address_byte': 0x240000, 52 | 'icd_size_bytes': 128*4*2, # 1KiB 53 | 'icd_page_size_words': 128,# No page buffer so this is for sector erase 54 | 'icd_write_size_words': 1, 55 | 'icd_read_size_words': 1, 56 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 57 | 'icd_isolated_erase': False, 58 | 59 | # DIA 60 | 'dia_address_byte': 0x2C0000, 61 | 'dia_size_bytes': 60, 62 | 'dia_page_size_bytes': 1, 63 | 'dia_write_size_bytes': 0, 64 | 'dia_read_size_bytes': 1, 65 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'dia_isolated_erase': False, 67 | 68 | # DCI 69 | 'dci_address_byte': 0x3C0000, 70 | 'dci_size_bytes': 10, 71 | 'dci_page_size_bytes': 1, 72 | 'dci_write_size_bytes': 0, 73 | 'dci_read_size_bytes': 1, 74 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'dci_isolated_erase': False, 76 | } 77 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f06q20.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F06Q20 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f06q20', 8 | 'architecture': 'PIC18', 9 | 'device_id': 0x7A60, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 64*1024, # 64KB 15 | 'flash_erase_size_words': 128, # Sector erase 16 | 'flash_page_size_words': 1, # No page buffer 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_byte': 0x200000, 24 | 'user_id_size_words': 32, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_erase_address_byte': 0x200000, # not used kept for compatibility 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config words 33 | 'config_words_address_byte': 0x300000, 34 | 'config_words_size_bytes': 26, 35 | 'config_words_page_size_bytes': 1, 36 | 'config_words_write_size_bytes': 1, 37 | 'config_words_read_size_bytes': 1, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x380000, 43 | 'eeprom_size_bytes': 256, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 48 | 'eeprom_isolated_erase': False, 49 | 50 | # ICD memory 51 | 'icd_address_byte': 0x240000, 52 | 'icd_size_bytes': 128*4*2, # 1KiB 53 | 'icd_page_size_words': 128,# No page buffer so this is for sector erase 54 | 'icd_write_size_words': 1, 55 | 'icd_read_size_words': 1, 56 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 57 | 'icd_isolated_erase': False, 58 | 59 | # DIA 60 | 'dia_address_byte': 0x2C0000, 61 | 'dia_size_bytes': 60, 62 | 'dia_page_size_bytes': 1, 63 | 'dia_write_size_bytes': 0, 64 | 'dia_read_size_bytes': 1, 65 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'dia_isolated_erase': False, 67 | 68 | # DCI 69 | 'dci_address_byte': 0x3C0000, 70 | 'dci_size_bytes': 10, 71 | 'dci_page_size_bytes': 1, 72 | 'dci_write_size_bytes': 0, 73 | 'dci_read_size_bytes': 1, 74 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'dci_isolated_erase': False, 76 | } 77 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f16q20.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F16Q20 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f16q20', 8 | 'architecture': 'PIC18', 9 | 'device_id': 0x7A40, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 64*1024, # 64KB 15 | 'flash_erase_size_words': 128, # Sector erase 16 | 'flash_page_size_words': 1, # No page buffer 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_byte': 0x200000, 24 | 'user_id_size_words': 32, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_erase_address_byte': 0x200000, # not used kept for compatibility 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config words 33 | 'config_words_address_byte': 0x300000, 34 | 'config_words_size_bytes': 26, 35 | 'config_words_page_size_bytes': 1, 36 | 'config_words_write_size_bytes': 1, 37 | 'config_words_read_size_bytes': 1, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x380000, 43 | 'eeprom_size_bytes': 256, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 48 | 'eeprom_isolated_erase': False, 49 | 50 | # ICD memory 51 | 'icd_address_byte': 0x240000, 52 | 'icd_size_bytes': 128*4*2, # 1KiB 53 | 'icd_page_size_words': 128,# No page buffer so this is for sector erase 54 | 'icd_write_size_words': 1, 55 | 'icd_read_size_words': 1, 56 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 57 | 'icd_isolated_erase': False, 58 | 59 | # DIA 60 | 'dia_address_byte': 0x2C0000, 61 | 'dia_size_bytes': 60, 62 | 'dia_page_size_bytes': 1, 63 | 'dia_write_size_bytes': 0, 64 | 'dia_read_size_bytes': 1, 65 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'dia_isolated_erase': False, 67 | 68 | # DCI 69 | 'dci_address_byte': 0x3C0000, 70 | 'dci_size_bytes': 10, 71 | 'dci_page_size_bytes': 1, 72 | 'dci_write_size_bytes': 0, 73 | 'dci_read_size_bytes': 1, 74 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'dci_isolated_erase': False, 76 | } 77 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f16q40.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F16Q40 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f16q40', 8 | 'architecture': 'PIC18', 9 | 'device_id': 0x75A0, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 64*1024, # 64KB 15 | 'flash_erase_size_words': 128, # Sector erase 16 | 'flash_page_size_words': 1, # No page buffer 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_byte': 0x200000, 24 | 'user_id_size_words': 32, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_erase_address_byte': 0x300000, # not used kept for compatibility 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config words 33 | 'config_words_address_byte': 0x300000, 34 | 'config_words_size_words': 5, 35 | 'config_words_page_size_words': 1, 36 | 'config_words_write_size_words': 1, 37 | 'config_words_read_size_words': 1, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x380000, 43 | 'eeprom_size_bytes': 512, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 48 | 'eeprom_isolated_erase': False, 49 | 50 | # ICD memory 51 | 'icd_address_byte': 0x240000, 52 | 'icd_size_bytes': 128*4*2, # 1KiB 53 | 'icd_page_size_words': 128,# No page buffer so this is for sector erase 54 | 'icd_write_size_words': 1, 55 | 'icd_read_size_words': 1, 56 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 57 | 'icd_isolated_erase': False, 58 | 59 | # DIA 60 | 'dia_address_byte': 0x2C0000, 61 | 'dia_size_bytes': 60, 62 | 'dia_page_size_bytes': 1, 63 | 'dia_write_size_bytes': 0, 64 | 'dia_read_size_bytes': 1, 65 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'dia_isolated_erase': False, 67 | 68 | # DCI 69 | 'dci_address_byte': 0x3C0000, 70 | 'dci_size_bytes': 10, 71 | 'dci_page_size_bytes': 1, 72 | 'dci_write_size_bytes': 0, 73 | 'dci_read_size_bytes': 1, 74 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'dci_isolated_erase': False, 76 | } 77 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f16q41.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F16Q41 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f16q41', 8 | 'architecture': 'PIC18', 9 | 'device_id': 0x7560, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 64*1024, # 64KB 15 | 'flash_erase_size_words': 128, # Sector erase 16 | 'flash_page_size_words': 1, # No page buffer 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_byte': 0x200000, 24 | 'user_id_size_words': 32, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_erase_address_byte': 0x300000, # not used kept for compatibility 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config words 33 | 'config_words_address_byte': 0x300000, 34 | 'config_words_size_words': 5, 35 | 'config_words_page_size_words': 1, 36 | 'config_words_write_size_words': 1, 37 | 'config_words_read_size_words': 1, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x380000, 43 | 'eeprom_size_bytes': 512, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 48 | 'eeprom_isolated_erase': False, 49 | 50 | # ICD memory 51 | 'icd_address_byte': 0x240000, 52 | 'icd_size_bytes': 128*4*2, # 1KiB 53 | 'icd_page_size_words': 128,# No page buffer so this is for sector erase 54 | 'icd_write_size_words': 1, 55 | 'icd_read_size_words': 1, 56 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 57 | 'icd_isolated_erase': False, 58 | 59 | # DIA 60 | 'dia_address_byte': 0x2C0000, 61 | 'dia_size_bytes': 60, 62 | 'dia_page_size_bytes': 1, 63 | 'dia_write_size_bytes': 0, 64 | 'dia_read_size_bytes': 1, 65 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'dia_isolated_erase': False, 67 | 68 | # DCI 69 | 'dci_address_byte': 0x3C0000, 70 | 'dci_size_bytes': 10, 71 | 'dci_page_size_bytes': 1, 72 | 'dci_write_size_bytes': 0, 73 | 'dci_read_size_bytes': 1, 74 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'dci_isolated_erase': False, 76 | } 77 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f57q84.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F57Q84 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f57q84', 8 | 'architecture': 'PIC18', 9 | 'device_id': 0x9905, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 128*1024, # 128KB 15 | 'flash_erase_size_words': 128, # Sector erase 16 | 'flash_page_size_words': 1, # No page buffer 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_byte': 0x200000, 24 | 'user_id_size_words': 32, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_erase_address_byte': 0x300000, # not used kept for compatibility 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config words 33 | 'config_words_address_byte': 0x300000, 34 | 'config_words_size_words': 18, 35 | 'config_words_page_size_words': 1, 36 | 'config_words_write_size_words': 1, 37 | 'config_words_read_size_words': 1, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x380000, 43 | 'eeprom_size_bytes': 1024, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 48 | 'eeprom_isolated_erase': False, 49 | 50 | # ICD memory 51 | 'icd_address_byte': 0x240000, 52 | 'icd_size_bytes': 128*4*2, # 1KiB 53 | 'icd_page_size_words': 128, # No page buffer so this is for sector erase 54 | 'icd_write_size_words': 1, 55 | 'icd_read_size_words': 1, 56 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 57 | 'icd_isolated_erase': False, 58 | 59 | # DIA 60 | 'dia_address_byte': 0x2C0000, 61 | 'dia_size_bytes': 60, 62 | 'dia_page_size_bytes': 1, 63 | 'dia_write_size_bytes': 0, 64 | 'dia_read_size_bytes': 1, 65 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'dia_isolated_erase': False, 67 | 68 | # DCI 69 | 'dci_address_byte': 0x3C0000, 70 | 'dci_size_bytes': 10, 71 | 'dci_page_size_bytes': 1, 72 | 'dci_write_size_bytes': 0, 73 | 'dci_read_size_bytes': 1, 74 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'dci_isolated_erase': False, 76 | } 77 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f46q24.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F46Q24 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f46q24', 8 | 'architecture': 'PIC18', 9 | 'device_id': 0x7900, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 64*1024, 15 | 'flash_erase_size_words': 128, # Sector erase 16 | 'flash_page_size_words': 1, # No page buffer 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_byte': 0x200000, 24 | 'user_id_size_words': 32, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_erase_address_byte': 0x300000, # not used kept for compatibility 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config bytes 33 | 'config_words_address_byte': 0x300000, 34 | 'config_words_size_bytes': 29, 35 | 'config_words_page_size_bytes': 1, 36 | 'config_words_write_size_bytes': 1, 37 | 'config_words_read_size_bytes': 1, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x380000, 43 | 'eeprom_size_bytes': 512, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 48 | 'eeprom_isolated_erase': False, 49 | 50 | # ICD memory 51 | 'icd_address_byte': 0x240000, 52 | 'icd_size_bytes': 128*4*2, # 1KiB 53 | 'icd_page_size_words': 128,# No page buffer so this is for sector erase 54 | 'icd_write_size_words': 1, 55 | 'icd_read_size_words': 1, 56 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 57 | 'icd_isolated_erase': False, 58 | 59 | # DIA 60 | 'dia_address_byte': 0x2C0000, 61 | 'dia_size_words': 30, 62 | 'dia_page_size_words': 1, 63 | 'dia_write_size_words': 0, 64 | 'dia_read_size_words': 1, 65 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'dia_isolated_erase': False, 67 | 68 | # DCI 69 | 'dci_address_byte': 0x3C0000, 70 | 'dci_size_words': 5, 71 | 'dci_page_size_words': 1, 72 | 'dci_write_size_words': 0, 73 | 'dci_read_size_words': 1, 74 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'dci_isolated_erase': False, 76 | } 77 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/pic18f56q24.py: -------------------------------------------------------------------------------- 1 | """ 2 | Required device info for the PIC18F56Q24 devices 3 | """ 4 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 5 | 6 | DEVICE_INFO = { 7 | 'name': 'pic18f56q24', 8 | 'architecture': 'PIC18', 9 | 'device_id': 0x7920, 10 | # This device does not use an address as parameter for the bulk erase 11 | 12 | # Flash 13 | 'flash_address_byte': 0, 14 | 'flash_size_bytes': 64*1024, 15 | 'flash_erase_size_words': 128, # Sector erase 16 | 'flash_page_size_words': 1, # No page buffer 17 | 'flash_write_size_words': 1, 18 | 'flash_read_size_words': 1, 19 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 20 | 'flash_isolated_erase': False, 21 | 22 | # User ID 23 | 'user_id_address_byte': 0x200000, 24 | 'user_id_size_words': 32, 25 | 'user_id_page_size_words': 1, 26 | 'user_id_write_size_words': 1, 27 | 'user_id_read_size_words': 1, 28 | 'user_id_erase_address_byte': 0x300000, # not used kept for compatibility 29 | 'user_id_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'user_id_isolated_erase': False, 31 | 32 | # Config bytes 33 | 'config_words_address_byte': 0x300000, 34 | 'config_words_size_bytes': 29, 35 | 'config_words_page_size_bytes': 1, 36 | 'config_words_write_size_bytes': 1, 37 | 'config_words_read_size_bytes': 1, 38 | 'config_words_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 39 | 'config_words_isolated_erase': False, 40 | 41 | # EEPROM 42 | 'eeprom_address_byte': 0x380000, 43 | 'eeprom_size_bytes': 512, 44 | 'eeprom_page_size_bytes': 1, 45 | 'eeprom_write_size_bytes': 1, 46 | 'eeprom_read_size_bytes': 1, 47 | 'eeprom_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 48 | 'eeprom_isolated_erase': False, 49 | 50 | # ICD memory 51 | 'icd_address_byte': 0x240000, 52 | 'icd_size_bytes': 128*4*2, # 1KiB 53 | 'icd_page_size_words': 128,# No page buffer so this is for sector erase 54 | 'icd_write_size_words': 1, 55 | 'icd_read_size_words': 1, 56 | 'icd_chiperase_effect': ChiperaseEffect.NOT_ERASED, 57 | 'icd_isolated_erase': False, 58 | 59 | # DIA 60 | 'dia_address_byte': 0x2C0000, 61 | 'dia_size_words': 30, 62 | 'dia_page_size_words': 1, 63 | 'dia_write_size_words': 0, 64 | 'dia_read_size_words': 1, 65 | 'dia_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'dia_isolated_erase': False, 67 | 68 | # DCI 69 | 'dci_address_byte': 0x3C0000, 70 | 'dci_size_words': 5, 71 | 'dci_page_size_words': 1, 72 | 'dci_write_size_words': 0, 73 | 'dci_read_size_words': 1, 74 | 'dci_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'dci_isolated_erase': False, 76 | } 77 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/deviceinfokeys.py: -------------------------------------------------------------------------------- 1 | #pylint: disable=too-few-public-methods 2 | """ 3 | Definitions of keys for device info dictionaries 4 | """ 5 | 6 | class DeviceInfoKeys(object): 7 | """ 8 | Base class with common device info keys 9 | """ 10 | 11 | NAME = 'name' 12 | ARCHITECTURE = 'architecture' 13 | INTERFACE = 'interface' 14 | DEVICE_ID = 'device_id' 15 | 16 | @classmethod 17 | def get_all(cls): 18 | """ 19 | Get a list of all keys 20 | 21 | :return List of all valid keys (baseclass and any subclass keys if run on a subclass) 22 | """ 23 | all_keys = [] 24 | for attribute in dir(cls): 25 | if not attribute.startswith('__') and not callable(getattr(cls, attribute)): 26 | all_keys.append(getattr(cls, attribute)) 27 | 28 | return all_keys 29 | 30 | class DeviceInfoKeysAvr(DeviceInfoKeys): 31 | """ 32 | Keys specific to AVR device info files 33 | """ 34 | 35 | NVMCTRL_BASE = 'nvmctrl_base' 36 | SYSCFG_BASE = 'syscfg_base' 37 | OCD_BASE = 'ocd_base' 38 | PROG_CLOCK_KHZ = 'prog_clock_khz' 39 | ADDRESS_SIZE = 'address_size' 40 | HV_IMPLEMENTATION = 'hv_implementation' 41 | DATA_ADDRESS_SPACE = 'data_space_base' 42 | 43 | class DeviceInfoKeysAvr32(DeviceInfoKeys): 44 | """ 45 | Keys specific to 32-bit AVR device info files 46 | """ 47 | 48 | RESET_DOMAINS = 'reset_domains' 49 | 50 | class DeviceInfoKeysPic(DeviceInfoKeys): 51 | """ 52 | Keys specific to PIC device info files 53 | """ 54 | 55 | # This key should have _byte or _word ending in device info files to specify byte or word address 56 | # This ending will be removed by the getdeviceinfo function before returning the device info dictionary 57 | DEFAULT_BULK_ERASE_ADDRESS = 'default_bulk_erase_address' 58 | 59 | class DeviceMemoryInfoKeys(object): 60 | """ 61 | Keys for device memory info dictionary 62 | 63 | These keys are found in the dictionaries returned by DeviceMemoryInfo for each memory type 64 | """ 65 | NAME = 'name' 66 | ADDRESS = 'address' 67 | SIZE = 'size' 68 | PAGE_SIZE = 'page_size' 69 | WRITE_SIZE = 'write_size' 70 | READ_SIZE = 'read_size' 71 | ERASE_ADDRESS = 'erase_address' 72 | CHIPERASE_EFFECT = 'chiperase_effect' 73 | ISOLATED_ERASE = 'isolated_erase' 74 | HEXFILE_ADDRESS = 'hexfile_address' 75 | HEXFILE_SIZE = 'hexfile_size' 76 | VERIFY_MASK = 'verify_mask' 77 | 78 | @classmethod 79 | def get_all(cls): 80 | """ 81 | Get a list of all keys 82 | 83 | :return: List of all valid keys (baseclass and any subclass keys if run on a subclass) 84 | """ 85 | all_keys = [] 86 | for attribute in dir(cls): 87 | if not attribute.startswith('__') and not callable(getattr(cls, attribute)): 88 | all_keys.append(getattr(cls, attribute)) 89 | 90 | return all_keys 91 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr16dd14.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr16dd14 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.2.168 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr16dd14', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x1400, 16 | 'eeprom_size_bytes': 0x100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x4000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7800, 43 | 'internal_sram_size_bytes': 0x800, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E9434, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr16dd20.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr16dd20 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.2.168 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr16dd20', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x1400, 16 | 'eeprom_size_bytes': 0x100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x4000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7800, 43 | 'internal_sram_size_bytes': 0x800, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E9433, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr16dd28.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr16dd28 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.2.168 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr16dd28', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x1400, 16 | 'eeprom_size_bytes': 0x100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x4000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7800, 43 | 'internal_sram_size_bytes': 0x800, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E9432, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr16dd32.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr16dd32 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.2.168 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr16dd32', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x1400, 16 | 'eeprom_size_bytes': 0x100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x4000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7800, 43 | 'internal_sram_size_bytes': 0x800, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E9431, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32dd14.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32dd14 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.2.168 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32dd14', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x1400, 16 | 'eeprom_size_bytes': 0x100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E953B, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32dd20.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32dd20 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.2.168 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32dd20', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x1400, 16 | 'eeprom_size_bytes': 0x100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E953A, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32dd28.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32dd28 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.2.168 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32dd28', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x1400, 16 | 'eeprom_size_bytes': 0x100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E9539, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32dd32.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32dd32 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.2.168 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32dd32', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x1400, 16 | 'eeprom_size_bytes': 0x100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E9538, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32da28.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32da28 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32da28', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9534, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32da32.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32da32 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32da32', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9533, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32da48.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32da48 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32da48', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9532, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32db28.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32db28 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32db28', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9537, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32db32.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32db32 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32db32', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9536, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr32db48.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr32db48 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr32db48', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x8000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x7000, 43 | 'internal_sram_size_bytes': 0x1000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9535, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64da28.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64da28 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64da28', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9615, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64da32.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64da32 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64da32', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9614, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64da48.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64da48 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64da48', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9613, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64da64.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64da64 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64da64', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9612, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64db28.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64db28 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64db28', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9619, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64db32.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64db32 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64db32', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9618, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64db48.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64db48 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64db48', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9617, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64db64.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64db64 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64db64', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0200, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x02, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 1, 84 | 'device_id': 0x1E9616, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64dd14.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64dd14 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64dd14', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E961D, 85 | 86 | } 87 | -------------------------------------------------------------------------------- /pymcuprog/deviceinfo/devices/avr64dd20.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | Required device info for the avr64dd20 devices 4 | The following data was collected from device pack Microchip.AVR-Dx_DFP 2.0.137 5 | """ 6 | 7 | from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect 8 | 9 | DEVICE_INFO = { 10 | 'interface': 'UPDI', 11 | 'name': 'avr64dd20', 12 | 'architecture': 'avr8x', 13 | 14 | # eeprom 15 | 'eeprom_address_byte': 0x00001400, 16 | 'eeprom_size_bytes': 0x0100, 17 | 'eeprom_page_size_bytes': 0x1, 18 | 'eeprom_read_size_bytes': 0x01, 19 | 'eeprom_write_size_bytes': 0x01, 20 | 'eeprom_chiperase_effect': ChiperaseEffect.CONDITIONALLY_ERASED_AVR, 21 | 'eeprom_isolated_erase': True, 22 | 23 | # flash 24 | 'flash_address_byte': 0x00800000, 25 | 'flash_size_bytes': 0x10000, 26 | 'flash_page_size_bytes': 0x200, 27 | 'flash_read_size_bytes': 0x02, 28 | 'flash_write_size_bytes': 0x200, 29 | 'flash_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 30 | 'flash_isolated_erase': True, 31 | 32 | # fuses 33 | 'fuses_address_byte': 0x1050, 34 | 'fuses_size_bytes': 0x09, 35 | 'fuses_page_size_bytes': 0x01, 36 | 'fuses_read_size_bytes': 0x01, 37 | 'fuses_write_size_bytes': 0x01, 38 | 'fuses_chiperase_effect': ChiperaseEffect.NOT_ERASED, 39 | 'fuses_isolated_erase': False, 40 | 41 | # internal_sram 42 | 'internal_sram_address_byte': 0x6000, 43 | 'internal_sram_size_bytes': 0x2000, 44 | 'internal_sram_page_size_bytes': 0x01, 45 | 'internal_sram_read_size_bytes': 0x01, 46 | 'internal_sram_write_size_bytes': 0x01, 47 | 'internal_sram_chiperase_effect': ChiperaseEffect.NOT_ERASED, 48 | 'internal_sram_isolated_erase': False, 49 | 50 | # lockbits 51 | 'lockbits_address_byte': 0x1040, 52 | 'lockbits_size_bytes': 0x4, 53 | 'lockbits_page_size_bytes': 0x01, 54 | 'lockbits_read_size_bytes': 0x01, 55 | 'lockbits_write_size_bytes': 0x01, 56 | 'lockbits_chiperase_effect': ChiperaseEffect.ALWAYS_ERASED, 57 | 'lockbits_isolated_erase': False, 58 | 59 | # signatures 60 | 'signatures_address_byte': 0x1100, 61 | 'signatures_size_bytes': 0x40, 62 | 'signatures_page_size_bytes': 0x01, 63 | 'signatures_read_size_bytes': 0x01, 64 | 'signatures_write_size_bytes': 0x00, 65 | 'signatures_chiperase_effect': ChiperaseEffect.NOT_ERASED, 66 | 'signatures_isolated_erase': False, 67 | 68 | # user_row 69 | 'user_row_address_byte': 0x1080, 70 | 'user_row_size_bytes': 0x20, 71 | 'user_row_page_size_bytes': 0x20, 72 | 'user_row_read_size_bytes': 0x01, 73 | 'user_row_write_size_bytes': 0x01, 74 | 'user_row_chiperase_effect': ChiperaseEffect.NOT_ERASED, 75 | 'user_row_isolated_erase': True, 76 | 77 | # Some extra AVR specific fields 78 | 'nvmctrl_base': 0x00001000, 79 | 'syscfg_base': 0x00000F00, 80 | 'ocd_base': 0x00000F80, 81 | 'address_size': '24-bit', 82 | 'prog_clock_khz': 1800, 83 | 'hv_implementation': 2, 84 | 'device_id': 0x1E961C, 85 | 86 | } 87 | --------------------------------------------------------------------------------