Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Docker base SDK for Raspberry Pi Pico

License

NotificationsYou must be signed in to change notification settings

lukstep/raspberry-pi-pico-docker-sdk

Repository files navigation

Raspberry PI Pico Docker SDK CI

Raspberry Pi Pico Docker SDK

A SDK environment for Raspberry Pi Pico 1 and 2 in a Docker container.

Pulling the Image from Docker Hub and Running

The latest image is available onDocker Huband can be used to run a container.The following commands show how to run the container using the Docker Hub image:

docker run -d -it --name pico-sdk --mount type=bind,source=${PWD},target=/home/dev lukstep/raspberry-pi-pico-sdk:latestdockerexec -it pico-sdk /bin/sh

The directory from which thedocker run command was executed will be mounted in the container at/home/dev.After attaching to the SDK container, you can build your project by executing the following steps:

cd /home/devmkdir buildcd buildcmake ..&& make -j4

Building the Image and Running the Container

To build your own SDK image, clone this repository and run the following commands:

cd raspberry-pi-pico-docker-sdkdocker build. --tag pico-sdkdocker run -d -it --name pico-sdk --mount type=bind,source=${PWD},target=/home/dev pico-sdkdockerexec -it pico-sdk /bin/sh

Visual Studio Code as IDE for Raspberry Pi Pico Projects

You can use the SDK container with Visual Studio Code to create an IDE for Raspberry Pi Pico projects.There are two solutions prepared: a new one using the Visual Studio Dev Containers extension and an old one with manual configuration.

Prerequisites

To use the dev container, you need to have VSCode, Docker, and the VSCode extensions installed.Followthis guide for setup.

Using the Dev Container for Pico IDE

  • Clonepico-template-project repository.
  • Openpico-template-project folder in Visual Studio Code.
  • In VSCode, click the button in the bottom left corner of VSCode and select: Reopen in Container...image-1
  • Build the project.
  • Enjoy coding you Pico project with Intellisense.image-1

Pico Memory Flashing and Debugging via Pico Probe and OpenOCD

Warning

OpenOCD not support RP2350 (Pico 2). Currently this part is only valid for RP2040 boards (Pico 1).

To work efficiently on the project, we need the ability to upload firmware to the microcontroller, debug, and communicate through the serial port. The Raspberry Pi Pico board itself allows for software uploads, but this process is not very convenient or efficient for larger projects. The Pico Probe extends the capabilities of the Raspberry Pi Pico board to include fast firmware uploads to the microcontroller's memory, debugging via Serial Wire Debug (SWD), and it also serves as a USB UART converter.

The Debug Probe is compatible with the CMSIS-DAP interface, allowing OpenOCD to be used as the debugger server. By using OpenOCD, it becomes possible to communicate between development containers and the Debug Probe via TCP. On Linux, the Docker container can communicate directly through COM ports. However, on Mac and Windows, this is not possible because Docker runs in a dedicated virtual machine that does not have access to COM ports. Therefore, a solution with the OpenOCD server on the host machine was chosen.

The diagram below shows the environment topology:

  1. Pico Probe is connected to the Raspberry Pi Pico board:

    • SWD (Serial Wire Debug) interface for debugging.
    • UART (Universal Asynchronous Receiver/Transmitter) interface for serial communication.
  2. The Pico Probe is connected to the PC via USB.

  3. OpenOCD (Open On-Chip Debugger) runs on the PC and communicates with the Pico Probe.

  4. The development container (devContainer) connects to OpenOCD via TCP.

image-1

Instal required tools

To install OpenOCD on Linux, run the following command in a terminal:

sudo apt install openocd

To install OpenOCD on macOS, run the following command:

brew install openocd

To install OpenOCD on Windows, follow these steps:

How to Use: Step-by-Step Instructions

  1. Connect the Pico Probe to the Pico Board via SWD (1) and connect the Pico board UART to the UART-USB converter on the Pico Probe (2).

image-1

  1. Connect the Pico Probe and Pico Board to your PC

  2. Start the OpenOCD

    On Linux and Mac, open a new terminal and run the following command:

    sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c'bindto 0.0.0.0' -c'adapter speed 5000' -c'init'

    On Windows, open PowerShell, navigate to the folder containing OpenOCD, and runopenocd.exe:

    cd .\Desktop\xpack-openocd-0.12.0-2\.\bin\openocd.exe -f interface\cmsis-dap.cfg -f target\rp2040.cfg -c'bindto 0.0.0.0' -c'adapter speed 5000' -c'init'
  3. Open the project in the Dev Container.

  4. Make a debug build. Go to the CMake extension tab (1), click "Select Variant" (2), and choose "Debug" build (3). Start the build (4). If the build completes successfully, you can proceed to flashing the memory and debugging.

image-1

  1. To start a debug session, first add a breakpoint in the main function. Next, go to the debugger extension tab (1), and click "Play" (2). The debug session starts by flashing the Pico's memory and restarting the microcontroller. After the reset, the flashed firmware starts and the program should stop at the breakpoint.

image-1

It is possible to flash the Pico's memory without starting a debugger session. To do that, run the preprogrammed tasks.

  • Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac) to open the Command Palette.
  • Type Run Task into the Command Palette and press Enter.
  • Select taskFlash.

Manual configuration of VSCode as Pico IDE (old)

Referhere for step-by-step instruction

References

Raspberry Pi Debug Probe

Raspberry Pi Pico C/C++ SDK

OpenOCD project page


[8]ページ先頭

©2009-2025 Movatter.jp