Skip to content

Zephyr TCP/IP replacement #217

Zephyr TCP/IP replacement

Zephyr TCP/IP replacement #217

name: STM32H563 m33mu (SSH + TZEN)
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]
jobs:
stm32h563_m33mu_ssh_tzen:
runs-on: ubuntu-latest
timeout-minutes: 20
container:
image: ghcr.io/wolfssl/wolfboot-ci-m33mu:latest
options: --privileged
steps:
- uses: actions/checkout@v4
- name: Install host tools
run: |
set -euo pipefail
apt-get update
apt-get install -y dnsmasq iproute2 netcat-openbsd git \
openssh-client sshpass
- name: Fetch wolfSSL/wolfSSH/wolfBoot
run: |
set -euo pipefail
if [ ! -d ../wolfssl ]; then
git clone --depth 1 --branch master https://github.com/wolfSSL/wolfssl.git ../wolfssl
fi
if [ ! -d ../wolfssh ]; then
git clone --depth 1 --branch master https://github.com/wolfSSL/wolfssh.git ../wolfssh
fi
if [ ! -d ../wolfboot ]; then
git clone --depth 1 https://github.com/wolfSSL/wolfBoot.git ../wolfboot
fi
git -C ../wolfboot submodule update --init --single-branch
- name: Build wolfBoot (stm32h5-tz)
run: |
set -euo pipefail
cd ../wolfboot
cp config/examples/stm32h5-tz.config .config
make wolfboot.bin
- name: Build STM32H563 SSH NS app (TZEN on) and sign
run: |
set -euo pipefail
make -C src/port/stm32h563 clean TZEN=1 ENABLE_SSH=1
make -C src/port/stm32h563 TZEN=1 ENABLE_SSH=1 signed \
WOLFBOOT_ROOT="$GITHUB_WORKSPACE/../wolfboot" \
CC=arm-none-eabi-gcc OBJCOPY=arm-none-eabi-objcopy
strings src/port/stm32h563/app.bin > /tmp/wolfip-app.strings
grep -Fq "Initializing SSH server" /tmp/wolfip-app.strings
- name: Run m33mu + DHCP + SSH test
timeout-minutes: 10
run: |
set -euo pipefail
cleanup() {
set +e
if [ -f /tmp/m33mu.pid ]; then
kill "$(cat /tmp/m33mu.pid)" 2>/dev/null || true
fi
pkill -x m33mu 2>/dev/null || true
if [ -f /tmp/dnsmasq.pid ]; then
kill "$(cat /tmp/dnsmasq.pid)" 2>/dev/null || true
fi
ip link del tap0 2>/dev/null || true
}
trap cleanup EXIT
ip tuntap add dev tap0 mode tap
ip addr add 192.168.12.1/24 dev tap0
ip link set tap0 up
cat > /tmp/dnsmasq.conf <<'CONF'
interface=tap0
bind-interfaces
dhcp-range=192.168.12.50,192.168.12.100,255.255.255.0,12h
dhcp-leasefile=/tmp/dnsmasq.leases
log-dhcp
CONF
dnsmasq --conf-file=/tmp/dnsmasq.conf --pid-file=/tmp/dnsmasq.pid
/usr/local/bin/m33mu \
../wolfboot/wolfboot.bin \
src/port/stm32h563/app_v1_signed.bin:0x60000 \
--cpu stm32h563 --tap:tap0 --uart-stdout --timeout 360 --quit-on-faults \
2>&1 | tee /tmp/m33mu.log &
sleep 1
m33mu_pid="$(pgrep -n -x m33mu || true)"
if [ -n "${m33mu_pid}" ]; then
echo "${m33mu_pid}" > /tmp/m33mu.pid
fi
ip=""
for _ in $(seq 1 300); do
if [ -s /tmp/dnsmasq.leases ]; then
ip="$(tail -n1 /tmp/dnsmasq.leases | cut -d' ' -f3)"
fi
if [ -n "${ip}" ]; then
break
fi
sleep 1
done
if [ -z "${ip}" ]; then
echo "No DHCP lease acquired."
echo "m33mu log:"
tail -n 200 /tmp/m33mu.log || true
exit 1
fi
echo "Leased IP: ${ip}"
ok=0
for _ in $(seq 1 240); do
if ! pgrep -x m33mu >/dev/null 2>&1; then
echo "m33mu exited before SSH check."
tail -n 200 /tmp/m33mu.log || true
exit 1
fi
if timeout 10s bash -lc "printf '' | nc -w 5 '${ip}' 22" \
| tee /tmp/ssh.log | grep -q "^SSH-2.0-"; then
ok=1
break
fi
sleep 0.5
done
if [ "${ok}" -ne 1 ]; then
echo "SSH test failed."
echo "m33mu log:"
tail -n 200 /tmp/m33mu.log || true
echo "ssh log:"
tail -n 200 /tmp/ssh.log || true
exit 1
fi
echo "SSH test succeeded."
if [ -f /tmp/m33mu.pid ]; then
kill "$(cat /tmp/m33mu.pid)" 2>/dev/null || true
fi