Skip to content

ESP32-H2 support

ESP32-H2 support #35

Workflow file for this run

name: 'build'
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
target: [esp32c3, esp32h2]
example: ["blink", "hello_world"]
include:
- target: esp32c3
example: "blink"
expected_size: 7436
- target: esp32c3
example: "hello_world"
expected_size: 10216
- target: esp32h2
example: "blink"
expected_size: 4561
- target: esp32h2
example: "hello_world"
expected_size: 8484
steps:
- uses: actions/checkout@v2
- name: Build ${{ matrix.example }} for ${{ matrix.target }}
shell: bash
run: |
export TOOLCHAIN_VERSION="12.2.0-3"
export TOOLCHAIN_DIR="xpack-riscv-none-elf-gcc-${TOOLCHAIN_VERSION}"
export TOOLCHAIN_ARCHIVE="${TOOLCHAIN_DIR}-linux-x64.tar.gz"
export TOOLCHAIN_URL="https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v${TOOLCHAIN_VERSION}/${TOOLCHAIN_ARCHIVE}"
wget --no-verbose ${TOOLCHAIN_URL}
tar xf ${TOOLCHAIN_ARCHIVE}
export PATH=$PWD/${TOOLCHAIN_DIR}/bin:$PATH
cd examples/${{ matrix.example }}
mkdir -p build
cmake -S . -B build -D target=${{ matrix.target }}
cmake --build build
bin_size=$(stat --format="%s" build/${{ matrix.example }}.bin)
expected_size=${{ matrix.expected_size }}
size_tolerance=500
echo "Binary size for ${{ matrix.example }} example: ${bin_size}, expected: ${expected_size}"
test ${bin_size} -gt $(($expected_size - $size_tolerance)) || (echo "binary seems too small"; exit 1)
test ${bin_size} -lt $(($expected_size + $size_tolerance)) || (echo "binary seems too large"; exit 1)