Skip to content

Add STM32H5 TFTP client demo #167

Add STM32H5 TFTP client demo

Add STM32H5 TFTP client demo #167

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: 25
container:
image: ghcr.io/wolfssl/wolfboot-ci-m33mu:v1.2
options: --privileged
steps:
- uses: actions/checkout@v4
- name: Install host tools
run: |
set -euo pipefail
apt-get update
apt-get install -y sudo dnsmasq iproute2 netcat-openbsd git \
openssh-client sshpass
- name: Fetch wolfSSL/wolfSSH
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
- name: Build STM32H563 SSH (TZEN on)
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 \
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: 15
run: |
set -euo pipefail
cleanup() {
set +e
if [ -f /tmp/m33mu.pid ]; then
sudo kill "$(cat /tmp/m33mu.pid)" 2>/dev/null || true
fi
sudo pkill -x m33mu 2>/dev/null || true
if [ -f /tmp/dnsmasq.pid ]; then
sudo kill "$(cat /tmp/dnsmasq.pid)" 2>/dev/null || true
fi
sudo ip link del tap0 2>/dev/null || true
}
trap cleanup EXIT
sudo ip tuntap add dev tap0 mode tap
sudo ip addr add 192.168.12.1/24 dev tap0
sudo 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
sudo dnsmasq --conf-file=/tmp/dnsmasq.conf --pid-file=/tmp/dnsmasq.pid
sudo m33mu src/port/stm32h563/app.bin \
--cpu stm32h563 --tap:tap0 --uart-stdout --timeout 180 --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 90); 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 60); 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
sudo kill "$(cat /tmp/m33mu.pid)" 2>/dev/null || true
fi