Skip to main content

ARM (Cortex-M) support for pymcu-compiler: LLVM-IR codegen backend + LLVM toolchain driver

Project description

pymcu-arm

ARM (Cortex-M) support for the PyMCU compiler: LLVM-IR codegen backend + LLVM toolchain driver.

Unlike the AVR/PIC/RISC-V backends, this backend does not emit assembly directly. It lowers PyMCU's architecture-agnostic IR (.mir) to LLVM IR text (.ll) and hands it to LLVM — so register allocation, instruction selection, the AAPCS calling convention, and all optimization passes are done by LLVM.

Currently supported targets:

Target Triple CPU
RP2040 (Raspberry Pi Pico) thumbv6m-none-eabi cortex-m0plus

The codegen is chip-agnostic: only -mtriple/-mcpu change per target.

Pipeline

pymcuc --emit-ir        →  firmware.mir    (target-agnostic IR, 32-bit pointers)
pymcuc-arm (this pkg)   →  firmware.ll     (LLVM IR text)
LLVM toolchain          →  opt → llc → ld.lld → llvm-objcopy
                            + generic boot2 (crc32) + crt0  →  firmware.bin

The flat flash image (firmware.bin, boot2 at offset 0) is what the RP2040Sharp emulator's PicoSimulation.LoadFlash(...) consumes in the integration tests.

Installation

pip install pymcu-arm

LLVM tools are resolved (in order) from the pymcu-arm-toolchain wheel cache, common system install paths (/opt/homebrew/opt/llvm/bin, /usr/lib/llvm/bin), or PATH. A system LLVM (brew install llvm lld / apt install llvm lld) also works with no extra package.

Layout

src/python/pymcu/backend/rp2040/    backend plugin — wraps pymcuc-arm
src/python/pymcu/toolchain/rp2040/  LLVM toolchain driver (opt → firmware.bin)
src/csharp/lib/                     Rp2040BackendProvider + Targets/RP2040/Rp2040LlvmCodeGen
src/csharp/cli/                     pymcuc-arm runner CLI
src/runtime/                        generic boot2 (crc32), crt0, rp2040.ld linker script

Status

Alpha. MVP scope: single-core (core0), GPIO + UART0. No GC / exceptions / float yet.

Project details


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_arm-0.1.0a1.post0-py3-none-win_amd64.whl (1.8 MB view details)

Uploaded Python 3Windows x86-64

pymcu_arm-0.1.0a1.post0-py3-none-manylinux_2_28_x86_64.whl (1.9 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

pymcu_arm-0.1.0a1.post0-py3-none-manylinux_2_28_aarch64.whl (1.8 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

pymcu_arm-0.1.0a1.post0-py3-none-macosx_15_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

pymcu_arm-0.1.0a1.post0-py3-none-macosx_13_0_x86_64.whl (1.9 MB view details)

Uploaded Python 3macOS 13.0+ x86-64

File details

Details for the file pymcu_arm-0.1.0a1.post0-py3-none-win_amd64.whl.

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for pymcu_arm-0.1.0a1.post0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 675f172db0110651aba1fde533254744d5ddcd2e4f122fd607ba807cdc336111
MD5 16841990798bc4ee43a2c2ed1092e299
BLAKE2b-256 43243297fb31070d5de18acc774477a0b56bb61adf7a762de4a272b9d14c61f9

See more details on using hashes here.

File details

Details for the file pymcu_arm-0.1.0a1.post0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post0-py3-none-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for pymcu_arm-0.1.0a1.post0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 df8bde7b0ff7e2c31b3ab35d63fb16b12be392556f8f16b546fd9544e50d8fd9
MD5 81d1d1671baaf6a8102b2d96a022649d
BLAKE2b-256 c67960b416c696a5166e5a60ab5aa37213b0ac2218ab483929e71674754f5e8f

See more details on using hashes here.

File details

Details for the file pymcu_arm-0.1.0a1.post0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post0-py3-none-manylinux_2_28_aarch64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3, manylinux: glibc 2.28+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for pymcu_arm-0.1.0a1.post0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dec67cb47b5f76d4b5a3a4e50b6c8d54d92b5356d190a70c5f97cc0026053484
MD5 43c76f8959b7dc0e78ca4828ca26a1a9
BLAKE2b-256 653541a60cbd01767465ed4622bf0299b0de8008f9b7ffc6ec49946408f2246c

See more details on using hashes here.

File details

Details for the file pymcu_arm-0.1.0a1.post0-py3-none-macosx_15_0_arm64.whl.

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post0-py3-none-macosx_15_0_arm64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3, macOS 15.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for pymcu_arm-0.1.0a1.post0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 b7d59a0d798e9b44f1bfa7adcde3a90b9a6e216dcd9c9d643c5e4abff574717b
MD5 2339a05c59ba9cba301d0cee3e5e7ce1
BLAKE2b-256 958217dbb491103fb11b9a9071320e89d7af56ee6247e7f7ec67e5c2d806ff48

See more details on using hashes here.

File details

Details for the file pymcu_arm-0.1.0a1.post0-py3-none-macosx_13_0_x86_64.whl.

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post0-py3-none-macosx_13_0_x86_64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3, macOS 13.0+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for pymcu_arm-0.1.0a1.post0-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 a85471812c8244ba645dadcb4f04883b00924258d01f55f60d5d4bb6f1ac7430
MD5 0ca4440c4424c5409b16180d95ea3d6d
BLAKE2b-256 e34352017d72965a5efabba720186001cf5ae0d446b672ec616ec392f9311116

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page