Skip to main content

Raspberry Pi Pico development helper for installing Pico SDK and ARM GCC toolchain.

Project description

picodev

picodev is a Python CLI package for Raspberry Pi Pico development. It installs the Pico SDK and ARM GCC toolchain for the current operating system, creates Pico C/C++ projects, and runs build/flash commands from picodev.toml.

Install

pip install picodev

For local development from this repository:

pip install -e .

Commands

picodev doctor
picodev install
picodev new blink
picodev new hello-world
cd blink
picodev build
picodev flash

picodev install downloads the Pico SDK and ARM GCC toolchain. The installer selects the correct toolchain for:

  • Linux x64
  • Linux arm64
  • macOS x64
  • macOS arm64
  • Windows x64

The default install location is ~/.devlab. Set DEVLAB_HOME to use a different directory.

picodev build and picodev flash automatically run with the installed Pico SDK and ARM GCC toolchain environment. You do not need to manually configure paths. picodev doctor checks the tools required by the current platform.

The installed tree layout:

~/.devlab/toolchains/pico-sdk-2.0.0/
  pico-sdk/
~/.devlab/toolchains/arm-none-eabi-gcc-13.2.1/
  bin/
  arm-none-eabi/

Pico SDK and Toolchain Sources

Pico SDK: https://github.com/raspberrypi/pico-sdk

ARM GCC: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads

Downloaded archives are verified with SHA-256 digests.

Project Format

picodev new blink creates a Pico project:

blink/
  picodev.toml
  CMakeLists.txt
  src/main.c
  .gitignore

Use --board pico_w to create a Pico W project:

picodev new my-project --board pico_w

Default picodev.toml:

[pico]
board = "pico"

[build]
name = "blink"
build_dir = "build"
sources = ["src/main.c"]

Build Flow

picodev build uses CMake to compile your Pico project:

  1. Configures CMake with Pico SDK path
  2. Builds the project with ARM GCC toolchain
  3. Generates .uf2 file for flashing

Example:

cd blink
picodev build

Output will be in build/blink.uf2.

Flashing

picodev flash programs the ELF firmware over SWD using pyOCD:

  1. Connect a CMSIS-DAP compatible debug probe to the Pico SWD pins
  2. Connect the probe over USB
  3. Run picodev flash

The command selects rp2040 for Pico/Pico W and rp2350 for Pico 2, then programs build/<project>.elf. Use --probe <ID> when multiple probes are connected.

picodev flash

To list the debug probes detected by pyOCD:

picodev flash --detect

Supported Boards

  • pico - Raspberry Pi Pico (RP2040)
  • pico_w - Raspberry Pi Pico W (RP2040 with WiFi)
  • pico2 - Raspberry Pi Pico 2 (RP2350)

Example Project

Default blink project (main.c):

#include <stdio.h>
#include "pico/stdlib.h"

int main() {
    stdio_init_all();
    
    const uint LED_PIN = 25;
    gpio_init(LED_PIN);
    gpio_set_dir(LED_PIN, GPIO_OUT);

    while (true) {
        gpio_put(LED_PIN, 1);
        sleep_ms(500);
        gpio_put(LED_PIN, 0);
        sleep_ms(500);
    }
}

For Pico W, the LED control uses the CYW43 wireless chip:

#include <stdio.h>
#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"

int main() {
    stdio_init_all();
    
    if (cyw43_arch_init()) {
        printf("Wi-Fi init failed\n");
        return -1;
    }

    while (true) {
        cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
        sleep_ms(500);
        cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
        sleep_ms(500);
    }
}

Development Workflow

  1. Install toolchains:

    picodev install
    
  2. Create a project:

    picodev new my-project
    cd my-project
    
  3. Edit src/main.c with your code

  4. Build:

    picodev build
    
  5. Flash to Pico over SWD:

    picodev flash
    
  6. Your code runs immediately after flashing!

Requirements

  • Python 3.9+
  • CMake (install separately)
  • Ninja on Windows (installed by picodev install)
  • picotool on Windows (installed by picodev install)
  • Git (optional, for submodule initialization)

On Ubuntu/Debian:

sudo apt install cmake git

On macOS:

brew install cmake git

On Windows: Download CMake from https://cmake.org/download/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

picodev-0.1.5.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

picodev-0.1.5-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file picodev-0.1.5.tar.gz.

File metadata

  • Download URL: picodev-0.1.5.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for picodev-0.1.5.tar.gz
Algorithm Hash digest
SHA256 623c6cc97ee7553cb07650f9dac22e0f079c9f0603fb44e562865e541d0f1ff5
MD5 8c367197c52e9a7aa794e31b0d521ee1
BLAKE2b-256 4f770d6f433373e6b55cb9279911ed64010f16613097031c5c88a9da4052add8

See more details on using hashes here.

Provenance

The following attestation bundles were made for picodev-0.1.5.tar.gz:

Publisher: workflow.yml on UNIT-Electronics-Labs/unit_devlab_pico

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file picodev-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: picodev-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for picodev-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ef188809c105500e646db99340c618b1d040f08a29e0d9102b04fc91cc0a6701
MD5 f67cae5fa2727cab16e18b9349a2cc93
BLAKE2b-256 3e79ee39f39b88a3306596d3d58cd0eb07316966cffc7f86e9cdee93594af4c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for picodev-0.1.5-py3-none-any.whl:

Publisher: workflow.yml on UNIT-Electronics-Labs/unit_devlab_pico

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page