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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

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

Uploaded Python 3macOS 15.0+ ARM64

pymcu_arm-0.1.0a1-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-py3-none-win_amd64.whl.

File metadata

  • Download URL: pymcu_arm-0.1.0a1-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-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f0d403d9221d112d4c4596fbfb5bd907f83a755a89bc8c5daeba79c20bb4247c
MD5 3173bb55252a33af0e35b1ceadda71c9
BLAKE2b-256 92f11d4c7f9b07357a8bf528851079a6da85ccbab0ca37762b63cfb15b45ac44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1-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-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 676a182d1ba72b834b6a5a8ed30e0ab997cfa02533a5e548038200349b55bae1
MD5 56546c1309eaa937b657e072158a7ee2
BLAKE2b-256 6ea9d331aafb3154764552535c84eee078a81c251f4f257425cbc7322d543f6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1-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-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5e90497da817b0aac826f762baa7bd2b7c8de4351ef3daa264fc39591a65b819
MD5 78d5acd000b92cc57561fc2f69a1728c
BLAKE2b-256 ad5f411f6eb295d4b16237884a2099d362caeae24ae7ed69bb80f0ed4aa94399

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1-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-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 1be2fb3fdeb54fea82c722edfe6725f5026f18f7e8402ae65b0fa66961c50556
MD5 845efc640e079c5712ddb94919eb7924
BLAKE2b-256 5abb15a58b3ab562549e47a999821a029b4ddd5e8a28748dd4aad0a3b3617e08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1-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-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 cce4e18ec31ef9cac1d6a4c36957b0583b4158b0c65fba5257bf0ac5689f1716
MD5 731f3f7c595d429a33e9be1e4543a5f4
BLAKE2b-256 a8f7d37632ef4510d167b82d0fe69afd0d9bd657733150ddc8b246600e5579ff

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