Port of Dmitry Grinberg's Linux Card uMIPS emulator to the Raspberry Pi Pico.
This is a port of Dmitry Grinberg's uMIPS emulator for his Linux Card on RP2040 (Raspberry Pi Pico).
This code boots Linux 4.4.292+ Kernel on RP2040.
The idea is simple: The RP2040 runs Dmitry Grinberg's uMIPS emulator, which uses 2 to 4 PSRAM64H (or any PSRAM chip) as RAM and a file on a SD card's FAT32/exFAT partition as its main storage.
The code is written in C using Pico-SDK.
The code does the following (in order):
- Over volt the RP2040 core slightly
- Over clock the RP2040 to 400MHz
- Initlise the UART interface
- Initlise the console (UART and emulator glue) API
- Initlise and reset PSRAM
- Switch threads and Hand over control to RP2040 SoC uMIPS implementation
- Initlise MMIO
- Initlise and mount SD card
- Open disk image
- Start uMIPS CPU
The boot process of Linux goes as follows:
- uMIPS CPU starts
- Hardcoded ROM Jumps into Disk Image's BROM (BootROM)
- BROM copies Kernel into RAM
- BROM clears BSS
- BROM jumps into kernel location
- Linux Kernel starts executing.
S.no | Part | No. needed |
---|---|---|
1 | Raspberry Pi Pico | 1 |
2 | Micro SD card (>=8GB) | 1 |
3 | Adafruit Micro SD card Reader(Breadboard) | 1 |
4 | PSRAM64H | 2 |
5 | Wires | As many as Required :) |
6 | Breadboard/PCB | 1 |
7 | SOP8 to DIP8 PCB (Breadboard) | 2 |
8 | Micro SD Card Slot (PCB) | 1 |
Warning
Due to the PSRAM64H chips being too small to directly use on a breadboard, it is recomended to use a SOP8 to DIP8. IF you are using the custom PCB made for this project, then the SOP8 to DIP8 is not required.
Breadboard:
- Solder the PSRAM chips to the SOP8 to DIP8 PCBs
- Solder male headers to the SOP8 to DIP8 PCBs
- Place the Raspberry Pi Pico, PSRAM chips and Micro SD card Reader Mobule on the breadboard
- Connect The modules according the below table:
Pico GPIO | Module | Pin |
---|---|---|
GPIO 18 | SD Card | CLK/SCK |
GPIO 16 | SD Card | MISO |
GPIO 19 | SD Card | MOSI |
GPIO 20 | SD Card | CS/SS |
VSYS | SD Card | VCC |
GND | SD Card | GND |
GPIO10 | PSRAM 1 | CLK/SCK/SCLK |
GPIO12 | PSRAM 1 | MISO/SO/SIO[1] |
GPIO11 | PSRAM 1 | MOSI/SI/SIO[0] |
GPIO21 | PSRAM 1 | CS#/CS/SS |
3v3 (OUT) | PSRAM 1 | VCC |
GND | PSRAM 1 | VSS |
GPIO10 | PSRAM 2 | CLK/SCK/SCLK |
GPIO12 | PSRAM 2 | MISO/SO/SIO[1] |
GPIO11 | PSRAM 2 | MOSI/SI/SIO[0] |
GPIO22 | PSRAM 2 | CS#/CS/SS |
3v3 (OUT) | PSRAM 2 | VCC |
GND | PSRAM 2 | VSS |
- Now the Circuit is ready to be flashed and run Linux!
PCB:
- Solder the Raspberry Pi Pico to the PCB according to the footprint
- Solder the Micro SD Card Slot according to the footprint
- Solder the PSRAM Chips according to the footprint
- Solder Male headers as shown on silkscreen if required (For debugging)
- Now the Circuit is ready to be flashed and run linux!
- Setup the Pico SDK
- Clone the repo.
- cd into the folder in a terminal
- Run
mkdir build
- Then
cmake ..
for a release build orcmake -DCMAKE_BUILD_TYPE=Debug ..
for a debug build - Run
make
- The output will be in build/uMIPS/ folder
- Disconnect the Raspberry Pi Pico from the computer
- While pressing the
BOOTSEL
button on the pico, connect the pico the the computer - Copy the file
build/uMIPS/pico-uMIPS.uf2
into the newly appeared flash driveRPI-RP2
TODO