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-arm-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.
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-gccis your own work and carries no GPL obligation. - Contrast with ARM:
pymcu-arm-toolchainbundles 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.
| Tool | Version |
|---|---|
| avr-gcc | 15.2.0 |
| avr-binutils | 2.45 |
| avr-gdb | 16.3 |
| avr-libc | latest |
pip install pymcu-avr-toolchainavr-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 callFor 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.whlIf 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-libcLinux arm64: Built on GitHub's
ubuntu-24.04-armrunner. 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/avrtap does not provide x86-64 bottles for avr-gcc, so no Intel wheel is published.
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.
pymcu-avr-toolchain-info # entry-point
python -m pymcu_avr_toolchain- Update
VER_GCC,VER_BINUTILS,VER_GDBinavr-gcc-build.shandversioninpython/pyproject.toml. - Tag and push:
git tag v15.2.0 git push origin v15.2.0
- The
build-wheels.ymlworkflow 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-pypiuses OIDC trusted publishing (no stored token required).
| Item | Where | Purpose |
|---|---|---|
release environment |
Repo → Settings → Environments | Gates OIDC publishing; add tag protection rule v* |
AVRT_TOOLCHAIN_DIR=build/avr-gcc-15.2.0-x64-linux \
WHEEL_PLATFORM_TAG=manylinux_2_17_x86_64 \
uv build --wheel python/| 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 |
| 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 |