Skip to main content

bossac-wrapper

A thin Python wrapper for bossac by ShumaTech - a flash programmer for Atmel SAM microcontrollers with a SAM-BA bootloader, such as the Arduino Due, Arduino Zero and MKR boards.

Installation

pip install bossac-wrapper

This will install bossac-wrapper along with the necessary bossac binary for your system.

bossac-wrapper requires Python 3.10 or later. Supported platforms are:

  • Linux (x86_64, arm64)
  • macOS (Intel, Apple Silicon)
  • Windows (x86_64)

Examples

Uploading a firmware file

To upload a firmware file to a device, use the upload() function. Both Intel HEX files (.hex) and raw binaries (.bin) are supported.

import bossac
import logging

logging.basicConfig(level=logging.INFO)
bossac.upload('blink.hex', port='/dev/ttyACM0')

By default, the device is first put into its bootloader with a 1200 baud touch. Its flash is then erased, written and verified, and the device is reset to start the new firmware. The progress will be logged:

INFO:bossac:Erase flash
INFO:bossac:Done in 0.887 seconds
INFO:bossac:Write 10288 bytes to flash (161 pages)
INFO:bossac:Done in 0.067 seconds
INFO:bossac:Verify 10288 bytes of flash
INFO:bossac:Verify successful
INFO:bossac:Done in 0.276 seconds
INFO:bossac:Set boot flash true

An Intel HEX file carries its addresses, so it is flashed at the right offset on any board. A binary file doesn't, so its offset has to be given - it depends on the board's bootloader, e.g. 0x2000 on SAMD21 boards with an Arduino-style bootloader, or 0 on the Arduino Due, whose bootloader is in ROM. On a board whose bootloader is in flash, an offset of 0 would overwrite it.

bossac.upload('blink.bin', port='/dev/ttyACM0', offset=0x2000)  # SAMD21

When uploading via a USB-to-serial bridge, such as the programming port of the Arduino Due, pass usb=False:

bossac.upload('blink.bin', port='/dev/ttyACM0', offset=0, usb=False)

Getting device information

To get the details of a device, use the info() function. The device must be in its bootloader, e.g. after double-tapping its reset button. touch=True puts it there, too - but that usually destroys the firmware, which then has to be uploaded again: the Arduino Due erases its flash, and SAMD boards running Arduino firmware erase its first flash row.

import bossac

bossac.info(port='/dev/ttyACM0')

For a SparkFun SAMD21 Mini, this returns:

{
    'device': 'ATSAMD21x18',
    'version': 'v1.1 [Arduino:XYZ] Feb 20 2019 10:43:51',
    'address': 0,
    'pages': 4096,
    'page_size': 64,
    'total_size': 262144,
    'planes': 1,
    'lock_regions': 16,
    'locked': [],
    'security': False,
    'boot_flash': None,
    'brownout_detection': True,
    'brownout_reset': True,
}

Full Documentation

The full API documentation is available here.

License

bossac-wrapper's own code is licensed under the MIT License. The MIT License does not cover the bossac executable bundled with the wheels. bossac is part of BOSSA by ShumaTech and is distributed under the BSD-3-Clause license - see THIRD_PARTY_NOTICES.md.

License Coverage CI PyPI

Metadata

Release files for bossac-wrapper 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bossac-wrapper 0.1.1
File Size Uploaded Provenance Actions
bossac_wrapper-0.1.1.tar.gz 51.0 kB Without provenance Details for bossac_wrapper-0.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for bossac-wrapper 0.1.1
File Actions
bossac_wrapper-0.1.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for bossac_wrapper-0.1.1-py3-none-win_amd64.whl
bossac_wrapper-0.1.1-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for bossac_wrapper-0.1.1-py3-none-manylinux_2_28_x86_64.whl
bossac_wrapper-0.1.1-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for bossac_wrapper-0.1.1-py3-none-manylinux_2_28_aarch64.whl
bossac_wrapper-0.1.1-py3-none-macosx_11_0_x86_64.whl Python 3 none macOS 11.0+ x86-64 Details for bossac_wrapper-0.1.1-py3-none-macosx_11_0_x86_64.whl
bossac_wrapper-0.1.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for bossac_wrapper-0.1.1-py3-none-macosx_11_0_arm64.whl

Total release size: 1.2 MB

Release files / bossac_wrapper-0.1.1.tar.gz

Download URL bossac_wrapper-0.1.1.tar.gz
Size 51.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cd873a81ba998e4da3e28bb581fe8477b5ba94c3c235fea0e51051b4d3854b50
BLAKE2b-256 checksum
How to use checksums
75edeba161638da0fc75f0cadc086bae1b69b3bd1122f0b2669818131521ad0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bossac_wrapper-0.1.1-py3-none-win_amd64.whl

Download URL bossac_wrapper-0.1.1-py3-none-win_amd64.whl
Size 136.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
bde2db1b8b0f31c1aac1e29bc6097cb383efee99f90ce6d5bc15acbf1644524e
BLAKE2b-256 checksum
How to use checksums
8c5cfc0a8810bad6e38b9496ccf90e592dbdb3cecef69fa6a8ff8e82673e3ded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bossac_wrapper-0.1.1-py3-none-manylinux_2_28_x86_64.whl

Download URL bossac_wrapper-0.1.1-py3-none-manylinux_2_28_x86_64.whl
Size 422.9 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
c036cc079ef58a1b362da26cdd335b2c8ea0ebe46c5782fe446f7523960af664
BLAKE2b-256 checksum
How to use checksums
01146c0fefaef2418a0ac36a62702fea81a5a3ef76346227462ac9f1a0a8e94f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bossac_wrapper-0.1.1-py3-none-manylinux_2_28_aarch64.whl

Download URL bossac_wrapper-0.1.1-py3-none-manylinux_2_28_aarch64.whl
Size 405.0 kB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
13cfe81ea29c344dc33cd4a676a6d156f82f924c76c46045023466e1310b27c2
BLAKE2b-256 checksum
How to use checksums
7bc73e261377011c308cc4147fd5a0287c09950a3d439d08e5f2b8641723440a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bossac_wrapper-0.1.1-py3-none-macosx_11_0_x86_64.whl

Download URL bossac_wrapper-0.1.1-py3-none-macosx_11_0_x86_64.whl
Size 52.4 kB
Tags Python 3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
50788c0bcdaad68dfee450a8bc6c36771e4614b3a154a8e34968a50f1bca5853
BLAKE2b-256 checksum
How to use checksums
938f81090f445ea91c0fa50ad837fd09fb65efeb257020fe654cfebd4fdc79e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bossac_wrapper-0.1.1-py3-none-macosx_11_0_arm64.whl

Download URL bossac_wrapper-0.1.1-py3-none-macosx_11_0_arm64.whl
Size 89.4 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0ffe059963c08fca2a3b60922c7a2d6214dac34eda57fd578110e6431e63b410
BLAKE2b-256 checksum
How to use checksums
4bf41fd3c603b9b65fba8aa00b562f939253d7ea91b5a44239797e033e60da9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for bossac-wrapper 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

6 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page