Skip to main content

picokit

picokit 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 picokit.toml.

Install

pip install picokit

For local development from this repository:

pip install -e .

Commands

picokit doctor
picokit install
picokit new blink
picokit new hello-world
cd blink
picokit build
picokit clean
picokit flash

The CLI can also be invoked through the Python interpreter, including on Windows:

python -m picokit --help
python -m picokit --version

picokit 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 ~/.picokit. Set PICOKIT_HOME to use a different directory.

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

The installed tree layout:

~/.picokit/toolchains/pico-sdk-2.0.0/
  pico-sdk/
~/.picokit/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.

Custom Toolchain Locations

By default, picokit uses the toolchains installed in ~/.picokit/toolchains. You can override these locations using environment variables:

  • PICO_SDK_PATH: Path to a custom Pico SDK installation
  • PICO_TOOLCHAIN_PATH: Path to a custom ARM GCC toolchain installation

When these variables are set, picokit build will automatically:

  1. Use the custom toolchain/SDK paths
  2. Add the toolchain's bin directory to PATH
  3. Configure CMake with the correct paths

Example (Windows PowerShell):

$env:PICO_TOOLCHAIN_PATH = "$env:USERPROFILE\.picokit\toolchains\arm-gcc-13.2.Rel1-windows-x64"
$env:PICO_SDK_PATH = "$env:USERPROFILE\.picokit\toolchains\pico-sdk-2.0.0"
python -m picokit build

Example (Linux/macOS):

export PICO_TOOLCHAIN_PATH="$HOME/.picokit/toolchains/arm-gcc-13.2.Rel1-linux-x64"
export PICO_SDK_PATH="$HOME/.picokit/toolchains/pico-sdk-2.0.0"
picokit build

This is useful when:

  • Using a different version of the toolchain or SDK
  • Testing with a development version of the Pico SDK
  • Sharing a toolchain across multiple projects
  • Using system-installed toolchains

Project Format

picokit new blink creates a Pico project:

blink/
  picokit.toml
  CMakeLists.txt
  pico_sdk_import.cmake
  main.c
  .gitignore

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

picokit new my-project --board pico_w

Peripherals

Scaffold a project with extra hardware libraries, includes, and init stubs already wired in:

picokit peripherals              # list available keys
picokit new my-project --peripherals i2c,adc,pio

Or launch an interactive wizard to pick the board and peripherals (requires the optional questionary dependency):

pip install picokit[wizard]
picokit new my-project --interactive

Default picokit.toml:

[pico]
board = "pico"

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

Build Flow

picokit 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
picokit build

Output will be in build/blink.uf2.

To remove all generated build files and start from a clean configuration:

picokit clean

The command only removes the build_dir configured in picokit.toml and refuses to delete the project root or a directory outside the project.

Flashing

picokit 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 picokit 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.

picokit flash

To list the debug probes detected by pyOCD:

picokit flash --detect

Supported Boards

  • pico - Raspberry Pi Pico (RP2040)
  • pico_w - Raspberry Pi Pico W (RP2040 with WiFi)
  • pico2 - Raspberry Pi Pico 2 (RP2350)
  • pulsar_rp - UNIT Pulsar RP (RP2350; uses the Pico 2 SDK definition)
  • dualmcu_rp - UNIT DualMCU RP (RP2040; uses the Pico SDK definition)

For example:

picokit new pulsar-project --board pulsar_rp
picokit new dualmcu-project --board dualmcu_rp

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:

    picokit install
    
  2. Create a project:

    picokit new my-project
    cd my-project
    
  3. Edit main.c with your code

  4. Build:

    picokit build
    
  5. Clean generated build files when needed:

    picokit clean
    
  6. Flash to Pico over SWD:

    picokit flash
    
  7. Your code runs immediately after flashing!

Requirements

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

See the CMake installation guide for detailed Windows, Ubuntu/Debian, and macOS instructions, including PATH troubleshooting.

On Ubuntu/Debian:

sudo apt install cmake git

On macOS:

brew install cmake git

On Windows:

winget install --exact --id Kitware.CMake --source winget

Alternatively, download the installer from https://cmake.org/download/ and make sure its option to add CMake to PATH is selected.

If pip warns that picokit.exe was installed in a directory that is not on PATH, the module form remains available without changing PATH:

python -m picokit doctor
python -m picokit install

To use the shorter picokit command, print the Scripts directory with the following command and add that directory to your user PATH:

python -c "import sysconfig; print(sysconfig.get_path('scripts'))"

Support

For documentation, bug reports, and feature requests, visit the obviousfancy/picosdk repository. Report problems through GitHub Issues.

picokit is a fork of picodev, published independently under a new name. See LICENSE and CHANGELOG.md for attribution.

License

MIT

Download files

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

Source Distribution

picokit-0.2.0.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

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

picokit-0.2.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file picokit-0.2.0.tar.gz.

File metadata

  • Download URL: picokit-0.2.0.tar.gz
  • Upload date:
  • Size: 33.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for picokit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fcca042dd88fe5a6dc580da332bff3714813e5c378464efcddeed5e0b9026fb7
MD5 a728a8753f0c91a2a12ac7be9f7482ae
BLAKE2b-256 97c9b0c22c2ace517d0fa8ed092206716601e9da450cafc301cd1b3632b19af7

See more details on using hashes here.

File details

Details for the file picokit-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: picokit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for picokit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f105aa84c4e741b2d61fe818d5547e38f51d4a18dc6efc6f42f65c6635631f8
MD5 f5c370890009bf1ecb00777350a98d51
BLAKE2b-256 93f94d35b8320036305cbb758e3c2688f086aca729f97b3c3152b3eccf4caae4

See more details on using hashes here.

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