|
| 1 | +# Setting Up the Pico SDK on Linux for PicoMite Development |
| 2 | + |
| 3 | +This guide walks you through setting up the Raspberry Pi Pico SDK on a Linux system for **PicoMite** development. By the end, you'll have a working environment to compile and flash firmware to your Raspberry Pi Pico. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | +Before getting started, make sure you have the following: |
| 7 | + |
| 8 | +- A Linux system (Ubuntu, Debian, etc.) |
| 9 | +- Raspberry Pi Pico or compatible board |
| 10 | +- USB cable for flashing firmware |
| 11 | +- Basic familiarity with the terminal |
| 12 | + |
| 13 | +## Step 1: Install Required Dependencies |
| 14 | +Open a terminal and install the necessary tools: |
| 15 | + |
| 16 | +```bash |
| 17 | +sudo apt update && sudo apt install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential git |
| 18 | +``` |
| 19 | + |
| 20 | +## Step 2: Clone the Pico SDK |
| 21 | +Navigate to a workspace directory and clone the official Raspberry Pi Pico SDK: |
| 22 | + |
| 23 | +```bash |
| 24 | +mkdir -p ~/pico && cd ~/pico |
| 25 | +git clone -b master https://github.com/raspberrypi/pico-sdk.git |
| 26 | +cd pico-sdk |
| 27 | +git submodule update --init |
| 28 | +``` |
| 29 | + |
| 30 | +## Step 3: Set Up Environment Variables |
| 31 | +To ensure the build system finds the SDK, set an environment variable: |
| 32 | + |
| 33 | +```bash |
| 34 | +echo 'export PICO_SDK_PATH=~/pico/pico-sdk' >> ~/.bashrc |
| 35 | +source ~/.bashrc |
| 36 | +``` |
| 37 | + |
| 38 | +For Zsh users: |
| 39 | + |
| 40 | +```bash |
| 41 | +echo 'export PICO_SDK_PATH=~/pico/pico-sdk' >> ~/.zshrc |
| 42 | +source ~/.zshrc |
| 43 | +``` |
| 44 | + |
| 45 | +## Step 4: Create a New Project |
| 46 | +Let's create a sample project using the Pico SDK: |
| 47 | + |
| 48 | +```bash |
| 49 | +cd ~/pico |
| 50 | +git clone https://github.com/raspberrypi/pico-examples.git |
| 51 | +mkdir -p pico-examples/build && cd pico-examples/build |
| 52 | +``` |
| 53 | + |
| 54 | +Now, configure the project with CMake: |
| 55 | + |
| 56 | +```bash |
| 57 | +cmake .. |
| 58 | +``` |
| 59 | + |
| 60 | +## Step 5: Compile the Code |
| 61 | +Compile a sample program (e.g., Blink): |
| 62 | + |
| 63 | +```bash |
| 64 | +make -j$(nproc) blink |
| 65 | +``` |
| 66 | + |
| 67 | +If successful, this will generate a `blink.uf2` file inside `build/blink/`. |
| 68 | + |
| 69 | +## Step 6: Flash the Firmware |
| 70 | +To flash the firmware to your Pico: |
| 71 | + |
| 72 | +1. Hold down the **BOOTSEL** button on the Pico. |
| 73 | +2. Plug it into your computer via USB. |
| 74 | +3. The Pico should appear as a mass storage device (`RPI-RP2`). |
| 75 | +4. Copy the `blink.uf2` file to the Pico: |
| 76 | + |
| 77 | + ```bash |
| 78 | + cp blink/blink.uf2 /media/$USER/RPI-RP2/ |
| 79 | + ``` |
| 80 | + |
| 81 | +The Pico will automatically reboot and start running the Blink program. |
| 82 | + |
| 83 | +## Step 7: Verify Everything Works |
| 84 | +To check if your Pico is working correctly, you can use `minicom` or `screen` to monitor serial output: |
| 85 | + |
| 86 | +```bash |
| 87 | +sudo apt install -y minicom |
| 88 | +minicom -b 115200 -o -D /dev/ttyACM0 |
| 89 | +``` |
| 90 | + |
| 91 | +Press **Ctrl+A, then Z**, and select **Quit** when finished. |
| 92 | + |
| 93 | +## Conclusion |
| 94 | +You now have the Raspberry Pi Pico SDK set up on Linux and successfully flashed firmware onto your Pico. You can start developing and customizing firmware for **PicoMite** projects! |
| 95 | + |
| 96 | +For more details, refer to the official [Pico SDK documentation](https://github.com/raspberrypi/pico-sdk). |
| 97 | + |
0 commit comments