Skip to main content

pymcu-avr-toolchain

Pre-built AVR-GCC toolchain for the PyMCU AVR (ATmega/ATtiny) backend.

The AVR backend compiles PyMCU's architecture-agnostic IR to AVR assembly and then invokes three core tools to produce a flashable Intel HEX file:

avr-gcc   avr-as   avr-objcopy

(Full toolchain also includes avr-g++, avr-ld, avr-ar, avr-objdump, avr-size, avr-gdb, and avr-libc.)

This package is the AVR counterpart of pymcu-rp2040-toolchain: a platform-specific wheel whose only job is to ship those tools so that pip install pymcu-compiler[avr] is fully self-contained — no separate avr-gcc installation required on supported platforms.

The build script (avr-gcc-build.sh) is based on the work of Zak Kemble.

License: GPL-3.0-or-later packaging + binaries

The bundled AVR-GCC toolchain is derived from GCC and Binutils, which are licensed under GPL-3.0-or-later and LGPL-3.0-or-later respectively. avr-libc is BSD-2-Clause. Because the wheel bundles GPL code, the package as a whole is distributed under GPL-3.0-or-later.

  • The GPL applies to the toolchain binaries themselves, not to the firmware your projects compile with them. Firmware produced by avr-gcc is your own work and carries no GPL obligation.
  • Contrast with RP2040: pymcu-rp2040-toolchain bundles LLVM, which is Apache-2.0 WITH LLVM-exception (permissive, no copyleft). The isolation mechanism is the same — a separate optional package — but the license differs because the upstream compilers differ.

See LICENSES/ and NOTICE for the full texts.

Bundled versions

Tool Version
avr-gcc 15.2.0
avr-binutils 2.45
avr-gdb 16.3
avr-libc latest

Installation

pip install pymcu-avr-toolchain

avr-gcc + avr-libc together exceed PyPI's 100 MB per-file ceiling (~150 MB per platform). The distribution is therefore split:

Channel What it contains
PyPI (pip install pymcu-avr-toolchain) Lightweight stub (~14 KB)
GitHub Releases Binary wheels with the full toolchain (~150 MB each)

The binary wheel is downloaded automatically. The first call to get_bin_dir() (or any PyMCU build that needs the toolchain) downloads the correct wheel for your platform from GitHub Releases and extracts it to the shared cache at ~/.pymcu/tools/. Subsequent calls are instant.

import pymcu_avr_toolchain
bin_dir = pymcu_avr_toolchain.get_bin_dir()   # downloads on first call

For CI or air-gapped environments, set PYMCU_AVR_WHEEL_URL to override the download URL, or install the binary wheel directly:

# Linux x86-64
pip install https://github.com/PyMCU/avr-gcc-build/releases/download/v15.2.0.post5/pymcu_avr_toolchain-15.2.0.post5-py3-none-manylinux_2_17_x86_64.whl

# Linux arm64 (best-effort build)
pip install https://github.com/PyMCU/avr-gcc-build/releases/download/v15.2.0.post5/pymcu_avr_toolchain-15.2.0.post5-py3-none-manylinux_2_17_aarch64.whl

# macOS Apple Silicon
pip install https://github.com/PyMCU/avr-gcc-build/releases/download/v15.2.0.post5/pymcu_avr_toolchain-15.2.0.post5-py3-none-macosx_14_0_arm64.whl

# Windows x86-64
pip install https://github.com/PyMCU/avr-gcc-build/releases/download/v15.2.0.post5/pymcu_avr_toolchain-15.2.0.post5-py3-none-win_amd64.whl

System toolchain (alternative)

If you already have avr-gcc installed, the AvrToolchain driver finds the tools automatically via PATH — no package needed:

# macOS
brew tap osx-cross/avr && brew install avr-gcc

# Debian/Ubuntu
apt install gcc-avr binutils-avr avr-libc

Linux arm64: Built on GitHub's ubuntu-24.04-arm runner. The build script was designed for Linux x64; the arm64 build is best-effort (continue-on-error) and may be absent from a release if the runner fails.

macOS Intel (x86-64): The osx-cross/avr tap does not provide x86-64 bottles for avr-gcc, so no Intel wheel is published.

How the driver resolves tools

AvrToolchain (in pymcu-avr) checks these sources in order:

Priority Source
1 pymcu_avr_toolchain.get_bin_dir() — wheel bundle or auto-downloaded cache
2 Shared cache ~/.pymcu/tools/<platform>/pymcu-avr-toolchain/<version>/bin/
3 Common keg dirs (/opt/homebrew/opt/avr-gcc/bin, /usr/bin, …)
4 PATH

A missing wheel never blocks a developer who already has avr-gcc installed.

Inspecting installed tools

pymcu-avr-toolchain-info     # entry-point
python -m pymcu_avr_toolchain

For maintainers: publishing a new wheel

