Repository navigation
uCompute — Custom MicroPython Firmware
By default, flashing the official, "vanilla" Raspberry Pi Pico firmware limits your available Flash storage space to 2 MB, even if your custom hardware board integrates a larger 4 MB, 8 MB, or 16 MB QFlash chip.
To unlock and map the full capacity of your custom uCompute or uCompute2 boards, you must compile a custom MicroPython firmware binarie by customizing the target board definition files.
MicroPython targets hardware profiles during compilation using specific board definitions (mpconfigboard.h and mpconfigboard.cmake). These definitions hardcode the flash size properties:
-
MICROPY_HW_FLASH_STORAGE_BYTES: Defines the virtual filesystem space boundaries allocated for user scripts. - If mismatched, the system will either truncate your storage capacity to 2 MB or fail to mount the flash memory safely.
Before compilation, you must set up the official MicroPython cross-compiler build stack on a Linux machine (or WSL):
-
Install Build Dependencies: Install CMake, build-essential tools, and the GNU Arm Embedded Toolchain (
gcc-arm-none-eabi). -
Clone the MicroPython Repository: Ensure you recursively pull all submodules:
git clone --recursive https://github.com cd micropython -
Compile the Cross-Compiler (
mpy-cross): This helper framework is mandatory for completing the final firmware building stages:make -C mpy-cross
To create your personalized profile (e.g., creating a UCOMPUTE target for a 4 MB flash configuration):
Move into the RP2 microcontroller target subdirectory:
cd ports/rp2Generate a new board profile folder inside the hardware definitions directory:
mkdir boards/UCOMPUTEPopulate your newly created boards/UCOMPUTE/ folder with three files:
Sets the system clock limits and adjusts the flash chip sizing configurations:
set(MICROPY_HW_BOARD_NAME "uCompute RP2040 Custom")
set(MICROPY_HW_MCU "RP2040")
# Adjust flash sizing boundaries (e.g., 4MB configuration setup)
set(MICROPY_HW_FLASH_STORAGE_BYTES (4 * 1024 * 1024)) Overrides internal C macro properties used by the kernel layer:
#define MICROPY_HW_BOARD_NAME "uCompute Custom"
#define MICROPY_HW_MCU "RP2040"
// Explicitly declare target QFlash hardware metrics
#define MICROPY_HW_FLASH_STORAGE_BYTES (4 * 1024 * 1024)Map your custom hardware layout references for peripheral identification.
Trigger the make builder architecture while passing your explicit custom profile label:
make BOARD=UCOMPUTEOnce compilation sequences complete successfully, your flashable, expanded firmware.uf2 file will be waiting inside the compiled build-UCOMPUTE/ directory.
- Press and hold the physical BOOT button on your custom board.
- Connect your computer interface to the board via a USB Type-C cable.
- Drag and drop your compiled
firmware.uf2directly into the virtual storage drive directory.
The system resets automatically, granting your custom environment immediate access to the full expanded storage capacity!
Compiling for the next-generation RP2350 (uCompute2) introduces a major structural change in the MicroPython repository layout. Starting with MicroPython v1.24+, the build system merges architecture profiles to accommodate both the ARM Cortex-M33 and the Hazard3 RISC-V cores.
Instead of operating inside ports/rp2, the target source folder has been renamed to unify the platform:
cd ports/rp2_picoYou must place your custom board definition directory inside ports/rp2_pico/boards/UCOMPUTE2/.
When compiling for the RP2350, you must explicitly pass the architecture sub-variant using CMake variables to target the correct compiler flags:
make BOARD=UCOMPUTE2 VARIANT=RP2350A major strength of the uCompute hardware DNA is its resilience and backward compatibility:
- It Will Boot: If you flash an official, "vanilla" Raspberry Pi Pico or Pico 2 firmware binary onto a custom uCompute board, the system will work perfectly fine. The microcontroller will boot, the GPIOs will map correctly, and you can run your MicroPython scripts immediately.
- The Sizing Penalty: The only drawback is that the official binaire enforces a strict 2 MB memory cap. Any extra flash capacity soldered onto your custom board (4 MB, 8 MB, or 16 MB) will remain invisible and unallocated until you flash a dedicated, custom-compiled firmware.
This customization technique removes absolute dependencies on pre-assembled modules and provides an advanced pedagogical exercise for computer engineering students:
- Teaches how memory maps (
Flash Storage Layouts) partition firmware binaries from file storage environments. - Introduces standard hardware abstraction layering principles used throughout embedded system software stacks.