Skip to content

Commit 84fbf0f

Browse files
committed
Latest WIP dev
1 parent e6595fa commit 84fbf0f

22 files changed

+1746
-272
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: WolfBoot CMake Build (macOS)
2+
3+
on:
4+
push:
5+
branches: [ "*" ]
6+
pull_request:
7+
branches: [ "*" ]
8+
9+
jobs:
10+
macos-cmake:
11+
name: Build on macOS (CMake + Ninja)
12+
runs-on: macos-14
13+
timeout-minutes: 20
14+
15+
env:
16+
HOMEBREW_NO_AUTO_UPDATE: "1" # avoid updating taps during install
17+
HOMEBREW_NO_ANALYTICS: "1"
18+
HOMEBREW_CURL_RETRIES: "6" # ask curl inside brew to retry
19+
20+
steps:
21+
- name: Checkout (with submodules)
22+
uses: actions/checkout@v4
23+
with:
24+
submodules: true
25+
26+
- name: Cache Homebrew bottles # downloads (so retries don’t redownload)
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
~/Library/Caches/Homebrew
31+
/Users/runner/Library/Caches/Homebrew
32+
key: homebrew-${{ runner.os }}-mac14-cmake-gcc-newlib
33+
restore-keys: |
34+
homebrew-${{ runner.os }}-
35+
36+
- name: Install toolchain and build tools
37+
run: |
38+
# Install with step throttle to hopefully avoid stuck jobs
39+
40+
set -euxo pipefail
41+
42+
throttle_delay=5
43+
brew update
44+
45+
sleep "$throttle_delay"
46+
brew install --force-bottle cmake
47+
48+
sleep "$throttle_delay"
49+
brew install --force-bottle ninja
50+
51+
sleep "$throttle_delay"
52+
brew install --force-bottle arm-none-eabi-gcc
53+
54+
- name: Probe GCC sysroot (headers check)
55+
run: |
56+
set -euxo pipefail
57+
SYSROOT="$(arm-none-eabi-gcc -print-sysroot)"
58+
echo "GCC sysroot: $SYSROOT"
59+
test -f "$SYSROOT/include/stdlib.h" || { echo "Missing stdlib.h in $SYSROOT/include"; exit 1; }
60+
test -f "$SYSROOT/include/string.h" || { echo "Missing string.h in $SYSROOT/include"; exit 1; }
61+
62+
- name: Configure (STM32L4)
63+
run: |
64+
echo "Disabled, missing params"
65+
# rm -rf build
66+
# cmake -B build -G Ninja \
67+
# -DWOLFBOOT_CONFIG_MODE=preset \
68+
# -DWOLFBOOT_TARGET=stm32l4 \
69+
# -DBUILD_TEST_APPS=ON \
70+
# -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain_arm-none-eabi.cmake
71+
72+
- name: Presets
73+
run: |
74+
rm -rf ./build-mac-stm32l4
75+
76+
cmake --preset mac-stm32l4
77+
cmake --build --preset mac-stm32l4
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Wolfboot CMake Script
2+
on:
3+
push:
4+
branches: [ '*' ]
5+
pull_request:
6+
branches: [ '*' ]
7+
jobs:
8+
cmake_automated_test:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 15
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: true
16+
17+
- name: Workaround for sources.list
18+
run: |
19+
# Replace sources
20+
21+
set -euxo pipefail
22+
23+
# Peek (what repos are active now)
24+
apt-cache policy
25+
grep -RInE '^(deb|Types|URIs)' /etc/apt || true
26+
27+
# Enable nullglob so *.list/*.sources that don't exist don't break sed
28+
shopt -s nullglob
29+
30+
echo "Replace sources.list (legacy)"
31+
sudo sed -i \
32+
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
33+
/etc/apt/sources.list || true
34+
35+
echo "Replace sources.list.d/*.list (legacy)"
36+
for f in /etc/apt/sources.list.d/*.list; do
37+
sudo sed -i \
38+
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
39+
"$f"
40+
done
41+
42+
echo "Replace sources.list.d/*.sources (deb822)"
43+
for f in /etc/apt/sources.list.d/*.sources; do
44+
sudo sed -i \
45+
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
46+
-e "s|https\?://azure\.archive\.ubuntu\.com|http://mirror.arizona.edu|g" \
47+
"$f"
48+
done
49+
50+
echo "Fix /etc/apt/apt-mirrors.txt (used by URIs: mirror+file:...)"
51+
if grep -qE '^[[:space:]]*https?://azure\.archive\.ubuntu\.com/ubuntu/?' /etc/apt/apt-mirrors.txt; then
52+
# Replace azure with our mirror (idempotent)
53+
sudo sed -i 's|https\?://azure\.archive\.ubuntu\.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/apt-mirrors.txt
54+
fi
55+
56+
# Peek (verify changes)
57+
grep -RIn "azure.archive.ubuntu.com" /etc/apt || true
58+
grep -RInE '^(deb|Types|URIs)' /etc/apt || true
59+
echo "--- apt-mirrors.txt ---"
60+
cat /etc/apt/apt-mirrors.txt || true
61+
62+
63+
- name: Install requirements
64+
run: |
65+
sudo apt-get update
66+
sudo apt-get install -y gcc-arm-none-eabi gcc-powerpc-linux-gnu cmake
67+
68+
- name: Run wolfbuild script
69+
run: |
70+
rm -rf ./build
71+
./wolfbuild.sh --CLEAN "linux-stm32l4"
72+
./wolfbuild.sh --target "linux-stm32l4"
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: WolfBoot CMake Build (Windows)
2+
3+
on:
4+
push:
5+
branches: [ "*" ]
6+
pull_request:
7+
branches: [ "*" ]
8+
9+
jobs:
10+
windows-cmake:
11+
name: Build on Windows (CMake + Ninja)
12+
runs-on: windows-latest
13+
timeout-minutes: 20
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
target:
19+
- stm32l4
20+
- stm32h7
21+
include:
22+
# Optional per-target cache variables you might want to pass later.
23+
# Keep empty for now to avoid guessing addresses.
24+
- target: stm32l4
25+
extra_cache: ""
26+
- target: stm32h7
27+
extra_cache: ""
28+
29+
steps:
30+
- name: Checkout (with submodules)
31+
uses: actions/checkout@v4
32+
with:
33+
submodules: true
34+
35+
# ARM GCC toolchain (adds the bin dir to PATH)
36+
- name: Set up ARM none-eabi GCC 14.x
37+
uses: carlosperate/arm-none-eabi-gcc-action@v1
38+
with:
39+
version: "14.2.Rel1" # <-- use 'release', not 'version'
40+
path-env-var: ARM_NONE_EABI_GCC_PATH
41+
42+
# CMake + Ninja are preinstalled on windows-latest, but verify & print versions
43+
- name: Tool versions
44+
shell: bash
45+
run: |
46+
echo "Compiler versions:"
47+
arm-none-eabi-gcc --version
48+
echo
49+
echo "CMake:"
50+
cmake --version
51+
echo
52+
echo "Ninja:"
53+
ninja --version
54+
echo
55+
echo "MSVC (via vswhere):"
56+
cmd.exe /c "\"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe\" -latest -products * -requires Microsoft.Component.MSBuild -property installationVersion"
57+
58+
- name: Build via cmd inline
59+
shell: cmd
60+
run: |
61+
if exist build-windows-stm32l4 rmdir /s /q build-windows-stm32l4
62+
cmake --preset windows-stm32l4
63+
cmake --build --preset windows-stm32l4 --parallel %NUMBER_OF_PROCESSORS%
64+
65+
- name: Build via batch (cmd)
66+
shell: cmd
67+
run: |
68+
:: # Call my_test.bat
69+
70+
call my_test.bat
71+
72+
- name: Configure (CMake + Ninja)
73+
shell: bash
74+
run: |
75+
# cmake runs in git bash
76+
echo "disabled"
77+
78+
#BUILD_DIR="build-${{ matrix.target }}"
79+
#cmake -S . -B "$BUILD_DIR" -G Ninja \
80+
# -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain_arm-none-eabi.cmake \
81+
# -DWOLFBOOT_CONFIG_MODE=preset \
82+
# -DWOLFBOOT_TARGET=${{ matrix.target }} \
83+
# -DBUILD_TEST_APPS=ON \
84+
# ${{ matrix.extra_cache }}
85+
#echo "Configured: $BUILD_DIR"
86+
87+
- name: Build
88+
shell: bash
89+
run: |
90+
# cmake runs in git bash
91+
BUILD_DIR="build-${{ matrix.target }}"
92+
cmake --build "$BUILD_DIR" --parallel
93+
94+
# Optional: show interesting artifacts
95+
- name: List build outputs
96+
if: always()
97+
shell: bash
98+
run: |
99+
BUILD_DIR="build-${{ matrix.target }}"
100+
echo "=== Artifacts in $BUILD_DIR ==="
101+
find "$BUILD_DIR" -maxdepth 3 -type f \( -name "*.elf" -o -name "*.bin" -o -name "*.hex" -o -name "bin-assemble" -o -name "keystore" \) -print || true
102+
103+
# Upload binaries if present (non-fatal if none)
104+
- name: Upload firmware/artifacts
105+
if: always()
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: wolfboot-${{ matrix.target }}
109+
path: |
110+
build-${{ matrix.target }}/**/*.elf
111+
build-${{ matrix.target }}/**/*.bin
112+
build-${{ matrix.target }}/**/*.hex
113+
if-no-files-found: warn

