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.post1-py3-none-win_arm64.whl (1.7 MB view details)

Uploaded Python 3Windows ARM64

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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

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

Uploaded Python 3macOS 15.0+ ARM64

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post1-py3-none-win_arm64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3, Windows 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.post1-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 f3c8dc18730a39e0b256e5d9cc5f06a82e37a5b8169e9df0760df1b06d7e9122
MD5 767bc5a638f5a2448c2e063ac0fe742b
BLAKE2b-256 285cbed7e7c7ac6197873ca3d04ec51b89f5bbaa64426ea09ae0611043f82c24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post1-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.post1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 278fe7a6c7075f100a57a775c86d7db7df5d772463385fdc5c00745993c89274
MD5 b48fdb09efc24b417bab5257628e3801
BLAKE2b-256 768665591a75f8c6d3a6db403f0dff623d173259b65aef309effe43c10b9b7b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post1-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.post1-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f4cae69b0fb64714edafd93dafa043104bfafbf969a11e194848750e2019b4e0
MD5 15c4ecfa03d8787d2d6b84337c73a43e
BLAKE2b-256 5e4049436266c46de2b9b6695672b42fedd7d1ca4333842a46cfbf3698967c8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post1-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.post1-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a61f17fce4e604d4ba2a966454774080815cb95de794b9c02c73ca1dd409377a
MD5 aa26858cfc82ad011cd261955bb227bf
BLAKE2b-256 6f6fc5ea857a86920b8e45d5a4f1785383f691ba8988592288855b0d0eae2c4c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post1-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.post1-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 5a62099cdaa3edd2bba278fbffe4166cf1d34d1e15c8127eedf9e66414e2937f
MD5 017a5175c72950839a29c773540a6b51
BLAKE2b-256 de063259c786f8b39a66f354bf7929168f5257d85b26ee978c878617b3d29a2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymcu_arm-0.1.0a1.post1-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.post1-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 590c7aeb68a729489771ee075691b74814d5f6f7d2dfecc1442c2c31b25e51b1
MD5 0e789ac0dfc6cb07091018987b201513
BLAKE2b-256 c62a77c4c7a3ffa5092675622a79e77be6aabeb9cfeff25862d88aa6387fab2b

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