diff --git a/README.md b/README.md index 9c3b8e1..f7c2636 100644 --- a/README.md +++ b/README.md @@ -96,12 +96,12 @@ The following hardware parts and sensors are used throughout the course experime # Development Environment Setup -Everything installs natively on Windows, macOS (Apple Silicon), and Linux x64 — **no VM required**. The core toolchain (Pico SDK, Arm GNU Toolchain, `picotool`, OpenOCD) comes from the **Raspberry Pi Pico VS Code extension**, which installs it all under `~/.pico-sdk` on every platform. You then add two reverse-engineering tools and a serial monitor. +Everything installs natively on Windows, macOS (Apple Silicon), and Linux x64 — **no VM required**. The core toolchain (Pico SDK, the full Arm GNU Toolchain — `arm-none-eabi-gcc`, `arm-none-eabi-gdb`, `arm-none-eabi-nm`, `objdump` — `picotool`, and OpenOCD) comes from the **Raspberry Pi Pico VS Code extension**, which installs it all under `~/.pico-sdk` on every platform. You then add two reverse-engineering tools and a serial monitor. `arm-none-eabi-gdb` is what the GDB and Binary Ninja (GDB MI) debugging labs use. ## Windows x64 1. Install [VS Code](https://code.visualstudio.com/), [Git for Windows](https://git-scm.com/download/win), and [Python 3](https://www.python.org/downloads/) (check **Add python.exe to PATH**). -2. In VS Code open **Extensions**, search **Raspberry Pi Pico**, install it, and choose **Pico 2** as the board when prompted. This pulls the Pico SDK, Arm GNU Toolchain, `picotool`, and OpenOCD. +2. In VS Code open **Extensions**, search **Raspberry Pi Pico**, install it, and choose **Pico 2** as the board when prompted. This pulls the Pico SDK, Arm GNU Toolchain (includes `arm-none-eabi-gdb`), `picotool`, and OpenOCD. 3. Install [Binary Ninja Personal](https://binary.ninja/) and activate the license. 4. Install [Ghidra](https://github.com/NationalSecurityAgency/ghidra/releases) and [Eclipse Temurin JDK 21](https://adoptium.net/temurin/releases/?version=21). 5. Serial monitor: [PuTTY](https://www.putty.org/). @@ -112,7 +112,7 @@ Everything installs natively on Windows, macOS (Apple Silicon), and Linux x64 brew install cmake ninja ``` -1. Install [VS Code](https://code.visualstudio.com/), then the **Raspberry Pi Pico** extension (choose **Pico 2**). This installs the Pico SDK, Arm GNU Toolchain, `picotool`, and OpenOCD. +1. Install [VS Code](https://code.visualstudio.com/), then the **Raspberry Pi Pico** extension (choose **Pico 2**). This installs the Pico SDK, Arm GNU Toolchain (includes `arm-none-eabi-gdb`), `picotool`, and OpenOCD. 2. Install [Binary Ninja Personal](https://binary.ninja/) and activate the license. 3. Install Ghidra and JDK 21: `brew install --cask temurin@21`, then the [Ghidra release](https://github.com/NationalSecurityAgency/ghidra/releases). 4. Serial monitor: `screen` (built in). @@ -126,42 +126,55 @@ sudo apt update sudo apt install git python3 cmake ninja-build build-essential screen ``` -1. Install [VS Code](https://code.visualstudio.com/), then the **Raspberry Pi Pico** extension (choose **Pico 2**). This installs the Pico SDK, Arm GNU Toolchain, `picotool`, and OpenOCD. +1. Install [VS Code](https://code.visualstudio.com/), then the **Raspberry Pi Pico** extension (choose **Pico 2**). This installs the Pico SDK, Arm GNU Toolchain (includes `arm-none-eabi-gdb`), `picotool`, and OpenOCD. 2. Install [Binary Ninja Personal](https://binary.ninja/) and activate the license. 3. Install Ghidra and JDK 21 (`sudo apt install openjdk-21-jdk`, then the [Ghidra release](https://github.com/NationalSecurityAgency/ghidra/releases)). 4. Serial monitor: `screen` or `minicom`. ## Example: Compile and Flash `0x0001 hello, world` -Build the firmware: +The **build** step is identical on all three platforms — CMake and Ninja are cross-platform, and the Pico extension's `~/.pico-sdk/cmake/pico-vscode.cmake` supplies the SDK, toolchain, and `picotool` paths on every OS. Only the **flash** and **serial** steps differ, so each platform is shown in full below. All three flash over the Debug Probe with SWD (`program 0x10000000 verify reset exit`) — no BOOTSEL, no UF2. + +### Windows x64 + +```powershell +cd 0x0001_hello-world +cmake -B build -G Ninja -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350 -DCMAKE_BUILD_TYPE=Release +cmake --build build +..\flash.ps1 build\0x0001_hello-world.bin +``` +Serial monitor: **PuTTY** -> *Serial* -> the Debug Probe's COM port -> **115200**. + +### macOS Apple Silicon ```bash cd 0x0001_hello-world cmake -B build -G Ninja -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350 -DCMAKE_BUILD_TYPE=Release cmake --build build -``` - -Flash the raw `.bin` over the Debug Probe with OpenOCD — no BOOTSEL, no UF2: - -```bash -# macOS / Linux ../flash.sh build/0x0001_hello-world.bin +screen /dev/cu.usbmodem* 115200 ``` -```powershell -# Windows -..\flash.ps1 build\0x0001_hello-world.bin -``` - -Then open the serial monitor at **115200** on the Debug Probe's UART bridge and you should see `hello, world` repeat: +### Linux x64 ```bash -# macOS -screen /dev/cu.usbmodem* 115200 -# Linux +cd 0x0001_hello-world +cmake -B build -G Ninja -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350 -DCMAKE_BUILD_TYPE=Release +cmake --build build +../flash.sh build/0x0001_hello-world.bin screen /dev/ttyACM0 115200 ``` +You should see `hello, world` repeat at 115200. + +> **If CMake cannot find the SDK or toolchain** (for example you installed the toolchain yourself instead of via the VS Code extension), pass them explicitly: +> ```bash +> cmake -B build -G Ninja -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350 -DCMAKE_BUILD_TYPE=Release \ +> -DPICO_SDK_PATH="$HOME/.pico-sdk/sdk/2.2.0" \ +> -DPICO_TOOLCHAIN_PATH="$HOME/.pico-sdk/toolchain/14_2_Rel1" +> ``` +> On Windows use forward slashes, e.g. `C:/Users//.pico-sdk/sdk/2.2.0`. + Debug Probe wiring is [HERE](https://github.com/mytechnotalent/Embedded-Hacking/blob/main/hardware/dp.png).