4 Commits

Author SHA1 Message Date
lukstep
0d802ea304 Debugging POC 2023-10-05 22:15:32 +02:00
lukstep
3d8b06e9b7 Specify the C and C++ compiler path 2023-07-23 12:57:49 +02:00
Łukasz
ee42c6f1df Update CI status badge 2023-06-25 15:47:23 +02:00
lukstep
ecea0809ad Add Github CI configuration 2023-06-25 15:42:16 +02:00
10 changed files with 139 additions and 9 deletions

47
.github/workflows/sdk-ci.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: Raspberry PI Pico Docker SDK CI
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [published]
env:
TEST_TAG: pico_test_sdk
jobs:
sdk_container:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build SDK
uses: docker/build-push-action@v4
with:
context: .
load: true
tags: ${{ env.TEST_TAG }}
- name: Test SDK
run: bash ./test_sdk.sh ${{ env.TEST_TAG }}
- name: Log into Docker Hub
uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract SDK metadata
id: meta
uses: docker/metadata-action@v4
with:
images: lukstep/raspberry-pi-pico-sdk
- name: Push SDK image
if: github.event_name == 'release' && github.event.action == 'published'
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -11,7 +11,8 @@ RUN apk update && \
libusb-dev \
bsd-compat-headers \
newlib-arm-none-eabi \
gcc-arm-none-eabi
gcc-arm-none-eabi \
gdb-multiarch
# Raspberry Pi Pico SDK
ARG SDK_PATH=/usr/share/pico_sdk

View File

@@ -1,3 +1,5 @@
[![Raspberry PI Pico Docker SDK CI](https://github.com/lukstep/raspberry-pi-pico-docker-sdk/actions/workflows/sdk-ci.yml/badge.svg)](https://github.com/lukstep/raspberry-pi-pico-docker-sdk/actions/workflows/sdk-ci.yml)
# Raspberry Pi Pico Docker SDK
Lightweight Raspberry Pi Pico C++ SDK container.

20
sdk_session.sh Normal file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
docker run --rm -d -it --name pico-sdk --network=host --mount type=bind,source=${PWD},target=/home/dev pico-sdk-debug
session="Pico-sdk"
tmux new-session -d -s $session
window=0
tmux rename-window -t $session:$window 'Docker'
tmux send-keys -t $session:$window 'docker exec -it pico-sdk ./bin/sh' C-m
window=1
tmux new-window -t $session:$window -n 'OpenOCD'
tmux send-keys -t $session:$window 'sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "bindto 0.0.0.0"' C-m
window=2
tmux new-window -t $session:$window -n 'UART'
tmux attach-session -t $session

8
test_poject/.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"recommendations": ["llvm-vs-code-extensions.vscode-clangd",
"marus25.cortex-debug",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack"
]
}

25
test_poject/.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Pico debug",
"cwd": "${workspaceFolder}",
"gdbPath": "/usr/bin/gdb-multiarch",
"executable": "/home/dev/build/sample.elf",
"request": "launch",
"type": "cortex-debug",
"runToEntryPoint": "main",
"servertype": "external",
"gdbTarget": "host.docker.internal:3333",
"overrideLaunchCommands": [
"monitor adapter speed 5000",
"monitor reset init",
"load ${command:cmake.launchTargetPath}"
],
}
]
}

13
test_poject/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"C_Cpp.intelliSenseEngine": "disabled",
"clangd.path": "/usr/bin/clangd",
"clangd.checkUpdates": false,
"clangd.restartAfterCrash": true,
"clangd.detectExtensionConflicts": true,
"clangd.arguments": ["-log=verbose",
"-pretty",
"--background-index",
"--query-driver=/usr/bin/arm-none-eabi-gcc",
"--compile-commands-dir=/home/dev/build"],
"cmake.sourceDirectory": "/home/dev"
}

View File

@@ -4,15 +4,26 @@ include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(sample C CXX ASM)
set(CMAKE_C_COMPILER /usr/bin/arm-none-eabi-gcc CACHE PATH "" FORCE)
set(CMAKE_CXX_COMPILER /usr/bin/arm-none-eabi-g++ CACHE PATH "" FORCE)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(-Wall -g -O1)
pico_sdk_init()
add_executable(sample main.c)
pico_enable_stdio_usb(sample 1)
pico_enable_stdio_usb(sample 0)
pico_enable_stdio_uart(sample 1)
pico_add_extra_outputs(sample)
target_link_libraries(sample pico_stdlib)
target_link_libraries(sample
pico_stdlib
hardware_pio
hardware_timer
hardware_clocks
hardware_pwm
)

View File

@@ -3,12 +3,11 @@
#include "hardware/gpio.h"
#include "pico/binary_info.h"
const int LED_PIN = 25;
const int LED_PIN = 0;
int main ()
{
bi_decl(bi_program_description("Sample binary"));
bi_decl(bi_1pin_with_name(LED_PIN, "on-board PIN"));
int test = 0;
stdio_init_all();
@@ -20,8 +19,9 @@ int main ()
gpio_put(LED_PIN, 0);
sleep_ms(250);
gpio_put(LED_PIN, 1);
puts("Hello Word\n");
printf("Hello Word %d\n", test);
sleep_ms(1000);
test++;
}
}

View File

@@ -1,5 +1,8 @@
docker build . --tag lukstep/raspberry-pi-pico-sdk:latest
docker run -d -it --name pico-sdk --mount type=bind,source=${PWD}/test_poject,target=/home/dev lukstep/raspberry-pi-pico-sdk:latest
if [[ -z $1 ]]; then
echo "Please provide an SDK image you want to test"
fi
docker run -d -it --name pico-sdk --mount type=bind,source=${PWD}/test_poject,target=/home/dev $1
docker exec pico-sdk /bin/sh -c "cd /home/dev && mkdir build && cd build && cmake .. && make -j4"
docker exec pico-sdk /bin/sh -c "picotool"
docker container kill pico-sdk