Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added devcontainer setup and CI workflow for generating builds #116

Merged
merged 28 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ARG VARIANT="ubuntu-22.04"
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}

RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get -y install --no-install-recommends \
gcc-arm-none-eabi \
libstdc++-arm-none-eabi-newlib \
cmake \
build-essential \
wget \
ca-certificates \
gdb-multiarch \
binutils-multiarch \
automake \
autoconf \
libtool \
libftdi-dev \
libusb-1.0-0-dev \
libhidapi-dev \
pkg-config \
clang-format \
python3 \
python3-tk

WORKDIR /apps

RUN cd /apps && \
git clone -b master https://github.com/raspberrypi/pico-sdk.git --depth=1 && \
cd pico-sdk && \
git submodule update --init

ENV PICO_SDK_PATH=/apps/pico-sdk

RUN cd /apps && \
git clone -b master https://github.com/raspberrypi/pico-extras.git --depth=1 \
&& cd pico-extras && \
git submodule update --init

ENV PICO_EXTRAS_PATH=/apps/pico-extras

RUN git clone https://github.com/raspberrypi/openocd.git --depth=1 && \
cd openocd && ./bootstrap && ./configure --enable-ftdi --enable-sysfsgpio --enable-picoprobe && make -j 8 install
RUN cd /apps && git clone https://github.com/raspberrypi/picotool.git --depth=1 && \
cd picotool && mkdir build && cd build && cmake ../ && make -j 8 && cp picotool /usr/local/bin
RUN cd /apps && git clone https://github.com/wtarreau/bootterm.git --depth=1 && \
cd bootterm && make -j 8 install

RUN cd /usr/bin && ln -s /usr/bin/objdump objdump-multiarch && ln -s /usr/bin/nm nm-multiarch

RUN usermod -aG plugdev vscode
51 changes: 51 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/mwinters-stuff/vscode-devcontainer-raspberrypi-pico
{
"name": "C++ Raspberry Pi Pico",
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined",
"--privileged",
"-v", "/dev/bus/usb:/dev/bus/usb",
"--device=/dev/bus/usb",
"--device=/dev/ttyACM0"
],

// Set *default* container specific settings.json values on container create.
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/usr/bin/bash"
}
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools",
"marus25.cortex-debug",
"ms-vscode.cmake-tools",
"twxs.cmake",
"eamodio.gitlens",
"xaver.clang-format",
"chris-hock.pioasm",
"ms-vscode.cpptools-extension-pack"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "gcc -v",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
75 changes: 75 additions & 0 deletions .github/workflows/10-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main

env:
# Customize the CMake build
BUILD_TYPE: RelWithDebInfo # Release, Debug, RelWithDebInfo

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clean workspace
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}"
mkdir -p "${{ github.workspace }}"

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout PicoBoot code
uses: actions/checkout@v4

- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- uses: robinraju/release-downloader@v1
id: gekkoboot-download
with:
repository: 'webhdx/iplboot'
latest: true
fileName: '*.zip'
out-file-path: gekkoboot
extract: true

- name: Copy gekkoboot uf2 payload
run: |
cd gekkoboot
if [ -f "gekkoboot_pico.uf2" ]; then
cp gekkoboot_pico.uf2 ${{ github.workspace }}/payload.uf2
elif [ -f "iplboot_pico.uf2" ]; then
cp iplboot_pico.uf2 ${{ github.workspace }}/payload.uf2
else
echo "Neither gekkoboot_pico.uf2 nor iplboot_pico.uf2 found."
exit 1
fi

- name: Build and run Dev Container task
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/webhdx/picoboot
cacheFrom: ghcr.io/webhdx/picoboot
runCmd: |
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .
make

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: picoboot-${{ steps.vars.outputs.sha_short }}
path: |
picoboot_full.uf2
picoboot.uf2
payload.uf2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ _deps
.DS_Store

# Build environment
build/
CMakeFiles/
elf2uf2/
generated/
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ function(merge_uf2 NAME BASE_TARGET INPUTS)
COMMAND_EXPAND_LISTS)
endfunction()

merge_uf2(picoboot_full picoboot "${CMAKE_CURRENT_LIST_DIR}/iplboot_pico.uf2")
merge_uf2(picoboot_full picoboot "${CMAKE_CURRENT_LIST_DIR}/payload.uf2")