CI: Refactor to match our other tooling.
Retarget pimoroni-pico to feature/picovector2-and-layers.
This commit is contained in:
parent
d4205caedc
commit
af670449c0
142
.github/workflows/micropython.yml
vendored
142
.github/workflows/micropython.yml
vendored
@ -6,46 +6,34 @@ on:
|
|||||||
release:
|
release:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
env:
|
|
||||||
MICROPYTHON_VERSION: feature/pico2_w_2025
|
|
||||||
MICROPYTHON_FLAVOUR: pimoroni
|
|
||||||
PIMORONI_PICO_VERSION: main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: ${{ matrix.name }} (${{ matrix.board }})
|
name: MicroPython ${{ matrix.name }}
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-24.04
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- name: pico2
|
- name: rpi_pico2
|
||||||
board: RPI_PICO2
|
- name: rpi_pico2_w
|
||||||
- name: pico2_w
|
- name: rpi_pico2b
|
||||||
board: RPI_PICO2_W
|
- name: pimoroni_plasma2350
|
||||||
- name: pico2b_rp2350
|
- name: pimoroni_tiny2350
|
||||||
board: RPI_PICO2B
|
- name: pimoroni_pico_plus2
|
||||||
- name: plasma2350
|
|
||||||
board: PIMORONI_PLASMA2350
|
|
||||||
- name: tiny2350
|
|
||||||
board: PIMORONI_TINY2350
|
|
||||||
- name: pico_plus2_rp2350
|
|
||||||
board: PIMORONI_PICO_PLUS2
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# MicroPython version will be contained in github.event.release.tag_name for releases
|
# MicroPython version will be contained in github.event.release.tag_name for releases
|
||||||
RELEASE_FILE: ${{ matrix.name }}-${{ github.event.release.tag_name || github.sha }}-pimoroni-micropython
|
RELEASE_FILE: ${{ matrix.name }}-${{ github.event.release.tag_name || github.sha }}-micropython
|
||||||
PIMORONI_PICO_DIR: "${{ github.workspace }}/pimoroni-pico"
|
CI_PROJECT_ROOT: ${{ github.workspace }}/src-${{ github.sha }}
|
||||||
MICROPY_BOARD_DIR: "${{ github.workspace }}/pimoroni-pico-rp2350-${{ github.sha }}/micropython/board/${{ matrix.BOARD }}"
|
CI_BUILD_ROOT: ${{ github.workspace }}
|
||||||
USER_C_MODULES: "${{ github.workspace }}/pimoroni-pico-rp2350-${{ github.sha }}/micropython/micropython-pico2.cmake"
|
CI_USE_ENV: 1
|
||||||
TAG_OR_SHA: ${{ github.event.release.tag_name || github.sha }}
|
|
||||||
MICROPY_BOARD: ${{ matrix.board }}
|
|
||||||
MICROPY_BOARD_VARIANT: ${{ matrix.variant }}
|
|
||||||
BOARD_NAME: ${{ matrix.name }}
|
|
||||||
BUILD_TOOLS: pimoroni-pico-rp2350-${{ github.sha }}/ci/micropython.sh
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Compiler Cache
|
- name: Compiler Cache Fixup
|
||||||
|
run: |
|
||||||
|
mkdir -p /home/runner/.ccache
|
||||||
|
|
||||||
|
- name: "CCache: Restore saved cache"
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: /home/runner/.ccache
|
path: /home/runner/.ccache
|
||||||
@ -54,76 +42,62 @@ jobs:
|
|||||||
ccache-micropython-${{ matrix.name }}-${{ github.ref }}
|
ccache-micropython-${{ matrix.name }}-${{ github.ref }}
|
||||||
ccache-micropython-${{ matrix.name }}-
|
ccache-micropython-${{ matrix.name }}-
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- name: "Checkout Project"
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
path: pimoroni-pico-rp2350-${{ github.sha }}
|
path: ${{ env.CI_PROJECT_ROOT }}
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- name: "Install Arm GNU Toolchain (arm-none-eabi-gcc)"
|
||||||
with:
|
|
||||||
repository: pimoroni/pimoroni-pico
|
|
||||||
ref: ${{env.PIMORONI_PICO_VERSION}}
|
|
||||||
submodules: true
|
|
||||||
path: pimoroni-pico
|
|
||||||
|
|
||||||
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
|
|
||||||
uses: carlosperate/arm-none-eabi-gcc-action@v1
|
uses: carlosperate/arm-none-eabi-gcc-action@v1
|
||||||
with:
|
with:
|
||||||
release: '13.3.Rel1'
|
release: '13.3.Rel1'
|
||||||
|
|
||||||
- name: Install CCache
|
- name: "Prepare tools & dependencies"
|
||||||
run: |
|
|
||||||
source $BUILD_TOOLS
|
|
||||||
apt_install_build_deps
|
|
||||||
|
|
||||||
- name: Checkout MicroPython & Submodules
|
|
||||||
run: |
|
|
||||||
source $BUILD_TOOLS
|
|
||||||
micropython_clone
|
|
||||||
|
|
||||||
- name: "Py_Decl: Checkout py_decl"
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: gadgetoid/py_decl
|
|
||||||
ref: v0.0.2
|
|
||||||
path: py_decl
|
|
||||||
|
|
||||||
- name: Build MPY Cross
|
|
||||||
run: |
|
|
||||||
source $BUILD_TOOLS
|
|
||||||
micropython_build_mpy_cross
|
|
||||||
|
|
||||||
- name: Configure MicroPython
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source $BUILD_TOOLS
|
source $CI_PROJECT_ROOT/ci/micropython.sh && ci_debug
|
||||||
|
mkdir -p $CI_BUILD_ROOT
|
||||||
|
ci_apt_install_build_deps
|
||||||
|
ci_prepare_all
|
||||||
|
|
||||||
|
- name: "MicroPython: Configure"
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
source $CI_PROJECT_ROOT/ci/micropython.sh && ci_debug
|
||||||
micropython_version
|
micropython_version
|
||||||
cmake_configure
|
ci_cmake_configure ${{ matrix.name }}
|
||||||
|
|
||||||
- name: Build MicroPython
|
- name: "MicroPython: Build"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
source $BUILD_TOOLS
|
source $CI_PROJECT_ROOT/ci/micropython.sh && ci_debug
|
||||||
cmake_build
|
python3 -m venv "$CI_BUILD_ROOT/.dir2uf2"
|
||||||
|
source "$CI_BUILD_ROOT/.dir2uf2/bin/activate"
|
||||||
|
ci_cmake_build ${{ matrix.name }}
|
||||||
|
mv "$CI_BUILD_ROOT/${{ matrix.name }}.uf2" "$CI_BUILD_ROOT/$RELEASE_FILE.uf2"
|
||||||
|
mv "$CI_BUILD_ROOT/${{ matrix.name }}-with-filesystem.uf2" "$CI_BUILD_ROOT/$RELEASE_FILE-with-filesystem.uf2"
|
||||||
|
|
||||||
- name: "Py_Decl: Verify UF2"
|
- name: "Artifacts: Upload .uf2"
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
python3 py_decl/py_decl.py --to-json --verify build-${{ matrix.name }}/${{ env.RELEASE_FILE }}.uf2
|
|
||||||
|
|
||||||
- name: Store .uf2 as artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.RELEASE_FILE }}.uf2
|
name: ${{ env.RELEASE_FILE }}.uf2
|
||||||
path: build-${{ matrix.name }}/${{ env.RELEASE_FILE }}.uf2
|
path: ${{ env.CI_BUILD_ROOT }}/${{ env.RELEASE_FILE }}.uf2
|
||||||
|
|
||||||
- name: Upload .uf2
|
- name: "Artifacts: Upload .uf2 (With Filesystem)"
|
||||||
if: github.event_name == 'release'
|
uses: actions/upload-artifact@v4
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
asset_path: build-${{ matrix.name }}/firmware.uf2
|
name: ${{ env.RELEASE_FILE }}-with-filesystem.uf2
|
||||||
upload_url: ${{ github.event.release.upload_url }}
|
path: ${{ env.CI_BUILD_ROOT }}/${{ env.RELEASE_FILE }}-with-filesystem.uf2
|
||||||
asset_name: ${{ env.RELEASE_FILE }}.uf2
|
|
||||||
asset_content_type: application/octet-stream
|
- name: "Release: Upload .uf2"
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: ${{ env.CI_BUILD_ROOT }}/${{ env.RELEASE_FILE }}.uf2
|
||||||
|
|
||||||
|
- name: "Release: Upload .uf2 (With Filesystem)"
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: ${{ env.CI_BUILD_ROOT }}/${{ env.RELEASE_FILE }}-with-filesystem.uf2
|
||||||
39
.gitignore
vendored
Normal file
39
.gitignore
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
*.smod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
**/build
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
# Apple filesystem cruft
|
||||||
|
.DS_Store
|
||||||
|
venv
|
||||||
37
boards/common.cmake
Normal file
37
boards/common.cmake
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Make sure we get our VirtualEnv Python
|
||||||
|
set(Python_FIND_VIRTUALENV "FIRST")
|
||||||
|
set(Python_FIND_UNVERSIONED_NAMES "FIRST")
|
||||||
|
set(Python_FIND_STRATEGY "LOCATION")
|
||||||
|
find_package (Python COMPONENTS Interpreter Development)
|
||||||
|
|
||||||
|
message("dir2uf2/py_decl: Using Python ${Python_EXECUTABLE}")
|
||||||
|
MESSAGE("dir2uf2/py_decl: Using pimoroni tools dir ${PIMORONI_TOOLS_DIR}")
|
||||||
|
|
||||||
|
# Convert supplies paths to absolute, for a quieter life
|
||||||
|
get_filename_component(PIMORONI_UF2_MANIFEST ${PIMORONI_UF2_MANIFEST} REALPATH)
|
||||||
|
get_filename_component(PIMORONI_UF2_DIR ${PIMORONI_UF2_DIR} REALPATH)
|
||||||
|
|
||||||
|
if (EXISTS "${PIMORONI_TOOLS_DIR}/py_decl/py_decl.py")
|
||||||
|
MESSAGE("py_decl: py_decl.py found, will verify uf2.")
|
||||||
|
add_custom_target("${MICROPY_TARGET}-verify" ALL
|
||||||
|
COMMAND ${Python_EXECUTABLE} "${PIMORONI_TOOLS_DIR}/py_decl/py_decl.py" --to-json --verify "${CMAKE_CURRENT_BINARY_DIR}/${MICROPY_TARGET}.uf2"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMENT "pydecl: Verifying ${MICROPY_TARGET}.uf2"
|
||||||
|
DEPENDS ${MICROPY_TARGET}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (EXISTS "${PIMORONI_TOOLS_DIR}/dir2uf2/dir2uf2" AND EXISTS "${PIMORONI_UF2_MANIFEST}" AND EXISTS "${PIMORONI_UF2_DIR}")
|
||||||
|
MESSAGE("dir2uf2: Using manifest ${PIMORONI_UF2_MANIFEST}.")
|
||||||
|
MESSAGE("dir2uf2: Using root ${PIMORONI_UF2_DIR}.")
|
||||||
|
add_custom_target("${MICROPY_TARGET}-with-filesystem.uf2" ALL
|
||||||
|
COMMAND ${Python_EXECUTABLE} "${PIMORONI_TOOLS_DIR}/dir2uf2/dir2uf2" --fs-compact --sparse --append-to "${MICROPY_TARGET}.uf2" --manifest "${PIMORONI_UF2_MANIFEST}" --filename with-filesystem.uf2 "${PIMORONI_UF2_DIR}"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMENT "dir2uf2: Appending filesystem to ${MICROPY_TARGET}.uf2."
|
||||||
|
DEPENDS ${MICROPY_TARGET}
|
||||||
|
DEPENDS "${MICROPY_TARGET}-verify"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
MESSAGE("dir2uf2: Could not find manifest ${PIMORONI_UF2_MANIFEST}")
|
||||||
|
MESSAGE(" and/or root ${PIMORONI_UF2_DIR}.")
|
||||||
|
endif()
|
||||||
@ -1,4 +1,5 @@
|
|||||||
MODULES_PY = "../../../pimoroni-pico/micropython/modules_py"
|
# micropython/ports/rp2/../../../
|
||||||
|
MODULES_PY = "{PORT_DIR}/../../../pimoroni-pico/micropython/modules_py"
|
||||||
|
|
||||||
# SD Card
|
# SD Card
|
||||||
require("sdcard")
|
require("sdcard")
|
||||||
3
boards/pimoroni_pico_plus2/usermodules.cmake
Normal file
3
boards/pimoroni_pico_plus2/usermodules.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../")
|
||||||
|
|
||||||
|
include(usermod-common)
|
||||||
3
boards/pimoroni_plasma2350/usermodules.cmake
Normal file
3
boards/pimoroni_plasma2350/usermodules.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../")
|
||||||
|
|
||||||
|
include(usermod-common)
|
||||||
3
boards/pimoroni_tiny2350/usermodules.cmake
Normal file
3
boards/pimoroni_tiny2350/usermodules.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../")
|
||||||
|
|
||||||
|
include(usermod-common)
|
||||||
3
boards/rpi_pico2/usermodules.cmake
Normal file
3
boards/rpi_pico2/usermodules.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../")
|
||||||
|
|
||||||
|
include(usermod-common)
|
||||||
3
boards/rpi_pico2_w/usermodules.cmake
Normal file
3
boards/rpi_pico2_w/usermodules.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../")
|
||||||
|
|
||||||
|
include(usermod-common)
|
||||||
3
boards/rpi_pico2b/usermodules.cmake
Normal file
3
boards/rpi_pico2b/usermodules.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../")
|
||||||
|
|
||||||
|
include(usermod-common)
|
||||||
@ -1,5 +1,15 @@
|
|||||||
export TERM=${TERM:="xterm-256color"}
|
export TERM=${TERM:="xterm-256color"}
|
||||||
|
|
||||||
|
MICROPYTHON_FLAVOUR="pimoroni"
|
||||||
|
MICROPYTHON_VERSION="feature/pico2_w_2025"
|
||||||
|
|
||||||
|
PIMORONI_PICO_FLAVOUR="pimoroni"
|
||||||
|
PIMORONI_PICO_VERSION="feature/picovector2-and-layers"
|
||||||
|
|
||||||
|
PY_DECL_VERSION="v0.0.3"
|
||||||
|
DIR2UF2_VERSION="v0.0.9"
|
||||||
|
|
||||||
|
|
||||||
function log_success {
|
function log_success {
|
||||||
echo -e "$(tput setaf 2)$1$(tput sgr0)"
|
echo -e "$(tput setaf 2)$1$(tput sgr0)"
|
||||||
}
|
}
|
||||||
@ -12,10 +22,19 @@ function log_warning {
|
|||||||
echo -e "$(tput setaf 1)$1$(tput sgr0)"
|
echo -e "$(tput setaf 1)$1$(tput sgr0)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function micropython_clone {
|
function ci_pimoroni_pico_clone {
|
||||||
log_inform "Using MicroPython $MICROPYTHON_VERSION"
|
log_inform "Using Pimoroni Pico $PIMORONI_PICO_FLAVOUR/$PIMORONI_PICO_VERSION"
|
||||||
git clone https://github.com/$MICROPYTHON_FLAVOUR/micropython
|
git clone https://github.com/$PIMORONI_PICO_FLAVOUR/pimoroni-pico "$CI_BUILD_ROOT/pimoroni-pico"
|
||||||
cd micropython
|
cd "$CI_BUILD_ROOT/pimoroni-pico" || return 1
|
||||||
|
git checkout $PIMORONI_PICO_VERSION
|
||||||
|
git submodule update --init
|
||||||
|
cd "$CI_BUILD_ROOT"
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_micropython_clone {
|
||||||
|
log_inform "Using MicroPython $MICROPYTHON_FLAVOUR/$MICROPYTHON_VERSION"
|
||||||
|
git clone https://github.com/$MICROPYTHON_FLAVOUR/micropython "$CI_BUILD_ROOT/micropython"
|
||||||
|
cd "$CI_BUILD_ROOT/micropython" || return 1
|
||||||
git checkout $MICROPYTHON_VERSION
|
git checkout $MICROPYTHON_VERSION
|
||||||
git submodule update --init lib/pico-sdk
|
git submodule update --init lib/pico-sdk
|
||||||
git submodule update --init lib/cyw43-driver
|
git submodule update --init lib/cyw43-driver
|
||||||
@ -24,42 +43,94 @@ function micropython_clone {
|
|||||||
git submodule update --init lib/micropython-lib
|
git submodule update --init lib/micropython-lib
|
||||||
git submodule update --init lib/tinyusb
|
git submodule update --init lib/tinyusb
|
||||||
git submodule update --init lib/btstack
|
git submodule update --init lib/btstack
|
||||||
cd ../
|
cd "$CI_BUILD_ROOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
function micropython_build_mpy_cross {
|
function ci_tools_clone {
|
||||||
cd micropython/mpy-cross
|
mkdir -p "$CI_BUILD_ROOT/tools"
|
||||||
|
git clone https://github.com/gadgetoid/py_decl -b "$PY_DECL_VERSION" "$CI_BUILD_ROOT/tools/py_decl"
|
||||||
|
git clone https://github.com/gadgetoid/dir2uf2 -b "$DIR2UF2_VERSION" "$CI_BUILD_ROOT/tools/dir2uf2"
|
||||||
|
python3 -m pip install littlefs-python==0.12.0
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_micropython_build_mpy_cross {
|
||||||
|
cd "$CI_BUILD_ROOT/micropython/mpy-cross" || return 1
|
||||||
ccache --zero-stats || true
|
ccache --zero-stats || true
|
||||||
CROSS_COMPILE="ccache " USER_C_MODULES= make
|
CROSS_COMPILE="ccache " make
|
||||||
ccache --show-stats || true
|
ccache --show-stats || true
|
||||||
cd ../../
|
cd "$CI_BUILD_ROOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
function apt_install_build_deps {
|
function ci_apt_install_build_deps {
|
||||||
sudo apt update && sudo apt install ccache
|
sudo apt update && sudo apt install ccache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ci_prepare_all {
|
||||||
|
ci_tools_clone
|
||||||
|
ci_micropython_clone
|
||||||
|
ci_pimoroni_pico_clone
|
||||||
|
ci_micropython_build_mpy_cross
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_debug {
|
||||||
|
log_inform "Project root: $CI_PROJECT_ROOT"
|
||||||
|
log_inform "Build root: $CI_BUILD_ROOT"
|
||||||
|
}
|
||||||
|
|
||||||
function micropython_version {
|
function micropython_version {
|
||||||
echo "MICROPY_GIT_TAG=$MICROPYTHON_VERSION, $BOARD_NAME $TAG_OR_SHA" >> $GITHUB_ENV
|
BOARD=$1
|
||||||
|
echo "MICROPY_GIT_TAG=$MICROPYTHON_VERSION, $BOARD $TAG_OR_SHA" >> $GITHUB_ENV
|
||||||
echo "MICROPY_GIT_HASH=$MICROPYTHON_VERSION-$TAG_OR_SHA" >> $GITHUB_ENV
|
echo "MICROPY_GIT_HASH=$MICROPYTHON_VERSION-$TAG_OR_SHA" >> $GITHUB_ENV
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmake_configure {
|
function ci_cmake_configure {
|
||||||
cmake -S micropython/ports/rp2 -B build-$BOARD_NAME \
|
BOARD=$1
|
||||||
|
TOOLS_DIR="$CI_BUILD_ROOT/tools"
|
||||||
|
MICROPY_BOARD_DIR=$CI_PROJECT_ROOT/boards/$BOARD
|
||||||
|
if [ ! -f "$MICROPY_BOARD_DIR/mpconfigboard.cmake" ]; then
|
||||||
|
log_warning "Invalid board: \"$BOARD\". Run with ci_cmake_configure <board_name>."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
BUILD_DIR="$CI_BUILD_ROOT/build-$BOARD"
|
||||||
|
cmake -S $CI_BUILD_ROOT/micropython/ports/rp2 -B "$BUILD_DIR" \
|
||||||
|
-DPICOTOOL_FORCE_FETCH_FROM_GIT=1 \
|
||||||
-DPICO_BUILD_DOCS=0 \
|
-DPICO_BUILD_DOCS=0 \
|
||||||
-DPICO_NO_COPRO_DIS=1 \
|
-DPICO_NO_COPRO_DIS=1 \
|
||||||
-DUSER_C_MODULES=$USER_C_MODULES \
|
-DPICOTOOL_FETCH_FROM_GIT_PATH="$TOOLS_DIR/picotool" \
|
||||||
-DMICROPY_BOARD_DIR=$MICROPY_BOARD_DIR \
|
-DPIMORONI_PICO_PATH="$CI_BUILD_ROOT/pimoroni-pico" \
|
||||||
-DMICROPY_BOARD=$MICROPY_BOARD \
|
-DPIMORONI_TOOLS_DIR="$TOOLS_DIR" \
|
||||||
-DMICROPY_BOARD_VARIANT=$MICROPY_BOARD_VARIANT \
|
-DUSER_C_MODULES="$MICROPY_BOARD_DIR/usermodules.cmake" \
|
||||||
|
-DMICROPY_BOARD_DIR="$MICROPY_BOARD_DIR" \
|
||||||
|
-DMICROPY_BOARD="$BOARD" \
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||||
}
|
}
|
||||||
|
|
||||||
function cmake_build {
|
function ci_cmake_build {
|
||||||
|
BOARD=$1
|
||||||
|
MICROPY_BOARD_DIR=$CI_PROJECT_ROOT/boards/$BOARD
|
||||||
|
if [ ! -f "$MICROPY_BOARD_DIR/mpconfigboard.cmake" ]; then
|
||||||
|
log_warning "Invalid board: \"$BOARD\". Run with ci_cmake_build <board_name>."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
BUILD_DIR="$CI_BUILD_ROOT/build-$BOARD"
|
||||||
ccache --zero-stats || true
|
ccache --zero-stats || true
|
||||||
cmake --build build-$BOARD_NAME -j 2
|
cmake --build $BUILD_DIR -j 2
|
||||||
ccache --show-stats || true
|
ccache --show-stats || true
|
||||||
cd build-$BOARD_NAME
|
|
||||||
cp firmware.uf2 $RELEASE_FILE.uf2
|
log_inform "Copying .uf2 to $(pwd)/$BOARD.uf2"
|
||||||
|
cp "$BUILD_DIR/firmware.uf2" $BOARD.uf2
|
||||||
|
|
||||||
|
if [ -f "$BUILD_DIR/firmware-with-filesystem.uf2" ]; then
|
||||||
|
log_inform "Copying -with-filesystem .uf2 to $(pwd)/$BOARD-with-filesystem.uf2"
|
||||||
|
cp "$BUILD_DIR/firmware-with-filesystem.uf2" $BOARD-with-filesystem.uf2
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ -z ${CI_USE_ENV+x} ] || [ -z ${CI_PROJECT_ROOT+x} ] || [ -z ${CI_BUILD_ROOT+x} ]; then
|
||||||
|
SCRIPT_PATH="$(dirname $0)"
|
||||||
|
CI_PROJECT_ROOT=$(realpath "$SCRIPT_PATH/..")
|
||||||
|
CI_BUILD_ROOT=$(pwd)
|
||||||
|
fi
|
||||||
|
|
||||||
|
ci_debug
|
||||||
Loading…
Reference in New Issue
Block a user