HomeElectronics NewsCircuitPython Turbo Brings 19x Faster Math To RP2040 Boards

CircuitPython Turbo Brings 19x Faster Math To RP2040 Boards

CircuitPython can now load native and Viper code compiled on a desktop, cutting a fixed-point Mandelbrot benchmark on a Metro RP2040 from 8.3 seconds to 0.42 seconds.

Illustrated CircuitPython Turbo mascot snake driving a race car on a desert track
CircuitPython Turbo cuts the fixed-point Mandelbrot benchmark on a Metro RP2040 from 8.3 seconds to 0.42 seconds using Viper-compiled machine code. (Image: Adafruit)

CircuitPython boards based on the RP2040 and RP2350 can now run compiled machine code alongside ordinary Python through Adafruit’s CircuitPython Turbo feature. Turbo uses the CIRCUITPY_LOAD_NATIVE build option to allow compatible CircuitPython firmware to load native and Viper .mpy modules compiled on a desktop computer. Adafruit has documented the feature in its CircuitPython Turbo guide.

Until now, using native code in CircuitPython generally required native-code support to be built into the firmware for the target board. Turbo takes a host-compilation approach instead. A developer selects a function to accelerate, uses mpy-cross on a computer to compile it for the target processor, and copies the resulting .mpy module to the board. Compatible CircuitPython firmware loads the compiled module when it is imported, so the board does not need to perform the compilation itself.

Adafruit published a fixed-point Mandelbrot benchmark using a 160 × 120 image with a maximum of 64 iterations per pixel, run on an Adafruit Metro RP2040. The board uses the RP2040’s Cortex-M0+ cores and armv6m instruction set. The same calculation was run in ordinary Python bytecode, Native and Viper modes, with all three returning the same calculated value.

Ordinary Python bytecode took 8,335.3 ms. The Native version took 4,778.0 ms, giving a 1.74 times speedup. Viper reduced the time to 422.9 ms, equivalent to a 19.71 times speedup over bytecode. The measurements were recorded on 8 September 2026 using the CircuitPython Turbo benchmark.

The 19.71 times figure applies specifically to this Mandelbrot calculation rather than to an entire CircuitPython application. Tasks involving sensor reads, file access, display updates or other hardware operations can limit the overall speedup. Adafruit notes that the benchmark measures the calculation itself, while a complete application also spends time communicating with hardware and handling other tasks.

A separate, smaller workload recorded during the Turbo development work also showed substantial reductions in execution time across RP2040 and RP2350 boards. Those figures should be treated as a separate benchmark rather than directly compared with the Mandelbrot results.

The CIRCUITPY_LOAD_NATIVE option adds roughly 2.7 to 3 KB of flash overhead on RP2-based boards. The option is disabled by default in CircuitPython, while the Raspberry Pi port enables it for supported RP2040 and RP2350 boards. Four Pimoroni RP2040 Wi-Fi boards were also included after maintainers confirmed that the resulting builds remained within their available flash space using the GCC 15.2.1 toolchain used for continuous integration.

The CircuitPython Turbo guide is explicit that the feature accelerates computation rather than input and output. It is useful when a board spends significant time processing data, such as generating NeoPixel effects, drawing fractals, processing audio, filtering sensor readings or preparing large numbers of pixels. It does not make a slow sensor bus or display connection faster, and the surrounding application code continues to run as ordinary Python.

Turbo is currently available for supported RP2040 and RP2350 boards through the latest official CircuitPython builds. Adafruit’s documentation directs users to the latest continuous build for trying Turbo, rather than the stable 10.3.0 release.

Other CircuitPython hardware families, including Espressif, STM32 and nRF52840 boards, require additional port-specific work before Turbo can be enabled for them. The current Turbo support therefore remains focused on the supported RP2040 and RP2350 platforms.

The India angle is mainly about extending the useful life of hardware already used for embedded development and education. Developers and laboratories with RP2040 or RP2350 boards can use Turbo to accelerate selected computational workloads through a firmware update and desktop compilation workflow, without replacing the microcontroller board. This can be useful where the existing hardware is adequate for the application but Python execution speed is limiting performance.

There is, however, a toolchain requirement. Developers need an mpy-cross version compatible with the CircuitPython firmware running on the board. Adafruit recommends using an mpy-cross version that matches the CircuitPython version when creating .mpy files. Turbo also requires the compiled native module to target the appropriate processor architecture. A module compiled for an incompatible firmware version or architecture will not work correctly.

For Indian developers, this makes Turbo more of a software upgrade than a hardware upgrade. A Pico-class board already deployed in a project can potentially handle more computation without changing the board, although the benefit depends on whether the application’s bottleneck is actually Python computation rather than I/O or hardware communication.

For more information, click here

Loading form…
Ananthu Ashok
Ananthu Ashok
Ananthu Ashok is a tech journalist and has a deep interest in embedded systems, open source, IoT, robotics and emerging tech.

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics