Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
91 changes: 91 additions & 0 deletions .github/workflows/test-build-cmake-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: WolfBoot CMake Build (macOS)

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

jobs:
macos-cmake:
name: Build on macOS (CMake + Ninja)
runs-on: macos-14
timeout-minutes: 20

env:
HOMEBREW_NO_AUTO_UPDATE: "1" # avoid updating taps during install
HOMEBREW_NO_ANALYTICS: "1"
HOMEBREW_CURL_RETRIES: "6" # ask curl inside brew to retry

steps:
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: true

- name: Cache Homebrew bottles # downloads (so retries don't redownload)
uses: actions/cache@v4
with:
path: |
~/Library/Caches/Homebrew
/Users/runner/Library/Caches/Homebrew
key: homebrew-${{ runner.os }}-mac14-cmake-gcc-newlib
restore-keys: |
homebrew-${{ runner.os }}-

- name: Install toolchain and build tools
run: |
# Install with step throttle to hopefully avoid stuck jobs

set -euxo pipefail

throttle_delay=5
brew update

sleep "$throttle_delay"
brew install --force-bottle cmake

sleep "$throttle_delay"
brew install --force-bottle ninja

# Use cask to include headers such as <stdlib.h>
sleep "$throttle_delay"
brew install --cask gcc-arm-embedded

- name: Probe ARM GCC (paths + smoke build)
run: |
set -euxo pipefail

which arm-none-eabi-gcc
arm-none-eabi-gcc --version

echo "=== GCC search dirs ==="
arm-none-eabi-gcc -print-search-dirs

echo "=== GCC verbose include paths (preprocess only) ==="
# This prints the built-in include search order; harmless with empty stdin.
arm-none-eabi-gcc -x c -E -v - < /dev/null || true

echo "=== Compile a freestanding object (no stdlib headers needed) ==="
cat > hello.c <<'EOF'
int main(void) { return 0; }
EOF
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -ffreestanding -nostdlib -c hello.c -o hello.o
ls -l hello.o

- name: Configure (STM32L4)
run: |
echo "Disabled, missing params"
# rm -rf build
# cmake -B build -G Ninja \
# -DWOLFBOOT_CONFIG_MODE=preset \
# -DWOLFBOOT_TARGET=stm32l4 \
# -DBUILD_TEST_APPS=ON \
# -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain_arm-none-eabi.cmake

- name: Presets
run: |
rm -rf ./build-stm32l4

cmake --preset stm32l4
cmake --build --preset stm32l4
72 changes: 72 additions & 0 deletions .github/workflows/test-build-cmake-script.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Wolfboot CMake Script
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
jobs:
cmake_automated_test:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Workaround for sources.list
run: |
# Replace sources

set -euxo pipefail

# Peek (what repos are active now)
apt-cache policy
grep -RInE '^(deb|Types|URIs)' /etc/apt || true

# Enable nullglob so *.list/*.sources that don't exist don't break sed
shopt -s nullglob

echo "Replace sources.list (legacy)"
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
/etc/apt/sources.list || true

echo "Replace sources.list.d/*.list (legacy)"
for f in /etc/apt/sources.list.d/*.list; do
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
"$f"
done

echo "Replace sources.list.d/*.sources (deb822)"
for f in /etc/apt/sources.list.d/*.sources; do
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
-e "s|https\?://azure\.archive\.ubuntu\.com|http://mirror.arizona.edu|g" \
"$f"
done

echo "Fix /etc/apt/apt-mirrors.txt (used by URIs: mirror+file:...)"
if grep -qE '^[[:space:]]*https?://azure\.archive\.ubuntu\.com/ubuntu/?' /etc/apt/apt-mirrors.txt; then
# Replace azure with our mirror (idempotent)
sudo sed -i 's|https\?://azure\.archive\.ubuntu\.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/apt-mirrors.txt
fi

# Peek (verify changes)
grep -RIn "azure.archive.ubuntu.com" /etc/apt || true
grep -RInE '^(deb|Types|URIs)' /etc/apt || true
echo "--- apt-mirrors.txt ---"
cat /etc/apt/apt-mirrors.txt || true


- name: Install requirements
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-none-eabi gcc-powerpc-linux-gnu cmake

- name: Run wolfbuild script
run: |
rm -rf ./build
./wolfbuild.sh --CLEAN "linux-stm32l4"
./wolfbuild.sh --target "linux-stm32l4"
117 changes: 117 additions & 0 deletions .github/workflows/test-build-cmake-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: WolfBoot CMake Build (Windows)

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

jobs:
windows-cmake:
name: Build on Windows (CMake + Ninja)
runs-on: windows-latest
timeout-minutes: 20

strategy:
fail-fast: false
matrix:
target:
- stm32l4
- stm32h7
include:
# Optional per-target cache variables you might want to pass later.
# Keep empty for now to avoid guessing addresses.
- target: stm32l4
extra_cache: ""
- target: stm32h7
extra_cache: ""

steps:
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: true

# ARM GCC toolchain (adds the bin dir to PATH)
- name: Set up ARM none-eabi GCC 14.x
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
version: "14.2.Rel1" # <-- use 'release', not 'version'
path-env-var: ARM_NONE_EABI_GCC_PATH

# CMake + Ninja are preinstalled on windows-latest, but verify & print versions
- name: Tool versions
shell: bash
run: |
echo "Compiler versions:"
arm-none-eabi-gcc --version
echo
echo "CMake:"
cmake --version
echo
echo "Ninja:"
ninja --version
echo
echo "MSVC (via vswhere):"
cmd.exe /c "\"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe\" -latest -products * -requires Microsoft.Component.MSBuild -property installationVersion"

- name: Build via cmd inline
shell: cmd
run: |
if exist build-windows-stm32l4 rmdir /s /q build-windows-stm32l4
cmake --preset windows-stm32l4
cmake --build --preset windows-stm32l4 --parallel %NUMBER_OF_PROCESSORS%

- name: Build via batch (cmd)
shell: cmd
run: |
:: # Call my_test.bat

call my_test.bat

- name: Configure (CMake + Ninja)
shell: bash
run: |
# cmake runs in git bash

BUILD_DIR="build-${{ matrix.target }}"
cmake -S . -B "$BUILD_DIR" -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain_arm-none-eabi.cmake \
-DWOLFBOOT_CONFIG_MODE=preset \
-DWOLFBOOT_TARGET=${{ matrix.target }} \
-DBUILD_TEST_APPS=ON \
-DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x8020000 \
-DWOLFBOOT_SECTOR_SIZE=0x20000 \
-DWOLFBOOT_PARTITION_SIZE=0xD0000 \
-DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x80F0000 \
-DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x81C0000 \
${{ matrix.extra_cache }}
echo "Configured: $BUILD_DIR"

- name: Build
shell: bash
run: |
# cmake runs in git bash
BUILD_DIR="build-${{ matrix.target }}"
cmake --build "$BUILD_DIR" --parallel

# Optional: show interesting artifacts
- name: List build outputs
if: always()
shell: bash
run: |
BUILD_DIR="build-${{ matrix.target }}"
echo "=== Artifacts in $BUILD_DIR ==="
find "$BUILD_DIR" -maxdepth 3 -type f \( -name "*.elf" -o -name "*.bin" -o -name "*.hex" -o -name "bin-assemble" -o -name "keystore" \) -print || true

# Upload binaries if present (non-fatal if none)
- name: Upload firmware/artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: wolfboot-${{ matrix.target }}
path: |
build-${{ matrix.target }}/**/*.elf
build-${{ matrix.target }}/**/*.bin
build-${{ matrix.target }}/**/*.hex
if-no-files-found: warn
58 changes: 56 additions & 2 deletions .github/workflows/test-build-cmake.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Wolfboot CMake Build
name: Wolfboot CMake Build (Ubuntu)
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
jobs:
Expand All @@ -12,16 +14,62 @@ jobs:
with:
submodules: true

- name: Workaround for sources.list
run: |
# Replace sources

set -euxo pipefail

# Peek (what repos are active now)
apt-cache policy
grep -RInE '^(deb|Types|URIs)' /etc/apt || true

# Enable nullglob so *.list/*.sources that don't exist don't break sed
shopt -s nullglob

echo "Replace sources.list (legacy)"
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
/etc/apt/sources.list || true

echo "Replace sources.list.d/*.list (legacy)"
for f in /etc/apt/sources.list.d/*.list; do
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
"$f"
done

echo "Replace sources.list.d/*.sources (deb822)"
for f in /etc/apt/sources.list.d/*.sources; do
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
-e "s|https\?://azure\.archive\.ubuntu\.com|http://mirror.arizona.edu|g" \
"$f"
done

echo "Fix /etc/apt/apt-mirrors.txt (used by URIs: mirror+file:...)"
if grep -qE '^[[:space:]]*https?://azure\.archive\.ubuntu\.com/ubuntu/?' /etc/apt/apt-mirrors.txt; then
# Replace azure with our mirror (idempotent)
sudo sed -i 's|https\?://azure\.archive\.ubuntu\.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/apt-mirrors.txt
fi

# Peek (verify changes)
grep -RIn "azure.archive.ubuntu.com" /etc/apt || true
grep -RInE '^(deb|Types|URIs)' /etc/apt || true
echo "--- apt-mirrors.txt ---"
cat /etc/apt/apt-mirrors.txt || true


- name: Install requirements
run: |
sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y gcc-arm-none-eabi gcc-powerpc-linux-gnu cmake

- name: Run CMake build for STM32U5
run: |
rm -rf ./build
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

- name: Build wolfBoot
run: make -C build

Expand Down Expand Up @@ -59,3 +107,9 @@ jobs:
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
- name: Build wolfBoot
run: make -C build

- name: Run wolfbuild script
run: |
rm -rf ./build
./wolfbuild.sh --CLEAN "linux-stm32l4"
./wolfbuild.sh --target "linux-stm32l4"
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,15 @@ lib/r_tsip_rx
Debug/
Release/
language.settings.xml

# Backup files
*.bak

# Any Visual Studio / VisualGDB
/**/.vs
/**/.visualgdb/*

# Any build directories
/**/build
/**/build-**

Loading
Loading