├── .gitattributes ├── .github ├── PULL_REQUEST_TEMPLATE │ └── adafruit_circuitpython_pr.md └── workflows │ ├── build.yml │ ├── failure-help-text.yml │ ├── release_gh.yml │ └── release_pypi.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .readthedocs.yaml ├── CODE_OF_CONDUCT.md ├── LICENSE ├── LICENSES ├── CC-BY-4.0.txt ├── MIT.txt └── Unlicense.txt ├── README.rst ├── README.rst.license ├── adafruit_avrprog.py ├── docs ├── _static │ ├── favicon.ico │ └── favicon.ico.license ├── api.rst ├── api.rst.license ├── conf.py ├── examples.rst ├── examples.rst.license ├── index.rst ├── index.rst.license └── requirements.txt ├── examples ├── attiny13a_blink.hex ├── attiny13a_blink.hex.license ├── avrprog_program_mega2560.py ├── avrprog_program_tiny13a.py ├── avrprog_program_trinket85.py ├── avrprog_program_uno328.py ├── avrprog_read_signature_simpletest.py ├── optiboot_atmega328.hex ├── optiboot_atmega328.hex.license ├── stk500boot_v2_mega2560.hex ├── stk500boot_v2_mega2560.hex.license ├── trinket_boot.hex └── trinket_boot.hex.license ├── optional_requirements.txt ├── pyproject.toml ├── requirements.txt └── ruff.toml /.gitattributes: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: Unlicense 4 | 5 | .py text eol=lf 6 | .rst text eol=lf 7 | .txt text eol=lf 8 | .yaml text eol=lf 9 | .toml text eol=lf 10 | .license text eol=lf 11 | .md text eol=lf 12 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | Thank you for contributing! Before you submit a pull request, please read the following. 6 | 7 | Make sure any changes you're submitting are in line with the CircuitPython Design Guide, available here: https://docs.circuitpython.org/en/latest/docs/design_guide.html 8 | 9 | If your changes are to documentation, please verify that the documentation builds locally by following the steps found here: https://adafru.it/build-docs 10 | 11 | Before submitting the pull request, make sure you've run Pylint and Black locally on your code. You can do this manually or using pre-commit. Instructions are available here: https://adafru.it/check-your-code 12 | 13 | Please remove all of this text before submitting. Include an explanation or list of changes included in your PR, as well as, if applicable, a link to any related issues. 14 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | name: Build CI 6 | 7 | on: [pull_request, push] 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Run Build CI workflow 14 | uses: adafruit/workflows-circuitpython-libs/build@main 15 | -------------------------------------------------------------------------------- /.github/workflows/failure-help-text.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Scott Shawcroft for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | name: Failure help text 6 | 7 | on: 8 | workflow_run: 9 | workflows: ["Build CI"] 10 | types: 11 | - completed 12 | 13 | jobs: 14 | post-help: 15 | runs-on: ubuntu-latest 16 | if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'pull_request' }} 17 | steps: 18 | - name: Post comment to help 19 | uses: adafruit/circuitpython-action-library-ci-failed@v1 20 | -------------------------------------------------------------------------------- /.github/workflows/release_gh.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | name: GitHub Release Actions 6 | 7 | on: 8 | release: 9 | types: [published] 10 | 11 | jobs: 12 | upload-release-assets: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Run GitHub Release CI workflow 16 | uses: adafruit/workflows-circuitpython-libs/release-gh@main 17 | with: 18 | github-token: ${{ secrets.GITHUB_TOKEN }} 19 | upload-url: ${{ github.event.release.upload_url }} 20 | -------------------------------------------------------------------------------- /.github/workflows/release_pypi.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | name: PyPI Release Actions 6 | 7 | on: 8 | release: 9 | types: [published] 10 | 11 | jobs: 12 | upload-release-assets: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Run PyPI Release CI workflow 16 | uses: adafruit/workflows-circuitpython-libs/release-pypi@main 17 | with: 18 | pypi-username: ${{ secrets.pypi_username }} 19 | pypi-password: ${{ secrets.pypi_password }} 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 Kattni Rembor, written for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | # Do not include files and directories created by your personal work environment, such as the IDE 6 | # you use, except for those already listed here. Pull requests including changes to this file will 7 | # not be accepted. 8 | 9 | # This .gitignore file contains rules for files generated by working with CircuitPython libraries, 10 | # including building Sphinx, testing with pip, and creating a virual environment, as well as the 11 | # MacOS and IDE-specific files generated by using MacOS in general, or the PyCharm or VSCode IDEs. 12 | 13 | # If you find that there are files being generated on your machine that should not be included in 14 | # your git commit, you should create a .gitignore_global file on your computer to include the 15 | # files created by your personal setup. To do so, follow the two steps below. 16 | 17 | # First, create a file called .gitignore_global somewhere convenient for you, and add rules for 18 | # the files you want to exclude from git commits. 19 | 20 | # Second, configure Git to use the exclude file for all Git repositories by running the 21 | # following via commandline, replacing "path/to/your/" with the actual path to your newly created 22 | # .gitignore_global file: 23 | # git config --global core.excludesfile path/to/your/.gitignore_global 24 | 25 | # CircuitPython-specific files 26 | *.mpy 27 | 28 | # Python-specific files 29 | __pycache__ 30 | *.pyc 31 | 32 | # Sphinx build-specific files 33 | _build 34 | 35 | # This file results from running `pip -e install .` in a local repository 36 | *.egg-info 37 | 38 | # Virtual environment-specific files 39 | .env 40 | .venv 41 | 42 | # MacOS-specific files 43 | *.DS_Store 44 | 45 | # IDE-specific files 46 | .idea 47 | .vscode 48 | *~ 49 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: Unlicense 4 | 5 | repos: 6 | - repo: https://github.com/pre-commit/pre-commit-hooks 7 | rev: v4.5.0 8 | hooks: 9 | - id: check-yaml 10 | - id: end-of-file-fixer 11 | - id: trailing-whitespace 12 | - repo: https://github.com/astral-sh/ruff-pre-commit 13 | rev: v0.3.4 14 | hooks: 15 | - id: ruff-format 16 | - id: ruff 17 | args: ["--fix"] 18 | - repo: https://github.com/fsfe/reuse-tool 19 | rev: v3.0.1 20 | hooks: 21 | - id: reuse 22 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: Unlicense 4 | 5 | # Read the Docs configuration file 6 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 7 | 8 | # Required 9 | version: 2 10 | 11 | sphinx: 12 | configuration: docs/conf.py 13 | 14 | build: 15 | os: ubuntu-20.04 16 | tools: 17 | python: "3" 18 | 19 | python: 20 | install: 21 | - requirements: docs/requirements.txt 22 | - requirements: requirements.txt 23 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | # Adafruit Community Code of Conduct 8 | 9 | ## Our Pledge 10 | 11 | In the interest of fostering an open and welcoming environment, we as 12 | contributors and leaders pledge to making participation in our project and 13 | our community a harassment-free experience for everyone, regardless of age, body 14 | size, disability, ethnicity, gender identity and expression, level or type of 15 | experience, education, socio-economic status, nationality, personal appearance, 16 | race, religion, or sexual identity and orientation. 17 | 18 | ## Our Standards 19 | 20 | We are committed to providing a friendly, safe and welcoming environment for 21 | all. 22 | 23 | Examples of behavior that contributes to creating a positive environment 24 | include: 25 | 26 | * Be kind and courteous to others 27 | * Using welcoming and inclusive language 28 | * Being respectful of differing viewpoints and experiences 29 | * Collaborating with other community members 30 | * Gracefully accepting constructive criticism 31 | * Focusing on what is best for the community 32 | * Showing empathy towards other community members 33 | 34 | Examples of unacceptable behavior by participants include: 35 | 36 | * The use of sexualized language or imagery and sexual attention or advances 37 | * The use of inappropriate images, including in a community member's avatar 38 | * The use of inappropriate language, including in a community member's nickname 39 | * Any spamming, flaming, baiting or other attention-stealing behavior 40 | * Excessive or unwelcome helping; answering outside the scope of the question 41 | asked 42 | * Trolling, insulting/derogatory comments, and personal or political attacks 43 | * Promoting or spreading disinformation, lies, or conspiracy theories against 44 | a person, group, organisation, project, or community 45 | * Public or private harassment 46 | * Publishing others' private information, such as a physical or electronic 47 | address, without explicit permission 48 | * Other conduct which could reasonably be considered inappropriate 49 | 50 | The goal of the standards and moderation guidelines outlined here is to build 51 | and maintain a respectful community. We ask that you don’t just aim to be 52 | "technically unimpeachable", but rather try to be your best self. 53 | 54 | We value many things beyond technical expertise, including collaboration and 55 | supporting others within our community. Providing a positive experience for 56 | other community members can have a much more significant impact than simply 57 | providing the correct answer. 58 | 59 | ## Our Responsibilities 60 | 61 | Project leaders are responsible for clarifying the standards of acceptable 62 | behavior and are expected to take appropriate and fair corrective action in 63 | response to any instances of unacceptable behavior. 64 | 65 | Project leaders have the right and responsibility to remove, edit, or 66 | reject messages, comments, commits, code, issues, and other contributions 67 | that are not aligned to this Code of Conduct, or to ban temporarily or 68 | permanently any community member for other behaviors that they deem 69 | inappropriate, threatening, offensive, or harmful. 70 | 71 | ## Moderation 72 | 73 | Instances of behaviors that violate the Adafruit Community Code of Conduct 74 | may be reported by any member of the community. Community members are 75 | encouraged to report these situations, including situations they witness 76 | involving other community members. 77 | 78 | You may report in the following ways: 79 | 80 | In any situation, you may send an email to . 81 | 82 | On the Adafruit Discord, you may send an open message from any channel 83 | to all Community Moderators by tagging @community moderators. You may 84 | also send an open message from any channel, or a direct message to 85 | @kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442, 86 | @sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175. 87 | 88 | Email and direct message reports will be kept confidential. 89 | 90 | In situations on Discord where the issue is particularly egregious, possibly 91 | illegal, requires immediate action, or violates the Discord terms of service, 92 | you should also report the message directly to Discord. 93 | 94 | These are the steps for upholding our community’s standards of conduct. 95 | 96 | 1. Any member of the community may report any situation that violates the 97 | Adafruit Community Code of Conduct. All reports will be reviewed and 98 | investigated. 99 | 2. If the behavior is an egregious violation, the community member who 100 | committed the violation may be banned immediately, without warning. 101 | 3. Otherwise, moderators will first respond to such behavior with a warning. 102 | 4. Moderators follow a soft "three strikes" policy - the community member may 103 | be given another chance, if they are receptive to the warning and change their 104 | behavior. 105 | 5. If the community member is unreceptive or unreasonable when warned by a 106 | moderator, or the warning goes unheeded, they may be banned for a first or 107 | second offense. Repeated offenses will result in the community member being 108 | banned. 109 | 110 | ## Scope 111 | 112 | This Code of Conduct and the enforcement policies listed above apply to all 113 | Adafruit Community venues. This includes but is not limited to any community 114 | spaces (both public and private), the entire Adafruit Discord server, and 115 | Adafruit GitHub repositories. Examples of Adafruit Community spaces include 116 | but are not limited to meet-ups, audio chats on the Adafruit Discord, or 117 | interaction at a conference. 118 | 119 | This Code of Conduct applies both within project spaces and in public spaces 120 | when an individual is representing the project or its community. As a community 121 | member, you are representing our community, and are expected to behave 122 | accordingly. 123 | 124 | ## Attribution 125 | 126 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 127 | version 1.4, available at 128 | , 129 | and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html). 130 | 131 | For other projects adopting the Adafruit Community Code of 132 | Conduct, please contact the maintainers of those projects for enforcement. 133 | If you wish to use this code of conduct for your own project, consider 134 | explicitly mentioning your moderation policy or making a copy with your 135 | own moderation policy so as to avoid confusion. 136 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 ladyada for adafruit industries 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 all 13 | 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSES/CC-BY-4.0.txt: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution 4.0 International Creative Commons Corporation 2 | ("Creative Commons") is not a law firm and does not provide legal services 3 | or legal advice. Distribution of Creative Commons public licenses does not 4 | create a lawyer-client or other relationship. Creative Commons makes its licenses 5 | and related information available on an "as-is" basis. Creative Commons gives 6 | no warranties regarding its licenses, any material licensed under their terms 7 | and conditions, or any related information. Creative Commons disclaims all 8 | liability for damages resulting from their use to the fullest extent possible. 9 | 10 | Using Creative Commons Public Licenses 11 | 12 | Creative Commons public licenses provide a standard set of terms and conditions 13 | that creators and other rights holders may use to share original works of 14 | authorship and other material subject to copyright and certain other rights 15 | specified in the public license below. The following considerations are for 16 | informational purposes only, are not exhaustive, and do not form part of our 17 | licenses. 18 | 19 | Considerations for licensors: Our public licenses are intended for use by 20 | those authorized to give the public permission to use material in ways otherwise 21 | restricted by copyright and certain other rights. Our licenses are irrevocable. 22 | Licensors should read and understand the terms and conditions of the license 23 | they choose before applying it. Licensors should also secure all rights necessary 24 | before applying our licenses so that the public can reuse the material as 25 | expected. Licensors should clearly mark any material not subject to the license. 26 | This includes other CC-licensed material, or material used under an exception 27 | or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors 28 | 29 | Considerations for the public: By using one of our public licenses, a licensor 30 | grants the public permission to use the licensed material under specified 31 | terms and conditions. If the licensor's permission is not necessary for any 32 | reason–for example, because of any applicable exception or limitation to copyright–then 33 | that use is not regulated by the license. Our licenses grant only permissions 34 | under copyright and certain other rights that a licensor has authority to 35 | grant. Use of the licensed material may still be restricted for other reasons, 36 | including because others have copyright or other rights in the material. A 37 | licensor may make special requests, such as asking that all changes be marked 38 | or described. Although not required by our licenses, you are encouraged to 39 | respect those requests where reasonable. More considerations for the public 40 | : wiki.creativecommons.org/Considerations_for_licensees Creative Commons Attribution 41 | 4.0 International Public License 42 | 43 | By exercising the Licensed Rights (defined below), You accept and agree to 44 | be bound by the terms and conditions of this Creative Commons Attribution 45 | 4.0 International Public License ("Public License"). To the extent this Public 46 | License may be interpreted as a contract, You are granted the Licensed Rights 47 | in consideration of Your acceptance of these terms and conditions, and the 48 | Licensor grants You such rights in consideration of benefits the Licensor 49 | receives from making the Licensed Material available under these terms and 50 | conditions. 51 | 52 | Section 1 – Definitions. 53 | 54 | a. Adapted Material means material subject to Copyright and Similar Rights 55 | that is derived from or based upon the Licensed Material and in which the 56 | Licensed Material is translated, altered, arranged, transformed, or otherwise 57 | modified in a manner requiring permission under the Copyright and Similar 58 | Rights held by the Licensor. For purposes of this Public License, where the 59 | Licensed Material is a musical work, performance, or sound recording, Adapted 60 | Material is always produced where the Licensed Material is synched in timed 61 | relation with a moving image. 62 | 63 | b. Adapter's License means the license You apply to Your Copyright and Similar 64 | Rights in Your contributions to Adapted Material in accordance with the terms 65 | and conditions of this Public License. 66 | 67 | c. Copyright and Similar Rights means copyright and/or similar rights closely 68 | related to copyright including, without limitation, performance, broadcast, 69 | sound recording, and Sui Generis Database Rights, without regard to how the 70 | rights are labeled or categorized. For purposes of this Public License, the 71 | rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. 72 | 73 | d. Effective Technological Measures means those measures that, in the absence 74 | of proper authority, may not be circumvented under laws fulfilling obligations 75 | under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, 76 | and/or similar international agreements. 77 | 78 | e. Exceptions and Limitations means fair use, fair dealing, and/or any other 79 | exception or limitation to Copyright and Similar Rights that applies to Your 80 | use of the Licensed Material. 81 | 82 | f. Licensed Material means the artistic or literary work, database, or other 83 | material to which the Licensor applied this Public License. 84 | 85 | g. Licensed Rights means the rights granted to You subject to the terms and 86 | conditions of this Public License, which are limited to all Copyright and 87 | Similar Rights that apply to Your use of the Licensed Material and that the 88 | Licensor has authority to license. 89 | 90 | h. Licensor means the individual(s) or entity(ies) granting rights under this 91 | Public License. 92 | 93 | i. Share means to provide material to the public by any means or process that 94 | requires permission under the Licensed Rights, such as reproduction, public 95 | display, public performance, distribution, dissemination, communication, or 96 | importation, and to make material available to the public including in ways 97 | that members of the public may access the material from a place and at a time 98 | individually chosen by them. 99 | 100 | j. Sui Generis Database Rights means rights other than copyright resulting 101 | from Directive 96/9/EC of the European Parliament and of the Council of 11 102 | March 1996 on the legal protection of databases, as amended and/or succeeded, 103 | as well as other essentially equivalent rights anywhere in the world. 104 | 105 | k. You means the individual or entity exercising the Licensed Rights under 106 | this Public License. Your has a corresponding meaning. 107 | 108 | Section 2 – Scope. 109 | 110 | a. License grant. 111 | 112 | 1. Subject to the terms and conditions of this Public License, the Licensor 113 | hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, 114 | irrevocable license to exercise the Licensed Rights in the Licensed Material 115 | to: 116 | 117 | A. reproduce and Share the Licensed Material, in whole or in part; and 118 | 119 | B. produce, reproduce, and Share Adapted Material. 120 | 121 | 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions 122 | and Limitations apply to Your use, this Public License does not apply, and 123 | You do not need to comply with its terms and conditions. 124 | 125 | 3. Term. The term of this Public License is specified in Section 6(a). 126 | 127 | 4. Media and formats; technical modifications allowed. The Licensor authorizes 128 | You to exercise the Licensed Rights in all media and formats whether now known 129 | or hereafter created, and to make technical modifications necessary to do 130 | so. The Licensor waives and/or agrees not to assert any right or authority 131 | to forbid You from making technical modifications necessary to exercise the 132 | Licensed Rights, including technical modifications necessary to circumvent 133 | Effective Technological Measures. For purposes of this Public License, simply 134 | making modifications authorized by this Section 2(a)(4) never produces Adapted 135 | Material. 136 | 137 | 5. Downstream recipients. 138 | 139 | A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed 140 | Material automatically receives an offer from the Licensor to exercise the 141 | Licensed Rights under the terms and conditions of this Public License. 142 | 143 | B. No downstream restrictions. You may not offer or impose any additional 144 | or different terms or conditions on, or apply any Effective Technological 145 | Measures to, the Licensed Material if doing so restricts exercise of the Licensed 146 | Rights by any recipient of the Licensed Material. 147 | 148 | 6. No endorsement. Nothing in this Public License constitutes or may be construed 149 | as permission to assert or imply that You are, or that Your use of the Licensed 150 | Material is, connected with, or sponsored, endorsed, or granted official status 151 | by, the Licensor or others designated to receive attribution as provided in 152 | Section 3(a)(1)(A)(i). 153 | 154 | b. Other rights. 155 | 156 | 1. Moral rights, such as the right of integrity, are not licensed under this 157 | Public License, nor are publicity, privacy, and/or other similar personality 158 | rights; however, to the extent possible, the Licensor waives and/or agrees 159 | not to assert any such rights held by the Licensor to the limited extent necessary 160 | to allow You to exercise the Licensed Rights, but not otherwise. 161 | 162 | 2. Patent and trademark rights are not licensed under this Public License. 163 | 164 | 3. To the extent possible, the Licensor waives any right to collect royalties 165 | from You for the exercise of the Licensed Rights, whether directly or through 166 | a collecting society under any voluntary or waivable statutory or compulsory 167 | licensing scheme. In all other cases the Licensor expressly reserves any right 168 | to collect such royalties. 169 | 170 | Section 3 – License Conditions. 171 | 172 | Your exercise of the Licensed Rights is expressly made subject to the following 173 | conditions. 174 | 175 | a. Attribution. 176 | 177 | 1. If You Share the Licensed Material (including in modified form), You must: 178 | 179 | A. retain the following if it is supplied by the Licensor with the Licensed 180 | Material: 181 | 182 | i. identification of the creator(s) of the Licensed Material and any others 183 | designated to receive attribution, in any reasonable manner requested by the 184 | Licensor (including by pseudonym if designated); 185 | 186 | ii. a copyright notice; 187 | 188 | iii. a notice that refers to this Public License; 189 | 190 | iv. a notice that refers to the disclaimer of warranties; 191 | 192 | v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; 193 | 194 | B. indicate if You modified the Licensed Material and retain an indication 195 | of any previous modifications; and 196 | 197 | C. indicate the Licensed Material is licensed under this Public License, and 198 | include the text of, or the URI or hyperlink to, this Public License. 199 | 200 | 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner 201 | based on the medium, means, and context in which You Share the Licensed Material. 202 | For example, it may be reasonable to satisfy the conditions by providing a 203 | URI or hyperlink to a resource that includes the required information. 204 | 205 | 3. If requested by the Licensor, You must remove any of the information required 206 | by Section 3(a)(1)(A) to the extent reasonably practicable. 207 | 208 | 4. If You Share Adapted Material You produce, the Adapter's License You apply 209 | must not prevent recipients of the Adapted Material from complying with this 210 | Public License. 211 | 212 | Section 4 – Sui Generis Database Rights. 213 | 214 | Where the Licensed Rights include Sui Generis Database Rights that apply to 215 | Your use of the Licensed Material: 216 | 217 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, 218 | reuse, reproduce, and Share all or a substantial portion of the contents of 219 | the database; 220 | 221 | b. if You include all or a substantial portion of the database contents in 222 | a database in which You have Sui Generis Database Rights, then the database 223 | in which You have Sui Generis Database Rights (but not its individual contents) 224 | is Adapted Material; and 225 | 226 | c. You must comply with the conditions in Section 3(a) if You Share all or 227 | a substantial portion of the contents of the database. 228 | 229 | For the avoidance of doubt, this Section 4 supplements and does not replace 230 | Your obligations under this Public License where the Licensed Rights include 231 | other Copyright and Similar Rights. 232 | 233 | Section 5 – Disclaimer of Warranties and Limitation of Liability. 234 | 235 | a. Unless otherwise separately undertaken by the Licensor, to the extent possible, 236 | the Licensor offers the Licensed Material as-is and as-available, and makes 237 | no representations or warranties of any kind concerning the Licensed Material, 238 | whether express, implied, statutory, or other. This includes, without limitation, 239 | warranties of title, merchantability, fitness for a particular purpose, non-infringement, 240 | absence of latent or other defects, accuracy, or the presence or absence of 241 | errors, whether or not known or discoverable. Where disclaimers of warranties 242 | are not allowed in full or in part, this disclaimer may not apply to You. 243 | 244 | b. To the extent possible, in no event will the Licensor be liable to You 245 | on any legal theory (including, without limitation, negligence) or otherwise 246 | for any direct, special, indirect, incidental, consequential, punitive, exemplary, 247 | or other losses, costs, expenses, or damages arising out of this Public License 248 | or use of the Licensed Material, even if the Licensor has been advised of 249 | the possibility of such losses, costs, expenses, or damages. Where a limitation 250 | of liability is not allowed in full or in part, this limitation may not apply 251 | to You. 252 | 253 | c. The disclaimer of warranties and limitation of liability provided above 254 | shall be interpreted in a manner that, to the extent possible, most closely 255 | approximates an absolute disclaimer and waiver of all liability. 256 | 257 | Section 6 – Term and Termination. 258 | 259 | a. This Public License applies for the term of the Copyright and Similar Rights 260 | licensed here. However, if You fail to comply with this Public License, then 261 | Your rights under this Public License terminate automatically. 262 | 263 | b. Where Your right to use the Licensed Material has terminated under Section 264 | 6(a), it reinstates: 265 | 266 | 1. automatically as of the date the violation is cured, provided it is cured 267 | within 30 days of Your discovery of the violation; or 268 | 269 | 2. upon express reinstatement by the Licensor. 270 | 271 | c. For the avoidance of doubt, this Section 6(b) does not affect any right 272 | the Licensor may have to seek remedies for Your violations of this Public 273 | License. 274 | 275 | d. For the avoidance of doubt, the Licensor may also offer the Licensed Material 276 | under separate terms or conditions or stop distributing the Licensed Material 277 | at any time; however, doing so will not terminate this Public License. 278 | 279 | e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 280 | 281 | Section 7 – Other Terms and Conditions. 282 | 283 | a. The Licensor shall not be bound by any additional or different terms or 284 | conditions communicated by You unless expressly agreed. 285 | 286 | b. Any arrangements, understandings, or agreements regarding the Licensed 287 | Material not stated herein are separate from and independent of the terms 288 | and conditions of this Public License. 289 | 290 | Section 8 – Interpretation. 291 | 292 | a. For the avoidance of doubt, this Public License does not, and shall not 293 | be interpreted to, reduce, limit, restrict, or impose conditions on any use 294 | of the Licensed Material that could lawfully be made without permission under 295 | this Public License. 296 | 297 | b. To the extent possible, if any provision of this Public License is deemed 298 | unenforceable, it shall be automatically reformed to the minimum extent necessary 299 | to make it enforceable. If the provision cannot be reformed, it shall be severed 300 | from this Public License without affecting the enforceability of the remaining 301 | terms and conditions. 302 | 303 | c. No term or condition of this Public License will be waived and no failure 304 | to comply consented to unless expressly agreed to by the Licensor. 305 | 306 | d. Nothing in this Public License constitutes or may be interpreted as a limitation 307 | upon, or waiver of, any privileges and immunities that apply to the Licensor 308 | or You, including from the legal processes of any jurisdiction or authority. 309 | 310 | Creative Commons is not a party to its public licenses. Notwithstanding, Creative 311 | Commons may elect to apply one of its public licenses to material it publishes 312 | and in those instances will be considered the "Licensor." The text of the 313 | Creative Commons public licenses is dedicated to the public domain under the 314 | CC0 Public Domain Dedication. Except for the limited purpose of indicating 315 | that material is shared under a Creative Commons public license or as otherwise 316 | permitted by the Creative Commons policies published at creativecommons.org/policies, 317 | Creative Commons does not authorize the use of the trademark "Creative Commons" 318 | or any other trademark or logo of Creative Commons without its prior written 319 | consent including, without limitation, in connection with any unauthorized 320 | modifications to any of its public licenses or any other arrangements, understandings, 321 | or agreements concerning use of licensed material. For the avoidance of doubt, 322 | this paragraph does not form part of the public licenses. 323 | 324 | Creative Commons may be contacted at creativecommons.org. 325 | -------------------------------------------------------------------------------- /LICENSES/MIT.txt: -------------------------------------------------------------------------------- 1 | MIT License Copyright (c) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice (including the next 11 | paragraph) shall be included in all copies or substantial portions of the 12 | Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS 17 | OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 19 | OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /LICENSES/Unlicense.txt: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute 4 | this software, either in source code form or as a compiled binary, for any 5 | purpose, commercial or non-commercial, and by any means. 6 | 7 | In jurisdictions that recognize copyright laws, the author or authors of this 8 | software dedicate any and all copyright interest in the software to the public 9 | domain. We make this dedication for the benefit of the public at large and 10 | to the detriment of our heirs and successors. We intend this dedication to 11 | be an overt act of relinquishment in perpetuity of all present and future 12 | rights to this software under copyright law. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS 17 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 18 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH 19 | THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, 20 | please refer to 21 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | 2 | Introduction 3 | ============ 4 | 5 | .. image:: https://readthedocs.org/projects/adafruit-circuitpython-avrprog/badge/?version=latest 6 | :target: https://docs.circuitpython.org/projects/avrprog/en/latest/ 7 | :alt: Documentation Status 8 | 9 | .. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg 10 | :target: https://adafru.it/discord 11 | :alt: Discord 12 | 13 | .. image:: https://github.com/adafruit/Adafruit_CircuitPython_AVRprog/workflows/Build%20CI/badge.svg 14 | :target: https://github.com/adafruit/Adafruit_CircuitPython_AVRprog/actions/ 15 | :alt: Build Status 16 | 17 | .. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json 18 | :target: https://github.com/astral-sh/ruff 19 | :alt: Code Style: Ruff 20 | 21 | Program your favorite AVR chips directly from CircuitPython with this handy helper class that will let you make stand-alone programmers right from your REPL. Should work with any/all AVR chips, via SPI programming. Tested with ATmega328, ATtiny85 and ATmega2560 22 | 23 | Dependencies 24 | ============= 25 | This driver depends on: 26 | 27 | * `Adafruit CircuitPython `_ 28 | 29 | Please ensure all dependencies are available on the CircuitPython filesystem. 30 | This is easily achieved by downloading 31 | `the Adafruit library and driver bundle `_. 32 | 33 | Installing from PyPI 34 | ==================== 35 | 36 | On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from 37 | PyPI `_. To install for current user: 38 | 39 | .. code-block:: shell 40 | 41 | pip3 install adafruit-circuitpython-avrprog 42 | 43 | To install system-wide (this may be required in some cases): 44 | 45 | .. code-block:: shell 46 | 47 | sudo pip3 install adafruit-circuitpython-avrprog 48 | 49 | To install in a virtual environment in your current project: 50 | 51 | .. code-block:: shell 52 | 53 | mkdir project-name && cd project-name 54 | python3 -m venv .venv 55 | source .venv/bin/activate 56 | pip3 install adafruit-circuitpython-avrprog 57 | 58 | Usage Example 59 | ============= 60 | 61 | See examples folder for full examples that progam various bootloaders onto chips. 62 | 63 | Documentation 64 | ============= 65 | 66 | API documentation for this library can be found on `Read the Docs `_. 67 | 68 | For information on building library documentation, please check out `this guide `_. 69 | 70 | Contributing 71 | ============ 72 | 73 | Contributions are welcome! Please read our `Code of Conduct 74 | `_ 75 | before contributing to help this project stay welcoming. 76 | -------------------------------------------------------------------------------- /README.rst.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries 2 | 3 | SPDX-License-Identifier: MIT 4 | -------------------------------------------------------------------------------- /adafruit_avrprog.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2017 ladyada for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | """ 6 | `adafruit_avrprog` 7 | ==================================================== 8 | 9 | Program your favorite AVR chips directly from CircuitPython with this 10 | handy helper class that will let you make stand-alone programmers right 11 | from your REPL 12 | 13 | * Author(s): ladyada 14 | 15 | Implementation Notes 16 | -------------------- 17 | 18 | **Hardware:** 19 | 20 | * See Learn Guide for supported hardware: `Stand-alone programming AVRs using CircuitPython 21 | `_ 22 | 23 | **Software and Dependencies:** 24 | 25 | * Adafruit CircuitPython firmware for the ESP8622 and M0-based boards: 26 | https://github.com/adafruit/circuitpython/releases 27 | 28 | """ 29 | 30 | # imports 31 | 32 | __version__ = "0.0.0+auto.0" 33 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_AVRprog.git" 34 | 35 | try: 36 | from os import PathLike 37 | from typing import List, Optional, Tuple, TypedDict, Union 38 | 39 | from busio import SPI 40 | from microcontroller import Pin 41 | from typing_extensions import TypeAlias 42 | 43 | # Technically this type should come from: from _typeshed import FileDescriptorOrPath 44 | # Unfortunately _typeshed is only in the standard library in newer releases of Python, e.g. 3.11 45 | # Thus have to define a placeholder 46 | FileDescriptorOrPath: TypeAlias = Union[int, str, bytes, PathLike[str], PathLike[bytes]] 47 | 48 | from io import TextIOWrapper 49 | 50 | class ChipDictionary(TypedDict): 51 | """ 52 | Dictionary representing a specific target chip type 53 | """ 54 | 55 | name: str 56 | sig: List[int] 57 | flash_size: int 58 | page_size: int 59 | fuse_mask: Tuple[int, int, int, int] 60 | 61 | class FileState(TypedDict): 62 | """ 63 | Dictionary representing a File State 64 | """ 65 | 66 | line: int 67 | ext_addr: int 68 | eof: bool 69 | f: Optional[TextIOWrapper] 70 | 71 | except ImportError: 72 | pass 73 | 74 | 75 | from digitalio import DigitalInOut, Direction 76 | 77 | _SLOW_CLOCK: int = 100000 78 | _FAST_CLOCK: int = 1000000 79 | 80 | 81 | class AVRprog: 82 | """ 83 | Helper class used to program AVR chips from CircuitPython. 84 | """ 85 | 86 | class Boards: 87 | """ 88 | Some well known board definitions. 89 | """ 90 | 91 | ATtiny13a = { 92 | "name": "ATtiny13a", 93 | "sig": [0x1E, 0x90, 0x07], 94 | "flash_size": 1024, 95 | "page_size": 32, 96 | "fuse_mask": (0xFF, 0xFF, 0x00, 0x03), 97 | "clock_speed": 100000, 98 | } 99 | ATtiny85 = { 100 | "name": "ATtiny85", 101 | "sig": [0x1E, 0x93, 0x0B], 102 | "flash_size": 8192, 103 | "page_size": 64, 104 | "fuse_mask": (0xFF, 0xFF, 0x07, 0x3F), 105 | } 106 | ATmega328p = { 107 | "name": "ATmega328p", 108 | "sig": [0x1E, 0x95, 0x0F], 109 | "flash_size": 32768, 110 | "page_size": 128, 111 | "fuse_mask": (0xFF, 0xFF, 0x07, 0x3F), 112 | } 113 | ATmega328pb = { 114 | "name": "ATmega328pb", 115 | "sig": [0x1E, 0x95, 0x16], 116 | "flash_size": 32768, 117 | "page_size": 128, 118 | "fuse_mask": (0xFF, 0xFF, 0x07, 0x3F), 119 | } 120 | ATmega644pa = { 121 | "name": "ATmega644pa", 122 | "sig": [0x1E, 0x96, 0x0A], 123 | "flash_size": 65536, 124 | "page_size": 256, 125 | "fuse_mask": (0xF7, 0x8F, 0xFD, 0xFF), 126 | } 127 | ATmega2560 = { 128 | "name": "ATmega2560", 129 | "sig": [0x1E, 0x98, 0x01], 130 | "flash_size": 262144, 131 | "page_size": 256, 132 | "fuse_mask": (0xFF, 0xFF, 0x07, 0x3F), 133 | } 134 | 135 | _spi: Optional[SPI] = None 136 | _rst: Optional[DigitalInOut] = None 137 | 138 | def init(self, spi_bus: SPI, rst_pin: Pin) -> None: 139 | """ 140 | Initialize the programmer with an SPI port that will be used to 141 | communicate with the chip. Make sure your SPI supports 'write_readinto' 142 | Also pass in a reset pin that will be used to get into programming mode 143 | """ 144 | self._spi = spi_bus 145 | self._rst = DigitalInOut(rst_pin) 146 | self._rst.direction = Direction.OUTPUT 147 | self._rst.value = True 148 | 149 | def verify_sig(self, chip: ChipDictionary, verbose: bool = False) -> bool: 150 | """ 151 | Verify that the chip is connected properly, responds to commands, 152 | and has the correct signature. Returns True/False based on success 153 | """ 154 | self.begin(clock=_SLOW_CLOCK) 155 | sig = self.read_signature() 156 | self.end() 157 | if verbose: 158 | print(f"Found signature: {[hex(i) for i in sig]}") 159 | if sig != chip["sig"]: 160 | return False 161 | return True 162 | 163 | def program_file( 164 | self, 165 | chip: ChipDictionary, 166 | file_name: FileDescriptorOrPath, 167 | verbose: bool = False, 168 | verify: bool = True, 169 | ) -> bool: 170 | """ 171 | Perform a chip erase and program from a file that 172 | contains Intel HEX data. Returns true on verify-success, False on 173 | verify-failure. If 'verify' is False, return will always be True 174 | """ 175 | if not self.verify_sig(chip): 176 | raise RuntimeError("Signature read failure") 177 | 178 | if verbose: 179 | print("Erasing chip....") 180 | self.erase_chip() 181 | 182 | clock_speed = chip.get("clock_speed", _FAST_CLOCK) 183 | self.begin(clock=clock_speed) 184 | 185 | # create a file state dictionary 186 | file_state = {"line": 0, "ext_addr": 0, "eof": False, "f": None} 187 | with open(file_name) as file_state["f"]: 188 | page_size = chip["page_size"] 189 | 190 | for page_addr in range(0, chip["flash_size"], page_size): 191 | if verbose: 192 | print(f"Programming page ${page_addr:04X}...", end="") 193 | page_buffer = bytearray(page_size) 194 | for b in range(page_size): 195 | page_buffer[b] = 0xFF # make an empty page 196 | 197 | read_hex_page(file_state, page_addr, page_size, page_buffer) 198 | 199 | if all(v == 255 for v in page_buffer): 200 | if verbose: 201 | print("skipping") 202 | continue 203 | 204 | # print("From HEX file: ", page_buffer) 205 | self._flash_page(bytearray(page_buffer), page_addr, page_size) 206 | 207 | if not verify: 208 | if verbose: 209 | print("done!") 210 | continue 211 | 212 | if verbose: 213 | print(f"Verifying page @ ${page_addr:04X}") 214 | read_buffer = bytearray(page_size) 215 | self.read(page_addr, read_buffer) 216 | # print("From memory: ", read_buffer) 217 | 218 | if page_buffer != read_buffer: 219 | if verbose: 220 | print( 221 | f"Verify fail at address {page_addr:04X}\nPage should be: {page_buffer}\nBut contains: {read_buffer}" 222 | ) 223 | self.end() 224 | return False 225 | 226 | if file_state["eof"]: 227 | break # we're done, bail! 228 | 229 | self.end() 230 | return True 231 | 232 | def verify_file( 233 | self, 234 | chip: ChipDictionary, 235 | file_name: FileDescriptorOrPath, 236 | verbose: bool = False, 237 | ) -> bool: 238 | """ 239 | Perform a chip full-flash verification from a file that 240 | contains Intel HEX data. Returns True/False on success/fail. 241 | """ 242 | if not self.verify_sig(chip): 243 | raise RuntimeError("Signature read failure") 244 | 245 | # create a file state dictionary 246 | file_state = {"line": 0, "ext_addr": 0, "eof": False, "f": None} 247 | with open(file_name) as file_state["f"]: 248 | page_size = chip["page_size"] 249 | clock_speed = chip.get("clock_speed", _FAST_CLOCK) 250 | self.begin(clock=clock_speed) 251 | for page_addr in range(0x0, chip["flash_size"], page_size): 252 | page_buffer = bytearray(page_size) 253 | for b in range(page_size): 254 | page_buffer[b] = 0xFF # make an empty page 255 | 256 | read_hex_page(file_state, page_addr, page_size, page_buffer) 257 | 258 | if verbose: 259 | print(f"Verifying page @ ${page_addr:04X}") 260 | read_buffer = bytearray(page_size) 261 | self.read(page_addr, read_buffer) 262 | # print("From memory: ", read_buffer) 263 | # print("From file : ", page_buffer) 264 | 265 | if page_buffer != read_buffer: 266 | if verbose: 267 | print( 268 | f"Verify fail at address {page_addr:04X}\nPage should be: {page_buffer}\nBut contains: {read_buffer}" 269 | ) 270 | self.end() 271 | return False 272 | 273 | if file_state["eof"]: 274 | break # we're done, bail! 275 | 276 | self.end() 277 | return True 278 | 279 | def read_fuses(self, chip: ChipDictionary) -> Tuple[int, int, int, int]: 280 | """ 281 | Read the 4 fuses and return them in a tuple (low, high, ext, lock) 282 | Each fuse is bitwise-&'s with the chip's fuse mask for simplicity 283 | """ 284 | mask: Tuple[int, int, int, int] = chip["fuse_mask"] 285 | self.begin(clock=_SLOW_CLOCK) 286 | low = self._transaction((0x50, 0, 0, 0))[2] & mask[0] 287 | high = self._transaction((0x58, 0x08, 0, 0))[2] & mask[1] 288 | ext = self._transaction((0x50, 0x08, 0, 0))[2] & mask[2] 289 | lock = self._transaction((0x58, 0, 0, 0))[2] & mask[3] 290 | self.end() 291 | return (low, high, ext, lock) 292 | 293 | def write_fuses( 294 | self, 295 | chip: ChipDictionary, 296 | low: Optional[int] = None, 297 | high: Optional[int] = None, 298 | ext: Optional[int] = None, 299 | lock: Optional[int] = None, 300 | ) -> None: 301 | """ 302 | Write any of the 4 fuses. If the kwarg low/high/ext/lock is not 303 | passed in or is None, that fuse is skipped 304 | """ 305 | transaction_comp = (0xE0, 0xA0, 0xA8, 0xA4) 306 | fuses = (lock, low, high, ext) 307 | self.begin(clock=_SLOW_CLOCK) 308 | for fuse, comp in zip(fuses, transaction_comp): 309 | if fuse: 310 | self._transaction((0xAC, comp, 0, fuse)) 311 | self._busy_wait() 312 | self.end() 313 | 314 | def verify_fuses( 315 | self, 316 | chip: ChipDictionary, 317 | low: Optional[int] = None, 318 | high: Optional[int] = None, 319 | ext: Optional[int] = None, 320 | lock: Optional[int] = None, 321 | ) -> bool: 322 | """ 323 | Verify the 4 fuses. If the kwarg low/high/ext/lock is not 324 | passed in or is None, that fuse is not checked. 325 | Each fuse is bitwise-&'s with the chip's fuse mask. 326 | Returns True on success, False on a fuse verification failure 327 | """ 328 | fuses = self.read_fuses(chip) 329 | verify = (low, high, ext, lock) 330 | for i in range(4): 331 | # check each fuse if we requested to check it! 332 | if verify[i] and verify[i] != fuses[i]: 333 | return False 334 | return True 335 | 336 | def erase_chip(self) -> None: 337 | """ 338 | Fully erases the chip. 339 | """ 340 | self.begin(clock=_SLOW_CLOCK) 341 | self._transaction((0xAC, 0x80, 0, 0)) 342 | self._busy_wait() 343 | self.end() 344 | 345 | #################### Mid level 346 | 347 | def begin(self, clock: int = _FAST_CLOCK) -> None: 348 | """ 349 | Begin programming mode: pull reset pin low, initialize SPI, and 350 | send the initialization command to get the AVR's attention. 351 | """ 352 | self._rst.value = False 353 | while self._spi and not self._spi.try_lock(): 354 | pass 355 | self._spi.configure(baudrate=clock) 356 | self._transaction((0xAC, 0x53, 0, 0)) 357 | 358 | def end(self) -> None: 359 | """ 360 | End programming mode: SPI is released, and reset pin set high. 361 | """ 362 | self._spi.unlock() 363 | self._rst.value = True 364 | 365 | def read_signature(self) -> List[int]: 366 | """ 367 | Read and return the signature of the chip as two bytes in an array. 368 | Requires calling begin() beforehand to put in programming mode. 369 | """ 370 | # signature is last byte of two transactions: 371 | sig = [] 372 | for i in range(3): 373 | sig.append(self._transaction((0x30, 0, i, 0))[2]) 374 | return sig 375 | 376 | def read(self, addr: int, read_buffer: bytearray) -> None: 377 | """ 378 | Read a chunk of memory from address 'addr'. The amount read is the 379 | same as the size of the bytearray 'read_buffer'. Data read is placed 380 | directly into 'read_buffer' 381 | Requires calling begin() beforehand to put in programming mode. 382 | """ 383 | last_addr = 0 384 | for i in range(len(read_buffer) // 2): 385 | read_addr = addr // 2 + i # read 'words' so address is half 386 | 387 | if (last_addr >> 16) != (read_addr >> 16): 388 | # load extended byte 389 | # print("Loading extended address", read_addr >> 16) 390 | self._transaction((0x4D, 0, read_addr >> 16, 0)) 391 | high = self._transaction((0x28, read_addr >> 8, read_addr, 0))[2] 392 | low = self._transaction((0x20, read_addr >> 8, read_addr, 0))[2] 393 | # print("%04X: %02X %02X" % (read_addr*2, low, high)) 394 | read_buffer[i * 2] = low 395 | read_buffer[i * 2 + 1] = high 396 | 397 | last_addr = read_addr 398 | 399 | #################### Low level 400 | def _flash_word(self, addr: int, low: int, high: int) -> None: 401 | self._transaction((0x40, addr >> 8, addr, low)) 402 | self._transaction((0x48, addr >> 8, addr, high)) 403 | 404 | def _flash_page(self, page_buffer: bytearray, page_addr: int, page_size: int) -> None: 405 | page_addr //= 2 # address is by 'words' not bytes! 406 | for i in range(page_size // 2): # page indexed by words, not bytes 407 | lo_byte, hi_byte = page_buffer[2 * i : 2 * i + 2] 408 | self._flash_word(i, lo_byte, hi_byte) 409 | 410 | # load extended byte 411 | self._transaction((0x4D, 0, page_addr >> 16, 0)) 412 | 413 | commit_reply = self._transaction((0x4C, page_addr >> 8, page_addr, 0)) 414 | if ((commit_reply[1] << 8) + commit_reply[2]) != (page_addr & 0xFFFF): 415 | raise RuntimeError("Failed to commit page to flash") 416 | self._busy_wait() 417 | 418 | def _transaction(self, command: Tuple[int, int, int, int]) -> bytearray: 419 | reply = bytearray(4) 420 | command_bytes = bytearray([i & 0xFF for i in command]) 421 | 422 | self._spi.write_readinto(command_bytes, reply) 423 | # s = [hex(i) for i in command_bytes] 424 | # print("Sending %s reply %s" % ([hex(i) for i in command_bytes], [hex(i) for i in reply])) 425 | if reply[2] != command_bytes[1]: 426 | raise RuntimeError("SPI transaction failed") 427 | return reply[1:] # first byte is ignored 428 | 429 | def _busy_wait(self) -> None: 430 | while self._transaction((0xF0, 0, 0, 0))[2] & 0x01: 431 | pass 432 | 433 | 434 | def read_hex_page( 435 | file_state: FileState, page_addr: int, page_size: int, page_buffer: bytearray 436 | ) -> bool: 437 | """ 438 | Helper function that does the Intel Hex parsing. Takes in a dictionary 439 | that contains the file 'state'. The dictionary should have file_state['f'] 440 | be the file stream object (returned by open), the file_state['line'] which 441 | tracks the line number of the file for better debug messages. This function 442 | will update 'line' as it reads lines. It will set 'eof' when the file has 443 | completed reading. It will also store the 'extended address' state in 444 | file_state['ext_addr'] 445 | In addition to the file, it takes the desired buffer address start 446 | (page_addr), size (page_size) and an allocated bytearray. 447 | This function will try to read the file and fill the page_buffer. 448 | If the next line has data that is beyond the size of the page_address, 449 | it will return without changing the buffer, so pre-fill it with 0xFF 450 | before calling, for sparsely-defined HEX files. 451 | Returns False if the file has no more data to read. Returns True if 452 | we've done the best job we can with filling the buffer and the next 453 | line does not contain any more data we can use. 454 | """ 455 | while True: # read until our page_buff is full! 456 | orig_loc = file_state["f"].tell() # in case we have to 'back up' 457 | line = file_state["f"].readline() # read one line from the HEX file 458 | file_state["line"] += 1 459 | 460 | if not line: 461 | file_state["eof"] = True 462 | return False 463 | # print(line) 464 | if line[0] != ":": # lines must start with ':' 465 | raise RuntimeError("HEX line %d doesn't start with :" % file_state["line"]) 466 | 467 | # Try to parse the line length, address, and record type 468 | try: 469 | hex_len = int(line[1:3], 16) 470 | line_addr = int(line[3:7], 16) 471 | file_state["line_addr"] = line_addr 472 | rec_type = int(line[7:9], 16) 473 | except ValueError as err: 474 | raise RuntimeError("Could not parse HEX line %d addr" % file_state["line"]) from err 475 | 476 | if file_state["ext_addr"]: 477 | line_addr += file_state["ext_addr"] 478 | # print("Hex len: %d, addr %04X, record type %d " % (hex_len, line_addr, rec_type)) 479 | 480 | # We should only look for data type records (0x00) 481 | if rec_type == 1: 482 | file_state["eof"] = True 483 | return False # reached end of file 484 | if rec_type == 2: 485 | file_state["ext_addr"] = int(line[9:13], 16) << 4 486 | # print("Extended addr: %05X" % file_state['ext_addr']) 487 | continue 488 | if rec_type == 3: # sometimes appears, we ignore this 489 | continue 490 | if rec_type == 4: 491 | file_state["ext_addr"] = int(line[9:13], 16) << 16 492 | # print("ExtLin addr: %05X" % file_state['ext_addr']) 493 | continue 494 | if rec_type != 0: # if not the above or a data record... 495 | raise RuntimeError( 496 | "Unsupported record type %d on line %d" % (rec_type, file_state["line"]) 497 | ) 498 | 499 | # check if this file file is either after the current page 500 | # (in which case, we've read all we can for this page and should 501 | # commence flasing...) 502 | if line_addr >= (page_addr + page_size): 503 | # print("Hex is past page address range") 504 | file_state["f"].seek(orig_loc) # back up! 505 | file_state["line"] -= 1 506 | return True 507 | # or, this line does not yet reach the current page address, in which 508 | # case which should just keep reading in hopes we reach the address 509 | # we're looking for next time! 510 | if (line_addr + hex_len) <= page_addr: 511 | # print("Hex is prior to page address range") 512 | continue 513 | 514 | # parse out all remaining hex bytes including the checksum 515 | byte_buffer = [] 516 | for i in range(hex_len + 1): 517 | byte_buffer.append(int(line[9 + i * 2 : 11 + i * 2], 16)) 518 | 519 | # check chksum now! 520 | chksum = hex_len + (line_addr >> 8) + (line_addr & 0xFF) + rec_type + sum(byte_buffer) 521 | # print("checksum: "+hex(chksum)) 522 | if (chksum & 0xFF) != 0: 523 | raise RuntimeError("HEX Checksum fail") 524 | 525 | # get rid of that checksum byte 526 | byte_buffer.pop() 527 | # print([hex(i) for i in byte_buffer]) 528 | 529 | # print("line addr $%04X page addr $%04X" % (line_addr, page_addr)) 530 | page_idx = line_addr - page_addr 531 | line_idx = 0 532 | while (page_idx < page_size) and (line_idx < hex_len): 533 | # print("page_idx = %d, line_idx = %d" % (page_idx, line_idx)) 534 | page_buffer[page_idx] = byte_buffer[line_idx] 535 | line_idx += 1 536 | page_idx += 1 537 | if page_idx == page_size: 538 | return True # ok we've read a full page, can bail now! 539 | 540 | return False # we...shouldn't get here? 541 | -------------------------------------------------------------------------------- /docs/_static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_AVRprog/30c252e6b14ace1855de2982af894eb5a0cde8af/docs/_static/favicon.ico -------------------------------------------------------------------------------- /docs/_static/favicon.ico.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries 2 | 3 | SPDX-License-Identifier: CC-BY-4.0 4 | -------------------------------------------------------------------------------- /docs/api.rst: -------------------------------------------------------------------------------- 1 | 2 | .. If you created a package, create one automodule per module in the package. 3 | 4 | API Reference 5 | ############# 6 | 7 | .. automodule:: adafruit_avrprog 8 | :members: 9 | -------------------------------------------------------------------------------- /docs/api.rst.license: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | import datetime 6 | import os 7 | import sys 8 | 9 | sys.path.insert(0, os.path.abspath("..")) 10 | 11 | # -- General configuration ------------------------------------------------ 12 | 13 | # Add any Sphinx extension module names here, as strings. They can be 14 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 15 | # ones. 16 | extensions = [ 17 | "sphinx.ext.autodoc", 18 | "sphinxcontrib.jquery", 19 | "sphinx.ext.intersphinx", 20 | "sphinx.ext.viewcode", 21 | ] 22 | 23 | # Uncomment the below if you use native CircuitPython modules such as 24 | # digitalio, micropython and busio. List the modules you use. Without it, the 25 | # autodoc module docs will fail to generate with a warning. 26 | # autodoc_mock_imports = ["digitalio"] 27 | 28 | intersphinx_mapping = { 29 | "python": ("https://docs.python.org/3", None), 30 | "CircuitPython": ("https://docs.circuitpython.org/en/latest/", None), 31 | } 32 | 33 | # Add any paths that contain templates here, relative to this directory. 34 | templates_path = ["_templates"] 35 | 36 | source_suffix = ".rst" 37 | 38 | # The master toctree document. 39 | master_doc = "index" 40 | 41 | # General information about the project. 42 | project = "Adafruit AVRprog Library" 43 | creation_year = "2017" 44 | current_year = str(datetime.datetime.now().year) 45 | year_duration = ( 46 | current_year if current_year == creation_year else creation_year + " - " + current_year 47 | ) 48 | copyright = year_duration + " ladyada" 49 | author = "ladyada" 50 | 51 | # The version info for the project you're documenting, acts as replacement for 52 | # |version| and |release|, also used in various other places throughout the 53 | # built documents. 54 | # 55 | # The short X.Y version. 56 | version = "1.0" 57 | # The full version, including alpha/beta/rc tags. 58 | release = "1.0" 59 | 60 | # The language for content autogenerated by Sphinx. Refer to documentation 61 | # for a list of supported languages. 62 | # 63 | # This is also used if you do content translation via gettext catalogs. 64 | # Usually you set "language" from the command line for these cases. 65 | language = "en" 66 | 67 | # List of patterns, relative to source directory, that match files and 68 | # directories to ignore when looking for source files. 69 | # This patterns also effect to html_static_path and html_extra_path 70 | exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"] 71 | 72 | # The reST default role (used for this markup: `text`) to use for all 73 | # documents. 74 | # 75 | default_role = "any" 76 | 77 | # If true, '()' will be appended to :func: etc. cross-reference text. 78 | # 79 | add_function_parentheses = True 80 | 81 | # The name of the Pygments (syntax highlighting) style to use. 82 | pygments_style = "sphinx" 83 | 84 | # If true, `todo` and `todoList` produce output, else they produce nothing. 85 | todo_include_todos = False 86 | 87 | # If this is True, todo emits a warning for each TODO entries. The default is False. 88 | todo_emit_warnings = True 89 | 90 | 91 | # -- Options for HTML output ---------------------------------------------- 92 | 93 | # The theme to use for HTML and HTML Help pages. See the documentation for 94 | # a list of builtin themes. 95 | # 96 | import sphinx_rtd_theme 97 | 98 | html_theme = "sphinx_rtd_theme" 99 | 100 | # Add any paths that contain custom static files (such as style sheets) here, 101 | # relative to this directory. They are copied after the builtin static files, 102 | # so a file named "default.css" will overwrite the builtin "default.css". 103 | html_static_path = ["_static"] 104 | 105 | # The name of an image file (relative to this directory) to use as a favicon of 106 | # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 107 | # pixels large. 108 | # 109 | html_favicon = "_static/favicon.ico" 110 | 111 | # Output file base name for HTML help builder. 112 | htmlhelp_basename = "AdafruitAvrprogLibrarydoc" 113 | 114 | # -- Options for LaTeX output --------------------------------------------- 115 | 116 | latex_elements = { 117 | # The paper size ('letterpaper' or 'a4paper'). 118 | # 119 | # 'papersize': 'letterpaper', 120 | # The font size ('10pt', '11pt' or '12pt'). 121 | # 122 | # 'pointsize': '10pt', 123 | # Additional stuff for the LaTeX preamble. 124 | # 125 | # 'preamble': '', 126 | # Latex figure (float) alignment 127 | # 128 | # 'figure_align': 'htbp', 129 | } 130 | 131 | # Grouping the document tree into LaTeX files. List of tuples 132 | # (source start file, target name, title, 133 | # author, documentclass [howto, manual, or own class]). 134 | latex_documents = [ 135 | ( 136 | master_doc, 137 | "AdafruitAVRprogLibrary.tex", 138 | "AdafruitAVRprog Library Documentation", 139 | author, 140 | "manual", 141 | ), 142 | ] 143 | 144 | # -- Options for manual page output --------------------------------------- 145 | 146 | # One entry per manual page. List of tuples 147 | # (source start file, name, description, authors, manual section). 148 | man_pages = [ 149 | ( 150 | master_doc, 151 | "AdafruitAVRproglibrary", 152 | "Adafruit AVRprog Library Documentation", 153 | [author], 154 | 1, 155 | ) 156 | ] 157 | 158 | # -- Options for Texinfo output ------------------------------------------- 159 | 160 | # Grouping the document tree into Texinfo files. List of tuples 161 | # (source start file, target name, title, author, 162 | # dir menu entry, description, category) 163 | texinfo_documents = [ 164 | ( 165 | master_doc, 166 | "AdafruitAVRprogLibrary", 167 | "Adafruit AVRprog Library Documentation", 168 | author, 169 | "AdafruitAVRprogLibrary", 170 | "One line description of project.", 171 | "Miscellaneous", 172 | ), 173 | ] 174 | -------------------------------------------------------------------------------- /docs/examples.rst: -------------------------------------------------------------------------------- 1 | Simple test 2 | ------------ 3 | 4 | Ensure your device works with this simple test. 5 | 6 | .. literalinclude:: ../examples/avrprog_read_signature_simpletest.py 7 | :caption: examples/avrprog_read_signature_simpletest.py 8 | :linenos: 9 | 10 | .. literalinclude:: ../examples/avrprog_program_trinket85.py 11 | :caption: examples/avrprog_program_trinket85.py 12 | :linenos: 13 | 14 | .. literalinclude:: ../examples/avrprog_program_uno328.py 15 | :caption: examples/avrprog_program_uno328.py 16 | :linenos: 17 | 18 | .. literalinclude:: ../examples/avrprog_program_mega2560.py 19 | :caption: examples/avrprog_program_mega2560.py 20 | :linenos: 21 | -------------------------------------------------------------------------------- /docs/examples.rst.license: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../README.rst 2 | 3 | Table of Contents 4 | ================= 5 | 6 | .. toctree:: 7 | :maxdepth: 4 8 | :hidden: 9 | 10 | self 11 | 12 | .. toctree:: 13 | :caption: Examples 14 | 15 | examples 16 | 17 | .. toctree:: 18 | :caption: API Reference 19 | :maxdepth: 3 20 | 21 | api 22 | 23 | .. toctree:: 24 | :caption: Tutorials 25 | 26 | .. toctree:: 27 | :caption: Related Products 28 | 29 | .. toctree:: 30 | :caption: Other Links 31 | 32 | Download from GitHub 33 | Download Library Bundle 34 | CircuitPython Reference Documentation 35 | CircuitPython Support Forum 36 | Discord Chat 37 | Adafruit Learning System 38 | Adafruit Blog 39 | Adafruit Store 40 | 41 | Indices and tables 42 | ================== 43 | 44 | * :ref:`genindex` 45 | * :ref:`modindex` 46 | * :ref:`search` 47 | -------------------------------------------------------------------------------- /docs/index.rst.license: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: Unlicense 4 | 5 | sphinx 6 | sphinxcontrib-jquery 7 | sphinx-rtd-theme 8 | -------------------------------------------------------------------------------- /examples/attiny13a_blink.hex: -------------------------------------------------------------------------------- 1 | :1000000009C00EC00DC00CC00BC00AC009C008C09A 2 | :1000100007C006C011241FBECFE9CDBF02D012C059 3 | :10002000EFCF81E087BB18BA98E088B3892788BBF7 4 | :100030002FEF35EA8EE0215030408040E1F700C0DC 5 | :080040000000F3CFF894FFCF9C 6 | :00000001FF 7 | -------------------------------------------------------------------------------- /examples/attiny13a_blink.hex.license: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | -------------------------------------------------------------------------------- /examples/avrprog_program_mega2560.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | 4 | """ 5 | Arduino Mega 2560 programming example, be sure you have the Mega/2560 wired up so: 6 | Mega Ground to CircuitPython GND 7 | Mega 5V to CircuitPython USB or make sure the Trinket is powered by USB 8 | Pin 52 -> CircuitPython SCK 9 | Pin 50 -> CircuitPython MISO - Note this is backwards from what you expect 10 | Pin 51 -> CircuitPython MOSI - Note this is backwards from what you expect 11 | RESET -> CircuitPython D5 (or change the init() below to change it) 12 | Drag "stk500boot_v2_mega2560.hex" onto the CircuitPython disk drive, then open REPL 13 | """ 14 | 15 | import board 16 | import busio 17 | 18 | import adafruit_avrprog 19 | 20 | spi = busio.SPI(board.SCK, board.MOSI, board.MISO) 21 | avrprog = adafruit_avrprog.AVRprog() 22 | avrprog.init(spi, board.D5) 23 | 24 | # To program a chip, you'll need to find out the signature, size of the flash, 25 | # flash-page size and fuse mask. You can find this in the datasheet or in 26 | # avrdude.conf located at: 27 | # http://svn.savannah.nongnu.org/viewvc/*checkout*/avrdude/trunk/avrdude/avrdude.conf.in 28 | # You can also use the predefined values in AVRprog.Boards 29 | atmega2560 = { 30 | "name": "ATmega2560", 31 | "sig": [0x1E, 0x98, 0x01], 32 | "flash_size": 262144, 33 | "page_size": 256, 34 | "fuse_mask": (0xFF, 0xFF, 0x07, 0x3F), 35 | } 36 | 37 | 38 | def error(err): 39 | """Helper to print out errors for us and then halt""" 40 | print("ERROR: " + err) 41 | avrprog.end() 42 | while True: 43 | pass 44 | 45 | 46 | while input("Ready to GO, type 'G' here to start> ") != "G": 47 | pass 48 | 49 | if not avrprog.verify_sig(atmega2560, verbose=True): 50 | error("Signature read failure") 51 | print("Found", atmega2560["name"]) 52 | 53 | # Since we are unsetting the lock fuse, an erase is required! 54 | avrprog.erase_chip() 55 | 56 | avrprog.write_fuses(atmega2560, low=0xFF, high=0xD8, ext=0x05, lock=0x3F) 57 | if not avrprog.verify_fuses(atmega2560, low=0xFF, high=0xD8, ext=0x05, lock=0x3F): 58 | error("Failure programming fuses: " + str([hex(i) for i in avrprog.read_fuses(atmega2560)])) 59 | 60 | print("Programming flash from file") 61 | avrprog.program_file(atmega2560, "stk500boot_v2_mega2560.hex", verbose=True, verify=True) 62 | 63 | avrprog.write_fuses(atmega2560, lock=0x0F) 64 | if not avrprog.verify_fuses(atmega2560, lock=0x0F): 65 | error("Failure verifying fuses!") 66 | 67 | print("Done!") 68 | -------------------------------------------------------------------------------- /examples/avrprog_program_tiny13a.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | 4 | """ 5 | ATtiny13a programming example, be sure you have the '13a wired up so: 6 | ATtiny13a GND to CircuitPython GND 7 | ATtiny13a VCC to CircuitPython USB 8 | Pin 2 -> CircuitPython SCK 9 | Pin 1 -> CircuitPython MISO 10 | Pin 0 -> CircuitPython MOSI 11 | RESET -> CircuitPython D5 (or change the init() below to change it!) 12 | Drag "attiny13a_blink.hex" onto the CircuitPython disk drive, then open REPL! 13 | """ 14 | 15 | import board 16 | import busio 17 | 18 | import adafruit_avrprog 19 | 20 | spi = busio.SPI(board.SCK, board.MOSI, board.MISO) 21 | avrprog = adafruit_avrprog.AVRprog() 22 | avrprog.init(spi, board.D5) 23 | 24 | # Each chip has to have a definition so the script knows how to find it 25 | attiny13 = avrprog.Boards.ATtiny13a 26 | 27 | 28 | def error(err): 29 | """Helper to print out errors for us and then halt""" 30 | print("ERROR: " + err) 31 | avrprog.end() 32 | while True: 33 | pass 34 | 35 | 36 | while input("Ready to GO, type 'G' here to start> ") != "G": 37 | pass 38 | 39 | if not avrprog.verify_sig(attiny13, verbose=True): 40 | error("Signature read failure") 41 | print("Found", attiny13["name"]) 42 | 43 | avrprog.write_fuses(attiny13, low=0x7A, high=0xFF) 44 | if not avrprog.verify_fuses(attiny13, low=0x7A, high=0xFF): 45 | error("Failure verifying fuses!") 46 | 47 | print("Programming flash from file") 48 | avrprog.program_file(attiny13, "attiny13a_blink.hex", verbose=True, verify=True) 49 | 50 | print("Done!") 51 | -------------------------------------------------------------------------------- /examples/avrprog_program_trinket85.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | 4 | """ 5 | Trinket/Gemma (ATtiny85) programming example, be sure you have the '85 wired up so: 6 | Trinket Ground to CircuitPython GND 7 | Trinket USB to CircuitPythong USB or make sure the Trinket is powered by USB 8 | Pin 2 -> CircuitPython SCK 9 | Pin 1 -> CircuitPython MISO 10 | Pin 0 -> CircuitPython MOSI 11 | RESET -> CircuitPython D5 (or change the init() below to change it!) 12 | Drag "trinket_boot.hex" onto the CircuitPython disk drive, then open REPL! 13 | """ 14 | 15 | import board 16 | import busio 17 | 18 | import adafruit_avrprog 19 | 20 | spi = busio.SPI(board.SCK, board.MOSI, board.MISO) 21 | avrprog = adafruit_avrprog.AVRprog() 22 | avrprog.init(spi, board.D5) 23 | 24 | # Each chip has to have a definition so the script knows how to find it 25 | attiny85 = avrprog.Boards.ATtiny85 26 | 27 | 28 | def error(err): 29 | """Helper to print out errors for us and then halt""" 30 | print("ERROR: " + err) 31 | avrprog.end() 32 | while True: 33 | pass 34 | 35 | 36 | while input("Ready to GO, type 'G' here to start> ") != "G": 37 | pass 38 | 39 | if not avrprog.verify_sig(attiny85, verbose=True): 40 | error("Signature read failure") 41 | print("Found", attiny85["name"]) 42 | 43 | avrprog.write_fuses(attiny85, low=0xF1, high=0xD5, ext=0x06, lock=0x3F) 44 | if not avrprog.verify_fuses(attiny85, low=0xF1, high=0xD5, ext=0x06, lock=0x3F): 45 | error("Failure verifying fuses!") 46 | 47 | print("Programming flash from file") 48 | avrprog.program_file(attiny85, "trinket_boot.hex", verbose=True, verify=True) 49 | 50 | print("Done!") 51 | -------------------------------------------------------------------------------- /examples/avrprog_program_uno328.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | 4 | """ 5 | UNO Optiboot programming example, be sure you have the UNO wired up so: 6 | UNO Ground to CircuitPython GND 7 | UNO 5V to CircuitPython USB or make sure the UNO is powered by USB 8 | UNO Pin 13 -> CircuitPython SCK 9 | UNO Pin 12 -> CircuitPython MISO 10 | UNO Pin 11 -> CircuitPython MOSI 11 | UNO RESET -> CircuitPython D5 (or change the init() below to change it!) 12 | Drag "optiboot_atmega328.hex" onto the CircuitPython disk drive, then open REPL! 13 | """ 14 | 15 | import board 16 | import busio 17 | import pwmio 18 | 19 | import adafruit_avrprog 20 | 21 | spi = busio.SPI(board.SCK, board.MOSI, board.MISO) 22 | avrprog = adafruit_avrprog.AVRprog() 23 | avrprog.init(spi, board.D5) 24 | 25 | # we can generate an 6 MHz clock for driving bare chips too! 26 | clock_pwm = pwmio.PWMOut(board.D9, frequency=6000000, duty_cycle=65536 // 2) 27 | 28 | # Each chip has to have a definition so the script knows how to find it 29 | atmega328p = avrprog.Boards.ATmega328p 30 | 31 | 32 | def error(err): 33 | """Helper to print out errors for us and then halt""" 34 | print("ERROR: " + err) 35 | avrprog.end() 36 | while True: 37 | pass 38 | 39 | 40 | while input("Ready to GO, type 'G' here to start> ") != "G": 41 | pass 42 | 43 | if not avrprog.verify_sig(atmega328p, verbose=True): 44 | error("Signature read failure") 45 | print("Found", atmega328p["name"]) 46 | 47 | # Since we are unsetting the lock fuse, an erase is required! 48 | avrprog.erase_chip() 49 | 50 | avrprog.write_fuses(atmega328p, low=0xFF, high=0xDE, ext=0x05, lock=0x3F) 51 | if not avrprog.verify_fuses(atmega328p, low=0xFF, high=0xDE, ext=0x05, lock=0x3F): 52 | error("Failure programming fuses: " + str([hex(i) for i in avrprog.read_fuses(atmega328p)])) 53 | 54 | print("Programming flash from file") 55 | avrprog.program_file(atmega328p, "optiboot_atmega328.hex", verbose=True, verify=True) 56 | 57 | avrprog.write_fuses(atmega328p, lock=0x0F) 58 | if not avrprog.verify_fuses(atmega328p, lock=0x0F): 59 | error("Failure verifying fuses!") 60 | 61 | print("Done!") 62 | -------------------------------------------------------------------------------- /examples/avrprog_read_signature_simpletest.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | 4 | """ 5 | Read Signature Test - All this does is read the signature from the chip to 6 | check connectivity! 7 | """ 8 | 9 | import board 10 | import busio 11 | import pwmio 12 | 13 | import adafruit_avrprog 14 | 15 | spi = busio.SPI(board.SCK, board.MOSI, board.MISO) 16 | avrprog = adafruit_avrprog.AVRprog() 17 | avrprog.init(spi, board.D5) 18 | 19 | # we can generate an 6 MHz clock for driving bare chips too! 20 | clock_pwm = pwmio.PWMOut(board.D9, frequency=6000000, duty_cycle=65536 // 2) 21 | 22 | avrprog.begin() 23 | print("Signature bytes: ", [hex(i) for i in avrprog.read_signature()]) 24 | avrprog.end() 25 | -------------------------------------------------------------------------------- /examples/optiboot_atmega328.hex: -------------------------------------------------------------------------------- 1 | :107E0000112484B714BE81FFF0D085E080938100F7 2 | :107E100082E08093C00088E18093C10086E0809377 3 | :107E2000C20080E18093C4008EE0C9D0259A86E02C 4 | :107E300020E33CEF91E0309385002093840096BBD3 5 | :107E4000B09BFECF1D9AA8958150A9F7CC24DD24C4 6 | :107E500088248394B5E0AB2EA1E19A2EF3E0BF2EE7 7 | :107E6000A2D0813461F49FD0082FAFD0023811F036 8 | :107E7000013811F484E001C083E08DD089C08234E0 9 | :107E800011F484E103C0853419F485E0A6D080C0E4 10 | :107E9000853579F488D0E82EFF2485D0082F10E0AE 11 | :107EA000102F00270E291F29000F111F8ED06801E7 12 | :107EB0006FC0863521F484E090D080E0DECF843638 13 | :107EC00009F040C070D06FD0082F6DD080E0C81688 14 | :107ED00080E7D80618F4F601B7BEE895C0E0D1E017 15 | :107EE00062D089930C17E1F7F0E0CF16F0E7DF06D8 16 | :107EF00018F0F601B7BEE89568D007B600FCFDCFD4 17 | :107F0000A601A0E0B1E02C9130E011968C91119780 18 | :107F100090E0982F8827822B932B1296FA010C0160 19 | :107F200087BEE89511244E5F5F4FF1E0A038BF0790 20 | :107F300051F7F601A7BEE89507B600FCFDCF97BE46 21 | :107F4000E89526C08437B1F42ED02DD0F82E2BD052 22 | :107F50003CD0F601EF2C8F010F5F1F4F84911BD097 23 | :107F6000EA94F801C1F70894C11CD11CFA94CF0C13 24 | :107F7000D11C0EC0853739F428D08EE10CD085E9AC 25 | :107F80000AD08FE07ACF813511F488E018D01DD067 26 | :107F900080E101D065CF982F8091C00085FFFCCF94 27 | :107FA0009093C60008958091C00087FFFCCF809118 28 | :107FB000C00084FD01C0A8958091C6000895E0E648 29 | :107FC000F0E098E1908380830895EDDF803219F02E 30 | :107FD00088E0F5DFFFCF84E1DECF1F93182FE3DFCA 31 | :107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6 32 | :047FF000FF270994CA 33 | :027FFE00040479 34 | :0400000300007E007B 35 | :00000001FF 36 | -------------------------------------------------------------------------------- /examples/optiboot_atmega328.hex.license: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | -------------------------------------------------------------------------------- /examples/stk500boot_v2_mega2560.hex: -------------------------------------------------------------------------------- 1 | :020000023000CC 2 | :10E000000D9489F10D94B2F10D94B2F10D94B2F129 3 | :10E010000D94B2F10D94B2F10D94B2F10D94B2F1F0 4 | :10E020000D94B2F10D94B2F10D94B2F10D94B2F1E0 5 | :10E030000D94B2F10D94B2F10D94B2F10D94B2F1D0 6 | :10E040000D94B2F10D94B2F10D94B2F10D94B2F1C0 7 | :10E050000D94B2F10D94B2F10D94B2F10D94B2F1B0 8 | :10E060000D94B2F10D94B2F10D94B2F10D94B2F1A0 9 | :10E070000D94B2F10D94B2F10D94B2F10D94B2F190 10 | :10E080000D94B2F10D94B2F10D94B2F10D94B2F180 11 | :10E090000D94B2F10D94B2F10D94B2F10D94B2F170 12 | :10E0A0000D94B2F10D94B2F10D94B2F10D94B2F160 13 | :10E0B0000D94B2F10D94B2F10D94B2F10D94B2F150 14 | :10E0C0000D94B2F10D94B2F10D94B2F10D94B2F140 15 | :10E0D0000D94B2F10D94B2F10D94B2F10D94B2F130 16 | :10E0E0000D94B2F141546D656761323536300041AF 17 | :10E0F000726475696E6F206578706C6F72657220DE 18 | :10E1000073746B3530305632206279204D4C530099 19 | :10E11000426F6F746C6F616465723E004875683F52 20 | :10E1200000436F6D70696C6564206F6E203D200048 21 | :10E130004350552054797065202020203D20005FF9 22 | :10E140005F4156525F415243485F5F3D2000415658 23 | :10E1500052204C696243205665723D20004743437C 24 | :10E160002056657273696F6E203D20004350552024 25 | :10E1700049442020202020203D20004C6F7720663D 26 | :10E18000757365202020203D20004869676820665F 27 | :10E190007573652020203D200045787420667573D6 28 | :10E1A00065202020203D20004C6F636B2066757336 29 | :10E1B000652020203D20004D617220203720323024 30 | :10E1C000313300312E362E3800342E332E350056A2 31 | :10E1D00023202020414444522020206F7020636F70 32 | :10E1E00064652020202020696E73747275637469E1 33 | :10E1F0006F6E2061646472202020496E74657272B3 34 | :10E20000757074006E6F20766563746F7200726A49 35 | :10E210006D702020006A6D70200057686174207056 36 | :10E220006F72743A00506F7274206E6F7420737541 37 | :10E2300070706F72746564004D7573742062652030 38 | :10E2400061206C6574746572002000577269747483 39 | :10E25000696E672045450052656164696E672045B7 40 | :10E26000450045452065727220636E743D00504F35 41 | :10E27000525400303D5A65726F2061646472003FF1 42 | :10E280003D43505520737461747300403D454550C3 43 | :10E29000524F4D207465737400423D426C696E6B41 44 | :10E2A000204C454400453D44756D70204545505215 45 | :10E2B0004F4D00463D44756D7020464C415348001B 46 | :10E2C000483D48656C70004C3D4C69737420492F83 47 | :10E2D0004F20506F72747300513D51756974005234 48 | :10E2E0003D44756D702052414D00563D73686F7707 49 | :10E2F00020696E7465727275707420566563746FF0 50 | :10E30000727300593D506F727420626C696E6B00BD 51 | :10E310002A0011241FBECFEFD1E2DEBFCDBF01E046 52 | :10E320000CBF12E0A0E0B2E0EEE1FDEF03E00BBFB6 53 | :10E3300002C007900D92A030B107D9F712E0A0E01B 54 | :10E34000B2E001C01D92AE30B107E1F70F9460F367 55 | :10E350000D948DFE01E20EBF0FEF0DBF11241FBE05 56 | :10E360000D9460F30D9400F020E030E040ED57E0B4 57 | :10E3700005C0FA013197F1F72F5F3F4F2817390792 58 | :10E38000C0F308959C01260F311DC901A0E0B0E043 59 | :10E390002F5F3F4FABBFFC018791882361F08093D3 60 | :10E3A000C6008091C00086FFFCCF8091C0008064D1 61 | :10E3B0008093C000EACF08958DE08093C6008091DD 62 | :10E3C000C00086FFFCCF8091C00080648093C000B5 63 | :10E3D0008AE08093C6008091C00086FFFCCF8091C8 64 | :10E3E000C00080648093C00008950F94C2F10F9420 65 | :10E3F000DCF10895FC019081992359F09093C600B7 66 | :10E400008091C00086FFFCCF8091C0008064809323 67 | :10E41000C0003196992379F70895282F982F929567 68 | :10E420009F70892F805D8A3308F0895F8093C600D2 69 | :10E430008091C00086FFFCCF8091C00080648093F3 70 | :10E44000C000822F8F70982F905D9A3308F0995FEB 71 | :10E450009093C6008091C00086FFFCCF8091C000E1 72 | :10E4600080648093C00008959C01FB01853691056E 73 | :10E470001CF46330710594F0C90164E670E00F94F8 74 | :10E480002EFE605D7F4F6093C6008091C00086FFC6 75 | :10E49000FCCF8091C00080648093C0002B30310598 76 | :10E4A00014F43297B4F0C90164E670E00F942EFEC4 77 | :10E4B0006AE070E00F942EFE605D7F4F6093C600AF 78 | :10E4C0008091C00086FFFCCF8091C0008064809363 79 | :10E4D000C000C9016AE070E00F942EFEC0968093E0 80 | :10E4E000C6008091C00086FFFCCF8091C000806490 81 | :10E4F0008093C00008951F93182F8EE692EE60E07F 82 | :10E500000F94C2F11093C6008091C00086FFFCCF2B 83 | :10E510008091C00080648093C0000F94DCF11F9153 84 | :10E5200008952F923F924F925F926F927F928F92B7 85 | :10E530009F92AF92BF92CF92DF92EF92FF920F9392 86 | :10E540001F93DF93CF93CDB7DEB762970FB6F894E2 87 | :10E55000DEBF0FBECDBF382E622ECA01DB015C01CB 88 | :10E560006D01772420E2222E2E010894411C511CBB 89 | :10E570008BC081E0A81680E0B80681E0C80680E084 90 | :10E58000D80628F0C601AA27BB270F940DF2BB2797 91 | :10E59000AD2D9C2D8B2D0F940DF28A2D0F940DF225 92 | :10E5A0002092C6008091C00086FFFCCF8091C00001 93 | :10E5B00080648093C0009DE29093C6008091C0006B 94 | :10E5C00086FFFCCF8091C00080648093C0002092C1 95 | :10E5D000C6008091C00086FFFCCF8091C00080649F 96 | :10E5E0008093C00019828601750188249924A1E0D6 97 | :10E5F0003A1651F03A1620F0B2E03B1661F409C029 98 | :10E600000BBFF701779007C0C7010F9477FE782EF4 99 | :10E6100002C0F7017080872D0F940DF22092C60082 100 | :10E620008091C00086FFFCCF8091C0008064809301 101 | :10E63000C000872D8052F401EF70F0708F3520F408 102 | :10E64000E40DF51D708204C0E40DF51D8EE280839B 103 | :10E650000894E11CF11C011D111D0894811C911CE2 104 | :10E6600090E18916910409F0C2CF80E190E0A0E02A 105 | :10E67000B0E0A80EB91ECA1EDB1E198AC2010F9493 106 | :10E68000FAF10F94DCF16A94662009F072CF629679 107 | :10E690000FB6F894DEBF0FBECDBFCF91DF911F91B3 108 | :10E6A0000F91FF90EF90DF90CF90BF90AF909F9031 109 | :10E6B0008F907F906F905F904F903F902F90089534 110 | :10E6C0002F923F924F925F926F927F928F929F9282 111 | :10E6D000AF92BF92CF92DF92EF92FF920F931F9370 112 | :10E6E000DF93CF93CDB7DEB7CD53D1400FB6F894BB 113 | :10E6F000DEBF0FBECDBF01E20EBF0FEF0DBF94B75F 114 | :10E70000F894A89514BE80916000886180936000A1 115 | :10E7100010926000789493FF05C0E0910002F091A0 116 | :10E7200001021995279A2F9A8091C00082608093E8 117 | :10E73000C00080E18093C40088E18093C1000000A4 118 | :10E74000EE24FF24870144E0A42EB12CCC24DD2448 119 | :10E7500024C0C5010197F1F70894E11CF11C011DCB 120 | :10E76000111D21E2E2162EE4F20620E0020720E06D 121 | :10E77000120718F031E0C32ED12CC801B70127ECE5 122 | :10E780003BE140E050E00F9441FE611571058105C9 123 | :10E79000910519F485B1805885B98091C00087FD35 124 | :10E7A00003C0C114D104A9F2A6014F5F5F4FC25E3E 125 | :10E7B000DE4F59834883CE51D140C25EDE4F8881FF 126 | :10E7C0009981CE51D140019711F00D9410FEC05D9A 127 | :10E7D000DE4F19821882C053D14060E0C15DDE4F28 128 | :10E7E0001882CF52D14088249924C35DDE4F19820C 129 | :10E7F0001882CD52D140C05EDE4F188219821A8233 130 | :10E800001B82C052D140CE5CDE4F188219821A8220 131 | :10E810001B82C253D140EE24FF2487010BBFF701B6 132 | :10E8200007911691C45CDE4F19830883CC53D14005 133 | :10E830000D940BFEC25EDE4F28813981CE51D1404E 134 | :10E840002130310509F52091C600C25EDE4F1982E4 135 | :10E850001882CE51D14022C02F5F3F4F4F4F5F4FA4 136 | :10E86000213082E138078AE7480780E0580780F0C6 137 | :10E87000C45CDE4FE881F981CC53D140EF5FFF4F9C 138 | :10E8800019F0EE27FF27099420E030E040E050E047 139 | :10E890008091C00087FFE0CF2091C600C35DDE4FAE 140 | :10E8A00048815981CD52D1404F5F5F4FC35DDE4FEC 141 | :10E8B00059834883CD52D140213209F063C64A3092 142 | :10E8C000510508F05FC60894811C911C53E0851621 143 | :10E8D000910409F059C600E010E018C081E280936D 144 | :10E8E000C6008091C00086FFFCCF8091C00080648C 145 | :10E8F0008093C0002F5F3F4F2931310579F70F9486 146 | :10E90000DCF10F5F1F4F0530110519F020E030E0FA 147 | :10E91000E5CF10920A0210920B0210920C02109294 148 | :10E920000D02109206021092070210920802109235 149 | :10E930000902109202021092030210920402109235 150 | :10E9400005028FEE90EE60E00F94F5F180E191EE1C 151 | :10E9500060E00F94C2F18091C00087FFFCCF9091DE 152 | :10E96000C600903608F09F759032B8F09093C600BC 153 | :10E970008091C00086FFFCCF8091C00080648093AE 154 | :10E98000C000A0E2A093C6008091C00086FFFCCF2B 155 | :10E990008091C00080648093C000983409F4D7C18E 156 | :10E9A0009934B8F4923409F459C1933458F490333B 157 | :10E9B00019F1903308F4E3C59F33A1F1903409F0C5 158 | :10E9C000DEC5BDC0953409F470C1963409F0D7C5D1 159 | :10E9D00098C1923509F42BC2933538F49C3409F46C 160 | :10E9E000F5C1913509F0CBC518C2963509F445C279 161 | :10E9F000993509F0C4C567C483E792EE62E00F94CD 162 | :10EA0000F5F110920602109207021092080210927D 163 | :10EA1000090210920A0210920B0210920C0210923C 164 | :10EA20000D0213C18FE792EE62E00F94F5F18FEEC5 165 | :10EA300090EE60E00F94F5F181E291EE60E00F94CA 166 | :10EA4000C2F187EB91EE60E00F94F5F180E391EE77 167 | :10EA500060E00F94C2F184EE90EE60E00F94F5F167 168 | :10EA60008FE391EE60E00F94C2F186E090E061E008 169 | :10EA700070E00F9434F20F94DCF18DE591EE60E0DC 170 | :10EA80000F94C2F189EC91EE60E00F94F5F18EE401 171 | :10EA900091EE60E00F94C2F183EC91EE60E00F9490 172 | :10EAA000F5F18CE691EE60E00F94C2F18EE10F94E7 173 | :10EAB0000DF288E90F940DF281E00F940DF20F949E 174 | :10EAC000DCF18BE791EE60E00F94C2F119E0E0E039 175 | :10EAD000F0E010935700E4918E2F0F940DF20F94F5 176 | :10EAE000DCF18AE891EE60E00F94C2F1E3E0F0E03F 177 | :10EAF00010935700E4918E2F0F940DF20F94DCF1D8 178 | :10EB000089E991EE60E00F94C2F1E2E0F0E0109349 179 | :10EB10005700E4918E2F0F940DF20F94DCF188EAE8 180 | :10EB200091EE60E00F94C2F1E1E0F0E01093570045 181 | :10EB30001491812F0F940DF20F94DCF107CF8BE825 182 | :10EB400092EE62E00F94F5F18BE492EE60E00F94A8 183 | :10EB5000F5F10F94DCF100E010E019C0C8016F2D51 184 | :10EB60000F947FFEFF2031F489E492EE60E00F9471 185 | :10EB7000C2F10BC0F092C6008091C00086FFFCCFAE 186 | :10EB80008091C00080648093C0000F5F1F4FC80158 187 | :10EB900081519F41A0E0B0E0ABBFFC01F790BAE229 188 | :10EBA000FB1621F0E2E000301E07C1F60F94DCF105 189 | :10EBB0000F94DCF187E592EE60E00F94F5F10F948D 190 | :10EBC000DCF1CC24DD2400E010E01EC0C8010F946D 191 | :10EBD00077FEF82E882331F489E492EE60E00F94FA 192 | :10EBE000C2F10BC08093C6008091C00086FFFCCFAD 193 | :10EBF0008091C00080648093C000FE1419F00894D6 194 | :10EC0000C11CD11C0F5F1F4FC80181519F41A0E063 195 | :10EC1000B0E0ABBFFC01E790FAE2EF1621F022E092 196 | :10EC20000030120799F60F94DCF10F94DCF182E6C4 197 | :10EC300092EE60E00F94C2F1C60161E070E00F94C3 198 | :10EC400034F20F94DCF10F94DCF110920202109276 199 | :10EC50000302109204021092050278CE89E992EE26 200 | :10EC600062E00F94F5F1279A2F9A16C02F9880E052 201 | :10EC700090E0E0EDF7E03197F1F7019684369105E9 202 | :10EC8000C1F72F9A80E090E0E0EDF7E03197F1F7DF 203 | :10EC9000019684369105C1F78091C00087FFE6CFC9 204 | :10ECA0008091C00087FFFCCF64C485EA92EE62E0E9 205 | :10ECB0000F94F5F140910202509103026091040219 206 | :10ECC0007091050281E020E10F9491F2809102029F 207 | :10ECD00090910302A0910402B091050280509F4FD1 208 | :10ECE000AF4FBF4F8093020290930302A0930402A0 209 | :10ECF000B093050280509041A040B04008F426CE69 210 | :10ED0000A4CF83EB92EE62E00F94F5F140910602FE 211 | :10ED100050910702609108027091090280E020E1A1 212 | :10ED20000F9491F28091060290910702A09108023F 213 | :10ED3000B091090280509F4FAF4FBF4F80930602A2 214 | :10ED400090930702A0930802B0930902FFCD80ECD4 215 | :10ED500092EE62E00F94F5F183E792EE60E00F949B 216 | :10ED6000F5F18FE792EE60E00F94F5F18BE892EE0B 217 | :10ED700060E00F94F5F189E992EE60E00F94F5F10F 218 | :10ED800085EA92EE60E00F94F5F183EB92EE60E09D 219 | :10ED90000F94F5F180EC92EE60E00F94F5F187ECC2 220 | :10EDA00092EE60E00F94F5F188ED92EE60E00F9442 221 | :10EDB000F5F18FED92EE60E00F94F5F18AEE92EEB0 222 | :10EDC00060E00F94F5F183E093EEBDCD87EC92EE19 223 | :10EDD00062E00F94F5F181E40F947BF282E40F94EA 224 | :10EDE0007BF283E40F947BF284E40F947BF285E45E 225 | :10EDF0000F947BF286E40F947BF287E40F947BF20E 226 | :10EE000088E40F947BF28AE40F947BF28BE40F94F6 227 | :10EE10007BF28CE40F947BF299CD88ED92EE62E068 228 | :10EE20000F94F5F1772473948824992409C48FED05 229 | :10EE300092EE62E00F94F5F140910A0250910B02BC 230 | :10EE400060910C0270910D0282E020E10F9491F22A 231 | :10EE500080910A0290910B02A0910C02B0910D02D8 232 | :10EE600080509F4FAF4FBF4F80930A0290930B0289 233 | :10EE7000A0930C02B0930D0269CD8AEE92EE62E08F 234 | :10EE80000F94F5F184EE90EE60E00F94F5F18FECC5 235 | :10EE900091EE60E00F94F5F1662477244301CC5D98 236 | :10EEA000DE4F19821882C452D140D401C301B695F5 237 | :10EEB000A79597958795CA5DDE4F88839983AA8326 238 | :10EEC000BB83C652D140CC5DDE4FA881B981C4520C 239 | :10EED000D1401196CC5DDE4FB983A883C452D14096 240 | :10EEE000CD0162E070E00F9434F2B0E2B093C6005E 241 | :10EEF0008091C00086FFFCCF8091C0008064809329 242 | :10EF0000C000EDE2E093C6008091C00086FFFCCF18 243 | :10EF10008091C00080648093C000F0E2F093C6004E 244 | :10EF20008091C00086FFFCCF8091C00080648093F8 245 | :10EF3000C000CA5DDE4FE880F9800A811B81C6529D 246 | :10EF4000D140BB27A12F902F8F2D0F940DF2CA5DBA 247 | :10EF5000DE4F8881C652D1400F940DF2B0E2FB2EF5 248 | :10EF6000F092C6008091C00086FFFCCF8091C00067 249 | :10EF700080648093C0000DE30093C6008091C000C0 250 | :10EF800086FFFCCF8091C00080648093C00010E2B7 251 | :10EF90001093C6008091C00086FFFCCF8091C00016 252 | :10EFA00080648093C0008BBEF3012791C65DDE4F65 253 | :10EFB0002883CA52D140A22EBB24CC24DD2408943D 254 | :10EFC000611C711C811C911C8BBEF3018791282E42 255 | :10EFD0003324442455240894611C711C811C911C09 256 | :10EFE0008BBEF3013791C55DDE4F3883CB52D140E4 257 | :10EFF0000894611C711C811C911C8BBEF30147910C 258 | :10F00000C45DDE4F4883CC52D140ADEFEA2EAFEF66 259 | :10F01000FA2EAFEF0A2FAFEF1A2F6E0C7F1C801E57 260 | :10F02000911E142D032DF22CEE24EA0CFB1C0C1D5A 261 | :10F030001D1D0F940DF220E22093C6008091C000A8 262 | :10F0400086FFFCCF8091C00080648093C000C65DC5 263 | :10F05000DE4F8881CA52D1400F940DF230E23093D6 264 | :10F06000C6008091C00086FFFCCF8091C000806404 265 | :10F070008093C000C45DDE4F8881CC52D1400F9494 266 | :10F080000DF240E24093C6008091C00086FFFCCFA5 267 | :10F090008091C00080648093C000C55DDE4F888190 268 | :10F0A000CB52D1400F940DF250E25093C6008091A4 269 | :10F0B000C00086FFFCCF8091C00080648093C000B8 270 | :10F0C0008FEFE8168FEFF80680E0080780E018075A 271 | :10F0D00031F484E092EE60E00F94C2F1DFC0D80119 272 | :10F0E000C7018070907CA070B0708050904CA040A0 273 | :10F0F000B040D1F52FEF3FE340E050E0E222F322B1 274 | :10F1000004231523CA5DDE4FA880B980CA80DB8046 275 | :10F11000C652D140AE0CBF1CC01ED11EAA0CBB1CD7 276 | :10F12000CC1CDD1C8EE092EE60E00F94C2F1BB2798 277 | :10F13000A12F902F8F2D0F940DF28E2D0F940DF285 278 | :10F1400030E23093C6008091C00086FFFCCF8091F2 279 | :10F15000C00080648093C0004EE34093C60080915D 280 | :10F16000C00086FFFCCF87C08EE09EEFA0E0B0E03D 281 | :10F17000E822F9220A231B239CE0E91694E9F90608 282 | :10F1800090E0090790E0190709F088C0C45DDE4FE0 283 | :10F19000A881CC52D140EA2EFF2400E010E0102FCD 284 | :10F1A0000F2DFE2CEE24C55DDE4FB881CB52D14031 285 | :10F1B000EB0EF11C011D111DD601C501817090706F 286 | :10F1C000A070B070DC0199278827E80EF91E0A1F8D 287 | :10F1D0001B1F20EF30E040E050E0A222B322C42207 288 | :10F1E000D52241E1AA0CBB1CCC1CDD1C4A95D1F7F1 289 | :10F1F000EA0CFB1C0C1D1D1D81E090E0A0E0B0E0BE 290 | :10F20000282239224A225B2235E1220C331C441C7D 291 | :10F21000551C3A95D1F7E20CF31C041D151D57013E 292 | :10F220006801AA0CBB1CCC1CDD1C85E192EE60E0E1 293 | :10F230000F94C2F1C801AA27BB270F940DF2BB2778 294 | :10F24000A12F902F8F2D0F940DF28E2D0F940DF274 295 | :10F2500090E29093C6008091C00086FFFCCF809121 296 | :10F26000C00080648093C000AEE3A093C60080918C 297 | :10F27000C00086FFFCCF8091C00080648093C000F6 298 | :10F28000C601AA27BB270F940DF2BB27AD2D9C2DDD 299 | :10F290008B2D0F940DF28A2D0F940DF20F94DCF14B 300 | :10F2A000CC5DDE4FE881F981C452D140F99709F471 301 | :10F2B0004DCBF4E0EF2EF12C012D112D6E0C7F1CA7 302 | :10F2C000801E911EF2CD83E093EE62E00F94F5F183 303 | :10F2D0008AE192EE60E00F94C2F18091C00087FF56 304 | :10F2E000FCCF1091C6001F751093C6008091C0001E 305 | :10F2F00086FFFCCF8091C00080648093C0000F9493 306 | :10F30000DCF1812F81548A3108F036C1163409F4BA 307 | :10F3100095C0173490F4133409F44EC0143430F40B 308 | :10F320001134F1F0123409F01DC130C0143409F465 309 | :10F3300059C0153409F016C16BC01A3409F4C4C0A1 310 | :10F340001B3438F4173409F48FC0183409F00AC19B 311 | :10F35000A1C01B3409F4D2C01C3409F003C1E8C0B9 312 | :10F360008FEF81B90DC082B1809582B980E090E0C5 313 | :10F37000E0EDF7E03197F1F70196883C9105C1F790 314 | :10F380008091C00087FFEFCF12B8EFC08FEF84B934 315 | :10F390000DC085B1809585B980E090E0E0EDF7E0A3 316 | :10F3A0003197F1F70196883C9105C1F78091C00033 317 | :10F3B00087FFEFCF15B8D9C08FEF87B90DC088B1DF 318 | :10F3C000809588B980E090E0E0EDF7E03197F1F7C3 319 | :10F3D0000196883C9105C1F78091C00087FFEFCF6F 320 | :10F3E00018B8C3C08FEF8AB90DC08BB180958BB9A7 321 | :10F3F00080E090E0E0EDF7E03197F1F70196883C8E 322 | :10F400009105C1F78091C00087FFEFCF1BB8ADC059 323 | :10F410008FEF8DB90DC08EB180958EB980E090E0F0 324 | :10F42000E0EDF7E03197F1F70196883C9105C1F7DF 325 | :10F430008091C00087FFEFCF1EB897C08FEF80BBD1 326 | :10F440000DC081B3809581BB80E090E0E0EDF7E0F6 327 | :10F450003197F1F70196883C9105C1F78091C00082 328 | :10F4600087FFEFCF11BA81C08FEF83BB0DC084B38C 329 | :10F47000809584BB80E090E0E0EDF7E03197F1F714 330 | :10F480000196883C9105C1F78091C00087FFEFCFBE 331 | :10F4900014BA6BC08FEF809301010FC080910201FD 332 | :10F4A00080958093020180E090E0E0EDF7E03197F5 333 | :10F4B000F1F70196883C9105C1F78091C00087FF64 334 | :10F4C000EDCF1092020151C08FEF809304010FC065 335 | :10F4D0008091050180958093050180E090E0E0ED4A 336 | :10F4E000F7E03197F1F70196883C9105C1F78091DB 337 | :10F4F000C00087FFEDCF1092050137C08FEF8093DA 338 | :10F5000007010FC08091080180958093080180E079 339 | :10F5100090E0E0EDF7E03197F1F70196883C910536 340 | :10F52000C1F78091C00087FFEDCF109208011DC088 341 | :10F530008FEF80930A010FC080910B01809580931B 342 | :10F540000B0180E090E0E0EDF7E03197F1F70196F4 343 | :10F55000883C9105C1F78091C00087FFEDCF1092E4 344 | :10F560000B0103C085E292EEEEC98091C00087FFD7 345 | :10F57000FCCF8091C600EAC988E392EEE4C98CE131 346 | :10F5800091EEE1C988249924933011F1943028F444 347 | :10F59000913089F09230B8F408C0953061F195301F 348 | :10F5A000F0F0963009F048C043C02B3109F042C951 349 | :10F5B00091E06BE13FC96227C15DDE4F2883CF52E6 350 | :10F5C000D14092E037C9B22FA0E0622793E032C960 351 | :10F5D000822F90E0A82BB92B622794E02BC92E3004 352 | :10F5E00009F039C3622795E0C05DDE4F19821882A9 353 | :10F5F000C053D1401FC9E1E0F0E0EC0FFD1FC05D3A 354 | :10F60000DE4F08811981C053D140E00FF11F2083E4 355 | :10F610000F5F1F4FC05DDE4F19830883C053D14079 356 | :10F6200062270A171B0709F005C9D80196E002C92D 357 | :10F63000261709F010C303C0973009F0FBC87724E0 358 | :10F640009981933109F412C19431C8F4963009F4C8 359 | :10F65000D8C0973050F4923009F406C1933009F4C1 360 | :10F660006DC0913009F059C253C0913109F477C08F 361 | :10F67000923108F0BBC0903109F04FC2F5C098310B 362 | :10F6800009F487C0993150F4953109F4EFC09531F0 363 | :10F6900008F4C6C1963109F040C2C2C19A3109F4DA 364 | :10F6A0006CC09A3108F491C09B3109F45BC09D3164 365 | :10F6B00009F033C29D81903359F48F81882311F46E 366 | :10F6C0009EE11CC0813011F091E018C098E916C08D 367 | :10F6D000892F807591F0903539F4E0E0F0E089E011 368 | :10F6E0008093570094910AC0983539F4E3E0F0E034 369 | :10F6F00089E080935700949101C090E01A821B82A8 370 | :10F700008D818C831D829E831F8227E030E009C299 371 | :10F710001A8288E08B8381E48C8386E58D8382E581 372 | :10F720008E8389E48F8383E5888780E589878FE5E9 373 | :10F730008A8782E38B872BE030E0F3C18A818139AD 374 | :10F7400041F0823941F0803911F48FE005C080E04A 375 | :10F7500003C082E001C08AE01A828B8344C0772410 376 | :10F76000739482C08D81882311F48EE12CC0813086 377 | :10F7700011F081E028C088E926C01A82E1E0F0E0BB 378 | :10F7800089E08093570084918B831C8224E030E0D1 379 | :10F79000C8C18B81803589F48C81883039F4E2E0EE 380 | :10F7A000F0E089E08093570084910DC0E0E0F0E044 381 | :10F7B00089E080935700849106C0E3E0F0E089E09F 382 | :10F7C0008093570084911A82DFCF8D81836C99E0FA 383 | :10F7D000E1E0F0E0082E90935700E89507B600FCB2 384 | :10F7E000FDCF1A821B8223E030E09BC180EC8A832C 385 | :10F7F000CE5CDE4F188219821A821B82C253D1401E 386 | :10F800008EC18A8190E0A0E0B0E0582F44273327D2 387 | :10F8100022278B8190E0A0E0B0E0DC0199278827C7 388 | :10F82000282B392B4A2B5B2B8D8190E0A0E0B0E098 389 | :10F83000282B392B4A2B5B2B8C8190E0A0E0B0E089 390 | :10F84000BA2FA92F982F8827282B392B4A2B5B2BCF 391 | :10F85000220F331F441F551FC05EDE4F288339839C 392 | :10F860004A835B83C052D1401A8259C13A81C95C34 393 | :10F87000DE4F3883C753D140CA5CDE4F1882C6536F 394 | :10F88000D1408B81C82EDD24CA5CDE4F488159816E 395 | :10F89000C653D140C42AD52A933109F082C0CE5C28 396 | :10F8A000DE4F88819981AA81BB81C253D1408050AB 397 | :10F8B000904CA340B04030F583E0CE5CDE4FE88052 398 | :10F8C000F9800A811B81C253D140F70100935B008C 399 | :10F8D00080935700E89507B600FCFDCFCE5CDE4F65 400 | :10F8E000088119812A813B81C253D14000501F4FAA 401 | :10F8F0002F4F3F4FCE5CDE4F088319832A833B8313 402 | :10F90000C253D140C05EDE4F488159816A817B81FC 403 | :10F91000C052D140DE011B9631E08C9111962C91A2 404 | :10F9200011971296C75CDE4F2883C953D140C85C3B 405 | :10F93000DE4F1882C853D14090E0C85CDE4FE881AA 406 | :10F94000F981C853D1408E2B9F2B0C01FA01609393 407 | :10F950005B0030935700E89511244E5F5F4F6F4F67 408 | :10F960007F4F0EEFE02E0FEFF02ECE0CDF1CC114F8 409 | :10F97000D10499F685E0C05EDE4F088119812A81A5 410 | :10F980003B81C052D140F80120935B008093570027 411 | :10F99000E89507B600FCFDCF81E180935700E8951C 412 | :10F9A00035C0C05EDE4F88819981AA81BB81C0527B 413 | :10F9B000D140B695A795979587957C018601ABE0D8 414 | :10F9C000AA2EB12CAC0EBD1E0BC0D5016D915D01F0 415 | :10F9D000C7010F947FFE0894E11CF11C01501040F8 416 | :10F9E0000115110591F7A60160E070E0440F551F65 417 | :10F9F000661F771FC05EDE4FE880F9800A811B8199 418 | :10FA0000C052D1404E0D5F1D601F711F1A82C05E33 419 | :10FA1000DE4F488359836A837B83C052D1407FC0C5 420 | :10FA2000FA80C55CDE4FF882CB53D140C65CDE4F16 421 | :10FA30001882CA53D1408B81C82EDD24C65CDE4FAC 422 | :10FA400008811981CA53D140C02AD12A1A828981DA 423 | :10FA5000BE016D5F7F4F843121F59601C05EDE4FA0 424 | :10FA6000E880F9800A811B81C052D1400BBFF701A9 425 | :10FA700087919691DB018C9311969C936E5F7F4FDB 426 | :10FA8000D801C7010296A11DB11DC05EDE4F88835B 427 | :10FA90009983AA83BB83C052D14022503040F1F6F3 428 | :10FAA00036C0C05EDE4F288139814A815B81C052F9 429 | :10FAB000D1400894C108D108760100E010E0089414 430 | :10FAC000C11CD11C0894E11CF11C011D111DE20E8A 431 | :10FAD000F31E041F151F21BDBB27A52F942F832FB5 432 | :10FAE00082BD2F5F3F4F4F4F5F4FF89A80B5DB01CC 433 | :10FAF0008D93BD012E153F054007510761F7C05E8C 434 | :10FB0000DE4F288339834A835B83C052D1409601FC 435 | :10FB10002D5F3F4FFB01108204C080EC8A8322E0FE 436 | :10FB200030E08BE18093C6008091C00086FFFCCF5F 437 | :10FB30008091C00080648093C000C15DDE4FF88179 438 | :10FB4000CF52D140F093C6008091C00086FFFCCF19 439 | :10FB50008091C00080648093C000432F3093C60022 440 | :10FB60008091C00086FFFCCF8091C00080648093AC 441 | :10FB7000C000922F2093C6008091C00086FFFCCF6A 442 | :10FB80008091C00080648093C0008EE08093C600A6 443 | :10FB90008091C00086FFFCCF8091C000806480937C 444 | :10FBA000C00065E1C15DDE4FE880CF52D1406E25D7 445 | :10FBB00069276427FE01319610C090819093C6009A 446 | :10FBC0008091C00086FFFCCF31968091C000806498 447 | :10FBD0008093C0006927215030402115310569F715 448 | :10FBE0006093C6008091C00086FFFCCF8091C0006A 449 | :10FBF00080648093C00085B1805885B9772081F4F6 450 | :10FC0000C15DDE4F0881CF52D1400F5FC15DDE4F35 451 | :10FC10000883CF52D14090E0A0E0B0E00D941AF4F8 452 | :10FC200027982F9880E090E020ED37E0F901319798 453 | :10FC3000F1F7019684369105C9F700008091C00064 454 | :10FC40008D7F8093C00081E180935700E895EE2777 455 | :10FC5000FF270994FFCF90E00D941AF497FB092E2B 456 | :10FC600007260AD077FD04D02ED006D000201AF443 457 | :10FC7000709561957F4F0895F6F7909581959F4F08 458 | :10FC80000895A1E21A2EAA1BBB1BFD010DC0AA1FDD 459 | :10FC9000BB1FEE1FFF1FA217B307E407F50720F0F5 460 | :10FCA000A21BB30BE40BF50B661F771F881F991F70 461 | :10FCB0001A9469F760957095809590959B01AC01B9 462 | :10FCC000BD01CF010895AA1BBB1B51E107C0AA1FAC 463 | :10FCD000BB1FA617B70710F0A61BB70B881F991FED 464 | :10FCE0005A95A9F780959095BC01CD010895F99991 465 | :10FCF000FECF92BD81BDF89A992780B50895262F31 466 | :10FD0000F999FECF1FBA92BD81BD20BD0FB6F89400 467 | :0EFD1000FA9AF99A0FBE01960895F894FFCF63 468 | :040000033000E000E9 469 | :00000001FF 470 | -------------------------------------------------------------------------------- /examples/stk500boot_v2_mega2560.hex.license: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | -------------------------------------------------------------------------------- /examples/trinket_boot.hex: -------------------------------------------------------------------------------- 1 | :2000000093CA15C0EBCA13C012C011C010C00FC00EC00DC00CC00BC00AC009C008C0112422 2 | :200020001FBECFE5D2E0DEBFCDBF02D002C0E8CFFFCFF89400C0F894FFCF00000000000095 3 | :20148000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C 4 | :2014A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB8C5AFC557 5 | :2014C00033C05FC08BC05DC05CC05BC05AC059C058C057C056C055C054C053C052C009028A 6 | :2014E0001200010100803209040000000000000012011001FF00000881179F0C05010102A2 7 | :20150000000110035400720069006E006B006500740012034100640061006600720075006E 8 | :20152000690074000403090411241FBECFE5D2E0DEBFCDBF84B7877F84BF88E10FB6F894DB 9 | :2015400081BD11BC0FBE91E080E80FB6F89486BD96BD0FBE0AEA0F9310E0A0E6B0E0EEEDAF 10 | :20156000FFE102C005900D92A236B107D9F711E0A2E6B0E001C01D92A832B107E1F7F2D38D 11 | :201580002CC59ECFA82FB92F80E090E041E050EA609530E009C02D9182279795879510F086 12 | :2015A00084279527305EC8F36F5FA8F30895EADF8D939D930895A6E088279927AA9569F032 13 | :2015C0000197E1F3B399FCCFB39BFECF81E09927A6B3019611F0A871D9F70895CF93CFB7ED 14 | :2015E000CF93C0915F02CA3A21F0CF91CFBFCF9165CFCC27C395B39BE9F7B39B0BC0B39B60 15 | :2016000009C0B39B07C0B39B05C0B39B03C0B39B01C0D3C00F92DF93C0910B01DD27CE5E86 16 | :20162000DE4F012EB39B03C0DF910F90E6CF2F930F931F934F932FEF4F6F06B303FB20F9D5 17 | :201640005F933F9350E03BE065C016B30126502953FDC89556B3012703FB25F92F7306B398 18 | :20166000B1F05027102713FB26F906B22230F0F000C016B3012703FB27F90126502906B2DD 19 | :201680002430E8F54F77206816B30000F6CF50274F7D206206B2102F000000C006B30026E2 20 | :2016A0005029102713FB26F906B2E2CF4F7B06B3206400C0DACF01265029187106B269F139 21 | :2016C0004E7F2160012F16B328C0002650294D7F06B22260102F29C0012650294B7F06B2EC 22 | :2016E0002460012F2DC016B301265029477F2860000006B22EC04F7E06B3206130C042278C 23 | :2017000006B3499300265029102706B24FEF13FB20F9297F16B379F2187159F101265029F2 24 | :2017200006B2012703FB21F9237F06B371F2002650293150D0F006B2102713FB22F9277E56 25 | :2017400016B351F201265029012703FB06B223F92F7C49F2000006B3102713FB24F90026BC 26 | :20176000502906B22F7939F270CF10E21ABF002717C03B503195C31BD04010E21ABF0881CA 27 | :20178000033CF9F00B34E9F0209109011981110F1213EDCF093651F10D3211F0013E39F783 28 | :2017A000009310013F915F914F911F910F912F91DF910F90CAB7C5FD1DCFCF91CFBFCF9149 29 | :2017C000189520911001222369F310910E01112321F5343022F130930E0120930A01109157 30 | :2017E0000B013BE0311B30930B0119C000910E0101309CF40AE53091600034FD11C00093C8 31 | :201800006000CEEFD0E010C0052710E000C021C0052710E0C89508BB14C03AE501C032ED5F 32 | :20182000032EC0E0D0E032E017B31861C39A08B317BB58E120E84FEF20FF052708BB27959F 33 | :2018400017951C3F28F700004552B0F720FF0527279508BB17951C3FB8F629913A9561F7C4 34 | :20186000077E10910F01110F08BBC250D04011F01093090110E21ABF086017B3177E402F7E 35 | :20188000477E54E05A95F1F708BB17BB48BB8ACF20916F00309170002D3B3441B8F421E0AC 36 | :2018A00020937100F894E0916F00F09170000C0120935700E8951124789480916F00909131 37 | :2018C000700002969093700080936F00089580917100882309F43CC080916F009091700017 38 | :2018E000813C944108F034C0F89480916F00909170008238944110F121E080917200909198 39 | :2019000073008F559A409F70906CEEEBF4E10C0120935700E895112480917A0090917B00ED 40 | :201920008C559A409F70906CECEBF4E10C0120935700E8951124789420936E00E0916F005F 41 | :20194000F0917000329785E080935700E8957894109271000895FF920F931F93CF93DF930C 42 | :2019600080910E01835087FD4EC190910B01ACE0B0E0A91BB109AE5EBE4F31E030936200CB 43 | :2019800090910A019D3209F0FBC0883009F039C183EC8093FE008AE5809360001092F200F7 44 | :2019A0008C91807609F478C010926C0010926B0010926A0011962C911197213009F4C5C1D8 45 | :2019C000263009F447C0273009F042C03093670083EF90E090930D0180930C0113969C9128 46 | :2019E00013979093F5001092F60012968C911297803379F49111ABC11496EC911497F0E04F 47 | :201A0000EE0FFF1F81E280935700E491E093F6009EC18C3A89F4903809F099C114968C917C 48 | :201A20001497811194C115968C91159781118FC181E0809363008BC18C3409F088C11596EE 49 | :201A40008C911597811183C181E0809366007FC1283019F4309367007CC114968D919C910C 50 | :201A600015979093700080936F0016968C9116978093FB00822F8950843008F06AC18FE74A 51 | :201A800088BD309368002093FC002A3009F458C181E08093670054C112969C9112971092A7 52 | :201AA000070111968C911197811106C01092080187E091E022E04CC0853019F490930F01D4 53 | :201AC0003DC0863091F513968C911397813019F480EF94E104C0823041F48EED94E19093FD 54 | :201AE0000D0180930C0122E11CC08330C9F4911108C084E295E190930D0180930C0124E0CE 55 | :201B000010C0913019F482E195E1E9CF923041F482E095E190930D0180930C0120E101C0B4 56 | :201B200020E080E48093F2001EC0883059F0893019F49093110102C08A3039F087E091E0E5 57 | :201B400020E006C081E191E002C087E091E021E090930D0180930C0106C016962C9180E869 58 | :201B60008093F2000AC017968C911797811105C016968C91821708F4282F2093610041C0FD 59 | :201B80009091F20097FF3DC09091FB00182F981708F4192F092F011B0093FB00109267005E 60 | :201BA0008091FC008C3019F4002349F12AC08A30D9F7FA2ECA2FDB2F1DC080916F009091D5 61 | :201BC00070008034910590F421E020936D00FC01EE0FFF1FEE58FF4F288139813183208340 62 | :201BE00002969093700080936F0003C0888199814FDE22968C2F8F198117F8F2D5CF109242 63 | :201C0000610010920E018091600084FF80C0809161008F3F09F47BC0182F893008F018E016 64 | :201C2000811B809361008091FE0098E889278093FE00112309F45AC08091F20087FF38C078 65 | :201C40008091FB00811708F4182F811B8093FB003091FC00E0916F00F091700020E0AFEFC7 66 | :201C6000B0E01FC03B3009F476C03930D9F7E034F10560F4EF01CC0FDD1FCE58DF4F88819C 67 | :201C800099818D939D9332962E5F0BC0EC3B84E1F80710F08FEF01C084918C93119631964E 68 | :201CA0002F5F2117F8F2F0937000E0936F001CC0E0910C01F0910D01AFEFB0E086FF09C03A 69 | :201CC00084918D9331968FEF90E0810F8A13F8CF07C081918D938FEF90E0810F8A13F9CF4A 70 | :201CE000F0930D01E0930C01193058F4612F8FEF90E05DDC1C5F1C3041F08FEF809361009D 71 | :201D000004C08FEF809361001EE11093600084E196B3987131F48150D9F710920F0110923A 72 | :201D20000901C1E08111C0E08091FD008C17A1F0C11103C0F8940FD17894C093FD000CC05B 73 | :201D40008C9187FD0ACF2FEF0ACF21E00CCF24E00ACF20E008CFFFCFDF91CF911F910F9194 74 | :201D6000FF900895C1B7B99A83E28ABD81E083BF8BB780628BBFAC9ABB9A2FE132E18AE087 75 | :201D8000215030408040E1F700C00000BB987894E2DD80916300882321F182E090E09093C6 76 | :201DA00065008093640013C0CF018F739927892B21F483E080935700E895CDDD80916400B0 77 | :201DC0009091650002969093650080936400E0916400F0916500E03C94E1F90728F31092DD 78 | :201DE000630080916600882329F0B5DD70DD10926600B1DD80916200882341F08091670009 79 | :201E0000811104C0809168008111C2CF80916200882371F08091690081110AC088B5805F5F 80 | :201E200088BD88B5811104C08AB590E189278ABD809169008F5F809369008EEC90E00197BD 81 | :201E4000F1F780916A0090916B00019690936B0080936A0020916C00009711F42F5F00C0EA 82 | :201E600020936C0030916200311105C081323EE4930708F05BC030916700332321F0813156 83 | :201E8000974208F053C080916200882309F480CF8091680081117CCF233008F047C078CF05 84 | :201EA00080916E0081114AC08CEB94E19093700080936F0081E08093710009DD3FC0DF015C 85 | :201EC000AA0FBB1FAE58BF4F8D919C91309719F0E430F10531F4E054FB4E85919491805A7F 86 | :201EE000954FD6DCE0916F00F0917000E034F10530F3EDDC10925F0217BA13BE1ABC03C047 87 | :201F000081B78F5F81BF81B78C17D0F303C081B7815081BF81B7C817D0F391E080E80FB639 88 | :201F2000F89486BD96BD0FBECACA13C01BBE15BAF89480916D008111B3CFDCCFE0E0F0E04A 89 | :201F400083E080935700E8951092700010926F00C9CF80E090E0FF920F931F93CF93DF93F3 90 | :201F600090E080E80FB6F89486BD96BD0FBEC8E0D0E010E000E8F12EF00EF1BE1CDB84332B 91 | :201F800029E092070CF41F2D06952197A1F7212F215021BFEC01012F10C00DDB8453994042 92 | :201FA00097FF03C09195819591098C179D0714F401B7EC0181B78F5F81BF81B790E0212FA0 93 | :201FC00030E02F5F3F4F281739073CF701BFDF91CF911F910F91FF900895F894FFCF5AFF64 94 | :00000001FF 95 | -------------------------------------------------------------------------------- /examples/trinket_boot.hex.license: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2 | # SPDX-License-Identifier: MIT 3 | -------------------------------------------------------------------------------- /optional_requirements.txt: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: Unlicense 4 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | [build-system] 6 | requires = [ 7 | "setuptools", 8 | "wheel", 9 | "setuptools-scm", 10 | ] 11 | 12 | [project] 13 | name = "adafruit-circuitpython-avrprog" 14 | description = "CircuitPython helper library for programming AVR chips." 15 | version = "0.0.0+auto.0" 16 | readme = "README.rst" 17 | authors = [ 18 | {name = "Adafruit Industries", email = "circuitpython@adafruit.com"} 19 | ] 20 | urls = {Homepage = "https://github.com/adafruit/Adafruit_CircuitPython_AVRprog"} 21 | keywords = [ 22 | "adafruit", 23 | "avr", 24 | "spi", 25 | "atmega", 26 | "attiny", 27 | "hardware", 28 | "micropython", 29 | "circuitpython", 30 | ] 31 | license = {text = "MIT"} 32 | classifiers = [ 33 | "Intended Audience :: Developers", 34 | "Topic :: Software Development :: Libraries", 35 | "Topic :: Software Development :: Embedded Systems", 36 | "Topic :: System :: Hardware", 37 | "License :: OSI Approved :: MIT License", 38 | "Programming Language :: Python :: 3", 39 | ] 40 | dynamic = ["dependencies", "optional-dependencies"] 41 | 42 | [tool.setuptools] 43 | py-modules = ["adafruit_avrprog"] 44 | 45 | [tool.setuptools.dynamic] 46 | dependencies = {file = ["requirements.txt"]} 47 | optional-dependencies = {optional = {file = ["optional_requirements.txt"]}} 48 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: Unlicense 4 | 5 | Adafruit-Blinka 6 | -------------------------------------------------------------------------------- /ruff.toml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries 2 | # 3 | # SPDX-License-Identifier: MIT 4 | 5 | target-version = "py38" 6 | line-length = 100 7 | 8 | [lint] 9 | preview = true 10 | select = ["I", "PL", "UP"] 11 | 12 | extend-select = [ 13 | "D419", # empty-docstring 14 | "E501", # line-too-long 15 | "W291", # trailing-whitespace 16 | "PLC0414", # useless-import-alias 17 | "PLC2401", # non-ascii-name 18 | "PLC2801", # unnecessary-dunder-call 19 | "PLC3002", # unnecessary-direct-lambda-call 20 | "E999", # syntax-error 21 | "PLE0101", # return-in-init 22 | "F706", # return-outside-function 23 | "F704", # yield-outside-function 24 | "PLE0116", # continue-in-finally 25 | "PLE0117", # nonlocal-without-binding 26 | "PLE0241", # duplicate-bases 27 | "PLE0302", # unexpected-special-method-signature 28 | "PLE0604", # invalid-all-object 29 | "PLE0605", # invalid-all-format 30 | "PLE0643", # potential-index-error 31 | "PLE0704", # misplaced-bare-raise 32 | "PLE1141", # dict-iter-missing-items 33 | "PLE1142", # await-outside-async 34 | "PLE1205", # logging-too-many-args 35 | "PLE1206", # logging-too-few-args 36 | "PLE1307", # bad-string-format-type 37 | "PLE1310", # bad-str-strip-call 38 | "PLE1507", # invalid-envvar-value 39 | "PLE2502", # bidirectional-unicode 40 | "PLE2510", # invalid-character-backspace 41 | "PLE2512", # invalid-character-sub 42 | "PLE2513", # invalid-character-esc 43 | "PLE2514", # invalid-character-nul 44 | "PLE2515", # invalid-character-zero-width-space 45 | "PLR0124", # comparison-with-itself 46 | "PLR0202", # no-classmethod-decorator 47 | "PLR0203", # no-staticmethod-decorator 48 | "UP004", # useless-object-inheritance 49 | "PLR0206", # property-with-parameters 50 | "PLR0904", # too-many-public-methods 51 | "PLR0911", # too-many-return-statements 52 | "PLR0912", # too-many-branches 53 | "PLR0913", # too-many-arguments 54 | "PLR0914", # too-many-locals 55 | "PLR0915", # too-many-statements 56 | "PLR0916", # too-many-boolean-expressions 57 | "PLR1702", # too-many-nested-blocks 58 | "PLR1704", # redefined-argument-from-local 59 | "PLR1711", # useless-return 60 | "C416", # unnecessary-comprehension 61 | "PLR1733", # unnecessary-dict-index-lookup 62 | "PLR1736", # unnecessary-list-index-lookup 63 | 64 | # ruff reports this rule is unstable 65 | #"PLR6301", # no-self-use 66 | 67 | "PLW0108", # unnecessary-lambda 68 | "PLW0120", # useless-else-on-loop 69 | "PLW0127", # self-assigning-variable 70 | "PLW0129", # assert-on-string-literal 71 | "B033", # duplicate-value 72 | "PLW0131", # named-expr-without-context 73 | "PLW0245", # super-without-brackets 74 | "PLW0406", # import-self 75 | "PLW0602", # global-variable-not-assigned 76 | "PLW0603", # global-statement 77 | "PLW0604", # global-at-module-level 78 | 79 | # fails on the try: import typing used by libraries 80 | #"F401", # unused-import 81 | 82 | "F841", # unused-variable 83 | "E722", # bare-except 84 | "PLW0711", # binary-op-exception 85 | "PLW1501", # bad-open-mode 86 | "PLW1508", # invalid-envvar-default 87 | "PLW1509", # subprocess-popen-preexec-fn 88 | "PLW2101", # useless-with-lock 89 | "PLW3301", # nested-min-max 90 | ] 91 | 92 | ignore = [ 93 | "PLR2004", # magic-value-comparison 94 | "UP030", # format literals 95 | "PLW1514", # unspecified-encoding 96 | "PLR0913", # too-many-arguments 97 | "PLR0915", # too-many-statements 98 | "PLR0917", # too-many-positional-arguments 99 | "PLR0904", # too-many-public-methods 100 | "PLR0912", # too-many-branches 101 | "PLR0916", # too-many-boolean-expressions 102 | "PLR6301", # could-be-static no-self-use 103 | "PLC0415", # import outside toplevel 104 | "E501", # line too long 105 | ] 106 | 107 | [format] 108 | line-ending = "lf" 109 | --------------------------------------------------------------------------------