Release process

  1. Update VER_GCC, VER_BINUTILS, VER_GDB in avr-gcc-build.sh and version in python/pyproject.toml.
  2. Tag and push:
    git tag v15.2.0
    git push origin v15.2.0
    
  3. The build-wheels.yml workflow fires automatically:
    • Builds one binary wheel per platform (Linux x64 from source ~2 h, Linux arm64 best-effort, macOS via Homebrew, Windows via MSYS2).
    • Binary wheels → GitHub Releases (too large for PyPI's 100 MB limit).
    • PyPI receives only the pure-Python sdist stub.
    • publish-pypi uses OIDC trusted publishing (no stored token required).

Required GitHub configuration

Item Where Purpose
release environment Repo → Settings → Environments Gates OIDC publishing; add tag protection rule v*

Building a wheel locally

AVRT_TOOLCHAIN_DIR=build/avr-gcc-15.2.0-x64-linux \
WHEEL_PLATFORM_TAG=manylinux_2_17_x86_64 \
uv build --wheel python/

Environment variables

Variable Effect
AVRT_TOOLCHAIN_DIR Path to a staged AVR-GCC tree for hatch_build.py
AVRT_GCC_VERSION Inject GCC version string for cross-build CI steps
WHEEL_PLATFORM_TAG Override the wheel platform tag (e.g. win_amd64)
PYMCU_AVR_WHEEL_URL Override the binary wheel download URL (air-gapped installs)
PYMCU_TOOLS_DIR Override the ~/.pymcu/tools cache root
PYMCU_TOOLCHAIN_NO_SEEDING Set to 1 to use the in-package bin/ directly without seeding the cache

Version history

Package version avr-gcc Notes
15.2.0.post5 15.2.0 Fix project URLs; auto-download on first use
15.2.0 15.2.0 Initial release

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pymcu_avr_toolchain-1!7.3.0.post3-py3-none-win_arm64.whl (56.1 MB view details)

Uploaded Python 3Windows ARM64

pymcu_avr_toolchain-1!7.3.0.post3-py3-none-win_amd64.whl (56.1 MB view details)

Uploaded Python 3Windows x86-64

pymcu_avr_toolchain-1!7.3.0.post3-py3-none-manylinux_2_17_x86_64.whl (57.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

pymcu_avr_toolchain-1!7.3.0.post3-py3-none-manylinux_2_17_aarch64.whl (57.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

pymcu_avr_toolchain-1!7.3.0.post3-py3-none-macosx_14_0_arm64.whl (57.1 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file pymcu_avr_toolchain-1!7.3.0.post3-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 84fd20dcaf8b85eef3ab63607b13d3cf5b00c8b91dea2fd3154d3b4e5e67efbe
MD5 1982c64995df3f68a290302005b2769a
BLAKE2b-256 8e5553a0edaa19d11b331d5888bfc5b6c1aa192de065c7e79ee57336c17e92ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-win_arm64.whl:

Publisher: build-wheels.yml on PyMCU/pymcu-avr-toolchain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymcu_avr_toolchain-1!7.3.0.post3-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 d83ca0b4923d864b5654add035985609acfe02f09a12e2a518dd3172a819ed9e
MD5 5984f4b98a95eeadaa3d3a813b67800f
BLAKE2b-256 d703eddf897f027273da61a250a33eaf9ec05d071d327f1d024898683aaefeb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-win_amd64.whl:

Publisher: build-wheels.yml on PyMCU/pymcu-avr-toolchain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymcu_avr_toolchain-1!7.3.0.post3-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5d903186026caf93950d06a50699043ad84f466b5d1694c4cf151ae1bffcc22c
MD5 b884d78557389e1263f093516c25fa12
BLAKE2b-256 8cf5705bbe1572eea1552c4fd08b6d098d655e8f4b63afc7bb9e884eb6ca9a1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-manylinux_2_17_x86_64.whl:

Publisher: build-wheels.yml on PyMCU/pymcu-avr-toolchain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymcu_avr_toolchain-1!7.3.0.post3-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 3ce031b7f7e9c8a5e9003aa9a15cc54ab14cdeba28f7c54c3d57cc7ea2b264e9
MD5 e9d8c090eea6683e3e903dc3c0572705
BLAKE2b-256 ed0463be5db90263a06eb19cc1d57262221aa3da1ba6367857454cb1dc2389e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-manylinux_2_17_aarch64.whl:

Publisher: build-wheels.yml on PyMCU/pymcu-avr-toolchain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymcu_avr_toolchain-1!7.3.0.post3-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 4c02d7b4385f7643c099ed584dfa09886d007e7891ee0367de59c5179159d8eb
MD5 719937451fcd1bc368812bd1b6f7dd28
BLAKE2b-256 2d6c015fe54ebbc309507ef8a57c5283432614502db0963985adecf6fc12e493

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymcu_avr_toolchain-1!7.3.0.post3-py3-none-macosx_14_0_arm64.whl:

Publisher: build-wheels.yml on PyMCU/pymcu-avr-toolchain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1!14.2.0

3 files

This release

1!7.3.0.post3 This release

5 files

1!7.3.0.post2

5 files

1!7.3.0.post1

5 files

1!7.3.0

5 files

15.2.0.post16

1 file

15.2.0.post15

1 file

15.2.0.post14

1 file

15.2.0.post13

1 file

15.2.0.post12

1 file

15.2.0.post11

1 file

15.2.0.post10

1 file

15.2.0.post9

1 file

15.2.0.post8

1 file

15.2.0.post6

1 file

15.2.0.post5

1 file

15.2.0.post4

1 file

15.2.0.post3

1 file

15.2.0.post2

1 file

15.2.0

1 file

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