mcbootflash


Namemcbootflash JSON
Version 8.0.2 PyPI version JSON
download
home_pageNone
SummaryFlash firmware to devices running Microchip's 16-bit bootloader.
upload_time2024-05-11 15:53:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords firmware flashing bootloader serial uart microchip pic24 dspic33 16-bit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mcbootflash

![build](https://github.com/bessman/mcbootflash/actions/workflows/main.yml/badge.svg)
[![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://bessman.github.io/mcbootflash/)
[![PyPI](https://img.shields.io/pypi/v/mcbootflash.svg)](https://pypi.org/project/mcbootflash/)
[![License](https://img.shields.io/pypi/l/mcbootflash)](https://mit-license.org/)

## What

Mcbootflash is a Python tool for flashing firmware to 16-bit Microchip MCUs and DSCs
from the PIC24 and dsPIC33 families of devices, which are running a
[bootloader](https://www.microchip.com/en-us/software-library/16-bit-bootloader)
generated by the MPLAB Code Configurator tool.

Mcbootflash is intended to be a drop-in replacement for Microchip's official tool, the
Unified Bootloader Host Application (UBHA).

## Why

Mcbootflash is:

### Scriptable

As a command-line application, mcbootflash is easily scriptable.

### Extensible

In addition to its command-line interface, mcbootflash can be used as a library by
applications wanting to implement firmware flashing as part of a larger suite of
features.

### Free and Open Source

Mcbootflash is distributed under the MIT license.

## Installation

`pip install mcbootflash`

## Usage

Mcbootflash can be used as both a command-line application and a library.

### Command-line

```shellsession
$ mcbootflash --help
usage: mcbootflash [-h] -p PORT -b BAUDRATE [-t TIMEOUT] [-v] [-q] [--version] hexfile

Flash firmware over serial connection to a device running Microchip's 16-bit bootloader.

positional arguments:
  hexfile               an Intel HEX file containing application firmware

optional arguments:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  serial port connected to the device you want to flash
  -b BAUDRATE, --baudrate BAUDRATE
                        symbol rate of device's serial bus
  -t TIMEOUT, --timeout TIMEOUT
                        try to read data from the bus for this many seconds before giving up
  -v, --verbose         print debug messages
  -q, --quiet           suppress output
  --version             show program's version number and exit
```

#### Example

```shellsession
$ mcbootflash --port /dev/ttyUSB0 --baudrate 460800 firmware.hex
Connecting to bootloader...
Connected
Existing application detected, erasing...
Application erased
Flashing firmware.hex
100%  88.7 KiB |########################################| Elapsed Time: 0:00:05
Self verify OK
```

### Library

When using mcbootflash as a library, typical workflow looks something like this:

``` py
import mcbootflash as bf
import serial


# Connect to a device in bootloader mode.
connection = serial.Serial(port=<PORT>, baudrate=<BAUDRATE>, timeout=<TIMEOUT>)
# Query its attributes.
bootattrs = bf.get_boot_attrs(connection)
# Load the firmware image and split it into chunks.
total_bytes, chunks = bf.chunked(hexfile=<HEXFILE_PATH_STRING>, bootattrs)
# Erase the device's program memory area.
bf.erase_flash(connection, bootattrs.memory_range, bootattrs.erase_size)

# Write the firmware chunks to the bootloader in a loop.
for chunk in chunks:
    bf.write_flash(connection, chunk)

    # Optionally, check that the write is OK by checksumming.
    if bootattrs.has_checksum:
        bf.checksum(connection, chunk)

    # At this point, you may want to give an indication of the flashing progress,
    # like updating a progress bar.

# Verify that the new application is detected.
bf.self_verify(connection)
```

See also the [API Reference](https://bessman.github.io/mcbootflash/api/).
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mcbootflash",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "firmware, flashing, bootloader, serial, uart, microchip, pic24, dspic33, 16-bit",
    "author": null,
    "author_email": "Alexander Bessman <alexander.bessman@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ff/58/ed25e717b27904552201d85aabc6793cf350920b65d38634a7f10b7c1c3b/mcbootflash-8.0.2.tar.gz",
    "platform": null,
    "description": "# mcbootflash\n\n![build](https://github.com/bessman/mcbootflash/actions/workflows/main.yml/badge.svg)\n[![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://bessman.github.io/mcbootflash/)\n[![PyPI](https://img.shields.io/pypi/v/mcbootflash.svg)](https://pypi.org/project/mcbootflash/)\n[![License](https://img.shields.io/pypi/l/mcbootflash)](https://mit-license.org/)\n\n## What\n\nMcbootflash is a Python tool for flashing firmware to 16-bit Microchip MCUs and DSCs\nfrom the PIC24 and dsPIC33 families of devices, which are running a\n[bootloader](https://www.microchip.com/en-us/software-library/16-bit-bootloader)\ngenerated by the MPLAB Code Configurator tool.\n\nMcbootflash is intended to be a drop-in replacement for Microchip's official tool, the\nUnified Bootloader Host Application (UBHA).\n\n## Why\n\nMcbootflash is:\n\n### Scriptable\n\nAs a command-line application, mcbootflash is easily scriptable.\n\n### Extensible\n\nIn addition to its command-line interface, mcbootflash can be used as a library by\napplications wanting to implement firmware flashing as part of a larger suite of\nfeatures.\n\n### Free and Open Source\n\nMcbootflash is distributed under the MIT license.\n\n## Installation\n\n`pip install mcbootflash`\n\n## Usage\n\nMcbootflash can be used as both a command-line application and a library.\n\n### Command-line\n\n```shellsession\n$ mcbootflash --help\nusage: mcbootflash [-h] -p PORT -b BAUDRATE [-t TIMEOUT] [-v] [-q] [--version] hexfile\n\nFlash firmware over serial connection to a device running Microchip's 16-bit bootloader.\n\npositional arguments:\n  hexfile               an Intel HEX file containing application firmware\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -p PORT, --port PORT  serial port connected to the device you want to flash\n  -b BAUDRATE, --baudrate BAUDRATE\n                        symbol rate of device's serial bus\n  -t TIMEOUT, --timeout TIMEOUT\n                        try to read data from the bus for this many seconds before giving up\n  -v, --verbose         print debug messages\n  -q, --quiet           suppress output\n  --version             show program's version number and exit\n```\n\n#### Example\n\n```shellsession\n$ mcbootflash --port /dev/ttyUSB0 --baudrate 460800 firmware.hex\nConnecting to bootloader...\nConnected\nExisting application detected, erasing...\nApplication erased\nFlashing firmware.hex\n100%  88.7 KiB |########################################| Elapsed Time: 0:00:05\nSelf verify OK\n```\n\n### Library\n\nWhen using mcbootflash as a library, typical workflow looks something like this:\n\n``` py\nimport mcbootflash as bf\nimport serial\n\n\n# Connect to a device in bootloader mode.\nconnection = serial.Serial(port=<PORT>, baudrate=<BAUDRATE>, timeout=<TIMEOUT>)\n# Query its attributes.\nbootattrs = bf.get_boot_attrs(connection)\n# Load the firmware image and split it into chunks.\ntotal_bytes, chunks = bf.chunked(hexfile=<HEXFILE_PATH_STRING>, bootattrs)\n# Erase the device's program memory area.\nbf.erase_flash(connection, bootattrs.memory_range, bootattrs.erase_size)\n\n# Write the firmware chunks to the bootloader in a loop.\nfor chunk in chunks:\n    bf.write_flash(connection, chunk)\n\n    # Optionally, check that the write is OK by checksumming.\n    if bootattrs.has_checksum:\n        bf.checksum(connection, chunk)\n\n    # At this point, you may want to give an indication of the flashing progress,\n    # like updating a progress bar.\n\n# Verify that the new application is detected.\nbf.self_verify(connection)\n```\n\nSee also the [API Reference](https://bessman.github.io/mcbootflash/api/).",
    "bugtrack_url": null,
    "license": null,
    "summary": "Flash firmware to devices running Microchip's 16-bit bootloader.",
    "version": "8.0.2",
    "project_urls": {
        "Home": "https://bessman.github.io/mcbootflash/"
    },
    "split_keywords": [
        "firmware",
        " flashing",
        " bootloader",
        " serial",
        " uart",
        " microchip",
        " pic24",
        " dspic33",
        " 16-bit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1f85a65c50774431cea167517ca1178410268940160807abb0c6c37bfd36baea",
                "md5": "c47401212422b3181669f697ae6358b4",
                "sha256": "39f57c340c792178131fea4f944f6411cfffe3ccf382aa7168b6c001914b2d93"
            },
            "downloads": -1,
            "filename": "mcbootflash-8.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c47401212422b3181669f697ae6358b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 14626,
            "upload_time": "2024-05-11T15:53:15",
            "upload_time_iso_8601": "2024-05-11T15:53:15.033638Z",
            "url": "https://files.pythonhosted.org/packages/1f/85/a65c50774431cea167517ca1178410268940160807abb0c6c37bfd36baea/mcbootflash-8.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ff58ed25e717b27904552201d85aabc6793cf350920b65d38634a7f10b7c1c3b",
                "md5": "ce30fb86eb955433a1af5d4ae7f8bbc0",
                "sha256": "1e342e025b2adb2ca451351c01979597b933fd237adbbb236e94765c1a2509b4"
            },
            "downloads": -1,
            "filename": "mcbootflash-8.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ce30fb86eb955433a1af5d4ae7f8bbc0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 27121,
            "upload_time": "2024-05-11T15:53:18",
            "upload_time_iso_8601": "2024-05-11T15:53:18.365219Z",
            "url": "https://files.pythonhosted.org/packages/ff/58/ed25e717b27904552201d85aabc6793cf350920b65d38634a7f10b7c1c3b/mcbootflash-8.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-11 15:53:18",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mcbootflash"
}
        
Elapsed time: 1.62406s