Firmware Size: Bare-Arm's Sub-60KB Code Record

The 'bare-arm' port currently achieves a firmware size of approximately 56,500 bytes, demonstrating MicroPython's ability to run with an exceptionally small code footprint on an STM32F405-based board.

The top 3

  1. Bare-Arm's Minimal Core: Sub-60KB Breakdown: The sub-60KB size of MicroPython's bare-arm port is achieved by including only the absolute minimum components: the core Python 3 compiler, runtime, and virtual machine. This port is highly configurable at compile-time, allowing developers to disable non-essential features and modules to reduce its footprint, and leverages optimizations like frozen bytecode for execution from ROM.
  2. Minimal Python Race: Interpreters' Smallest Footprints: MicroPython's bare-arm port, designed to track the core runtime and VM size, achieves a sub-60KB firmware footprint. This places it among the leanest Python implementations, comparable to or even smaller than projects like Phil Hassey's TinyPython, which was noted for its 64KB code size. Other minimal interpreters like pocketpy are measured in Lines of Code, indicating different optimization approaches.
  3. Python vs. C/Assembly: Firmware Size Showdown: While MicroPython's bare-arm core achieves a sub-60KB size, compiled C/C++ applications on microcontrollers can often be significantly smaller. A minimal Arduino sketch (C++) might use 2–10 KB of flash, and even complex C++ projects can fit within 32 KB on chips like the ATmega328P, demonstrating the inherent overhead of an interpreted language's core versus directly compiled machine code.

Sources

Open the full topic