Post

Raspberry Pi Pico 2 - RISC-V cores

Raspberry Pi Pico 2 - RISC-V cores

Raspberry Pi just dropped the Pico 2, and it’s pretty cool - you can now run either ARM or RISC-V code on the same $4 board. The RP2350 chip has Luke Wren’s open-source Hazard3 RISC-V cores alongside the usual ARM Cortex-M33 cores. This means you can finally play around with RISC-V without breaking the bank.

What’s New in Pico 2

The Hardware

The RP2350 chip is basically the brain of this thing:

  • Dual 150MHz cores - Pick either ARM or RISC-V when you start your project
  • 520KB SRAM - Way more than the original Pico’s 264KB
  • 4MB Flash - Plenty of space for your code
  • 26 GPIO pins - Same pinout as Pico 1, so your breakout boards still work

Why RISC-V is Cool

The best part? The Hazard3 RISC-V cores are completely open source. You can actually download the processor design files and see exactly how it works. Luke Wren designed these cores in his spare time and they’re now in millions of production chips.

1
2
3
4
5
6
7
// Your first RISC-V program looks just like regular C
#include "pico/stdlib.h"

int main() {
    printf("Hello from RISC-V!\n");
    return 0;
}

Getting Started

What You Need

  • Pico 2 board
  • USB-C cable
  • Your computer

Install the Tools

1
2
3
4
5
6
# Get the SDK
git clone https://github.com/raspberrypi/pico-sdk.git
export PICO_SDK_PATH=$(pwd)/pico-sdk

# Install RISC-V compiler
sudo apt install gcc-riscv64-unknown-elf

Build and flash:

1
2
3
4
mkdir build && cd build
cmake ..
make -j4
# Copy main.uf2 to your Pico 2

ARM vs RISC-V - What’s the Difference?

For Your Code

Honestly, not much. Both compile from the same C code. The main differences you might notice:

RISC-V Assembly:

# RISC-V is pretty clean
li t0, 42          # Load immediate value
sw t0, 0(sp)       # Store to memory
call my_function   # Function call

ARM Assembly:

@ ARM is a bit more complex
ldr r0, =42        @ Load value 
str r0, [sp]       @ Store to memory  
bl my_function     @ Branch with link

Why This Matters

Open Source Hardware

The Hazard3 cores are completely open. That means:

  • No license fees for companies
  • Students can study real processor designs
  • Anyone can modify and improve them
  • It’s future-proof (no vendor lock-in)

Learning Opportunity

RISC-V is simpler than ARM, so it’s great for understanding how processors work:

1
2
3
4
5
6
// You can even use inline assembly if you want
int add_numbers(int a, int b) {
    int result;
    asm("add %0, %1, %2" : "=r"(result) : "r"(a), "r"(b));
    return result;
}
This post is licensed under CC BY 4.0 by the author.