Skip to content

Building MicroPython

Thomas Euler edited this page Feb 12, 2022 · 17 revisions

... for the Raspberry Pi Pico microcontroller

The following instructions briefly explain how to build the current MicroPython firmware for the rp2040 Pico board and include the ulab math/vector library and the libraries for the pico display pack module.

These instructions were compiled from here and here. They were tested using Ubuntu 20.4 installed in the Linux Subsystem of Windows 10.

  1. To keep different MicroPython ports separated, using a folder for each is recommended. Here, we install the tools in the folder pico.

    mkdir pico
    cd pico/
    
  2. Make sure your installation is up to date:

    sudo apt update
    sudo apt install cmake gcc-arm-none-eabi build-essential
    
  3. Clone and prepare the pico SDK:

    git clone -b master https://github.com/raspberrypi/pico-sdk.git
    export PICO_SDK_PATH=~/pico/pico-sdk
    cd pico-sdk
    git submodule update --init
    
  4. Clone and prepare MicroPython:

    cd ~/pico
    git clone https://github.com/micropython/micropython
    cd micropython
    git submodule update --init lib/tinyusb
    git submodule update --init lib/pico-sdk
    cd lib/pico-sdk
    git submodule update --init
    git submodule update --init lib/tinyusb
    cd ../../mpy-cross
    make -j 8
    
  5. Clone and prepare the Pimoroni repository:

    cd ~/pico
    git clone https://github.com/pimoroni/pimoroni-pico.git
    
  6. Clone the ulab repository into a subfolder of the Pimoroni folder :

    cd ~/pico/pimoroni-pico/micropython/modules/
    rm -r -f ulab
    git clone https://github.com/v923z/micropython-ulab ulab
    
  7. Build the firmware:

    cd ~/pico/micropython/ports/rp2
    make clean
    make -j 8 USER_C_MODULES=../../../pimoroni-pico/micropython/modules/micropython.cmake
    
  8. Deploy the firmware:

    Open a Windows explorer window:

    explorer.exe .
    

    The file firmware.uf2 in the folder build contains the firmware image.

    Disconnect the Pico board from the USB cable, press the button on the board and keep it pressed while plugging in the USB cable. After releasing the button, a drive RPI-RP2 pops up. Drag the file firmware.uf2 onto that drive. The board should restart and offer the MicroPython REPL.

Home

  1. Werkzeuge und Material (DE | EN)
  2. Aufbau
    2.1 Mechanik (DE | EN)
    2.2 Aufbau und Hinweise (DE | EN)
    2.3 Elektronik und Platine (DE | EN)
  3. Sensoren (DE | EN)
  4. Demo (DE | EN)
  5. Erweiterungen & Modifikationen
    5.1 Alternatives Display (DE | EN)
    5.2 CO2-Wächter (DE | EN)
  6. Galerie (DE | EN)
  7. Software - MMBasic
    7.1 MMBasic zum Laufen bringen (DE | EN)
    7.2 Kommentare zum Programm (DE | EN)
    7.3 Robotling API (DE | EN)
    7.4 Building PicoMite MMBasic (DE | EN)
  8. Software - MicroPython
    8.1 Running MicroPython (DE | EN)
    8.2 Building MicroPython (DE | EN)
Clone this wiki locally