.github/workflows/test-build-cmake.yml

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
name: Wolfboot CMake Build
1+
name: Wolfboot CMake Build (Ubuntu)
22
on:
3+
push:
4+
branches: [ '*' ]
35
pull_request:
46
branches: [ '*' ]
57
jobs:
@@ -12,16 +14,62 @@ jobs:
1214
with:
1315
submodules: true
1416

17+
- name: Workaround for sources.list
18+
run: |
19+
# Replace sources
20+
21+
set -euxo pipefail
22+
23+
# Peek (what repos are active now)
24+
apt-cache policy
25+
grep -RInE '^(deb|Types|URIs)' /etc/apt || true
26+
27+
# Enable nullglob so *.list/*.sources that don't exist don't break sed
28+
shopt -s nullglob
29+
30+
echo "Replace sources.list (legacy)"
31+
sudo sed -i \
32+
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
33+
/etc/apt/sources.list || true
34+
35+
echo "Replace sources.list.d/*.list (legacy)"
36+
for f in /etc/apt/sources.list.d/*.list; do
37+
sudo sed -i \
38+
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
39+
"$f"
40+
done
41+
42+
echo "Replace sources.list.d/*.sources (deb822)"
43+
for f in /etc/apt/sources.list.d/*.sources; do
44+
sudo sed -i \
45+
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
46+
-e "s|https\?://azure\.archive\.ubuntu\.com|http://mirror.arizona.edu|g" \
47+
"$f"
48+
done
49+
50+
echo "Fix /etc/apt/apt-mirrors.txt (used by URIs: mirror+file:...)"
51+
if grep -qE '^[[:space:]]*https?://azure\.archive\.ubuntu\.com/ubuntu/?' /etc/apt/apt-mirrors.txt; then
52+
# Replace azure with our mirror (idempotent)
53+
sudo sed -i 's|https\?://azure\.archive\.ubuntu\.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/apt-mirrors.txt
54+
fi
55+
56+
# Peek (verify changes)
57+
grep -RIn "azure.archive.ubuntu.com" /etc/apt || true
58+
grep -RInE '^(deb|Types|URIs)' /etc/apt || true
59+
echo "--- apt-mirrors.txt ---"
60+
cat /etc/apt/apt-mirrors.txt || true
61+
62+
1563
- name: Install requirements
1664
run: |
17-
sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/sources.list
1865
sudo apt-get update
1966
sudo apt-get install -y gcc-arm-none-eabi gcc-powerpc-linux-gnu cmake
2067
2168
- name: Run CMake build for STM32U5
2269
run: |
2370
rm -rf ./build
2471
cmake -B build -DWOLFBOOT_TARGET=stm32u5 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x08100000 -DWOLFBOOT_SECTOR_SIZE=0x2000 -DWOLFBOOT_PARTITION_SIZE=0x20000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x817F000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x81FE000 -DNO_MPU=yes
72+
2573
- name: Build wolfBoot
2674
run: make -C build
2775

@@ -59,3 +107,9 @@ jobs:
59107
cmake -B build -DWOLFBOOT_TARGET=nrf52 -DWOLFBOOT_PARTITION_SIZE=0x8000 -DWOLFBOOT_SECTOR_SIZE=0x1000 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x27000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x2F000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x37000
60108
- name: Build wolfBoot
61109
run: make -C build
110+
111+
- name: Run wolfbuild script
112+
run: |
113+
rm -rf ./build
114+
./wolfbuild.sh --CLEAN "linux-stm32l4"
115+
./wolfbuild.sh --target "linux-stm32l4"

.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "STM32L4 - OpenOCD",
6+
"type": "cortex-debug",
7+
"request": "launch",
8+
"servertype": "openocd",
9+
"cwd": "${workspaceFolder:wolfBoot}",
10+
"executable": "${workspaceFolder:wolfBoot}/build-linux-stm32l4/wolfboot.elf",
11+
"device": "STM32L475VG",
12+
"configFiles": [
13+
"interface/stlink-dap.cfg",
14+
"target/stm32l4x.cfg"
15+
],
16+
"runToMain": true,
17+
"svdFile": "${workspaceFolder:wolfBoot}/hal/stm32l4/STM32L4x.svd",
18+
}
19+
]
20+
}

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"cmake.useCMakePresets": "auto",
3+
"cmake.buildDirectory": "${workspaceFolder}/build-${buildPresetName}",
4+
"cmake.configureOnOpen": true,
5+
"cmake.generator": "Ninja",
6+
"cmake.loggingLevel": "info",
7+
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
8+
"files.encoding": "utf8",
9+
"files.eol": "\n",
10+
"cmake.preferredGenerators": [ "Ninja", "Visual Studio 17 2022" ]
11+
}

0 commit comments

Comments
 (0)