Skip to content

Commit 16772ce

Browse files
CopilotJohnAmadis
andcommitted
Fix CI to explicitly show BOARD=stm32f746g-disco in cmake steps
- Expand test-renode-stm32f746g-disco job into separate explicit steps so that '-DBOARD=stm32f746g-disco -DDMBOOT_EMULATION=ON' is visible in the CI YAML, not buried inside run_renode_tests.sh - Add '--skip-build' option to run_renode_tests.sh so the CI can call it after an explicit cmake build without repeating the build phase; local developers can still call the script without any flags to get the full configure+build+test flow Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
1 parent 01b896d commit 16772ce

2 files changed

Lines changed: 77 additions & 32 deletions

File tree

.github/workflows/build.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,27 @@ jobs:
164164
run: |
165165
git submodule init
166166
git submodule update --recursive
167-
168-
- name: Run Renode emulation tests (stm32f746g-disco board)
167+
168+
- name: Configure cmake for stm32f746g-disco with Renode emulation
169+
run: |
170+
cmake -DCMAKE_BUILD_TYPE=Debug \
171+
-DBOARD=stm32f746g-disco \
172+
-DDMBOOT_EMULATION=ON \
173+
-S . \
174+
-B build
175+
176+
- name: Build firmware for stm32f746g-disco
177+
run: |
178+
cmake --build build --config Debug
179+
180+
- name: Install firmware for Renode
181+
run: |
182+
cmake --build build --target install-firmware
183+
ls -lh build/renode_firmware.elf
184+
185+
- name: Run Renode emulation and verify firmware logs
169186
run: |
170-
./scripts/run_renode_tests.sh
187+
./scripts/run_renode_tests.sh --skip-build . build
171188
172189
- name: Upload Renode logs on failure
173190
if: failure()

scripts/run_renode_tests.sh

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,30 @@
99
# being connected when modules are loaded at runtime).
1010
#
1111
# Usage:
12-
# ./scripts/run_renode_tests.sh [SOURCE_DIR [BUILD_DIR]]
12+
# ./scripts/run_renode_tests.sh [OPTIONS] [SOURCE_DIR [BUILD_DIR]]
1313
#
14-
# SOURCE_DIR Path to the project root.
15-
# Defaults to the parent directory of this script.
16-
# BUILD_DIR Path to the build directory.
17-
# Defaults to SOURCE_DIR/build.
14+
# --skip-build Skip the cmake configure + build steps. Use this when the
15+
# firmware has already been built (e.g. in a prior CI step)
16+
# and only the Renode emulation part needs to be run.
17+
# SOURCE_DIR Path to the project root.
18+
# Defaults to the parent directory of this script.
19+
# BUILD_DIR Path to the build directory.
20+
# Defaults to SOURCE_DIR/build.
1821

1922
set -e
2023

2124
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
25+
26+
SKIP_BUILD=0
27+
POSITIONAL=()
28+
for arg in "$@"; do
29+
case "$arg" in
30+
--skip-build) SKIP_BUILD=1 ;;
31+
*) POSITIONAL+=("$arg") ;;
32+
esac
33+
done
34+
set -- "${POSITIONAL[@]}"
35+
2236
SOURCE_DIR="${1:-$(cd "$SCRIPT_DIR/.." && pwd)}"
2337
BUILD_DIR="${2:-$SOURCE_DIR/build}"
2438

@@ -37,6 +51,7 @@ echo "=============================================="
3751
echo "Source dir : $SOURCE_DIR"
3852
echo "Build dir : $BUILD_DIR"
3953
echo "Board : $BOARD"
54+
echo "Skip build : $SKIP_BUILD"
4055
echo ""
4156

4257
# Cleanup helper – kill any lingering background processes on exit
@@ -50,31 +65,44 @@ cleanup() {
5065
}
5166
trap cleanup EXIT
5267

53-
# -------------------------------------------------------
54-
# Step 1 – Build firmware with emulation mode enabled
55-
# -------------------------------------------------------
56-
echo "[1/4] Building firmware (BOARD=$BOARD, DMBOOT_EMULATION=ON)..."
57-
cmake -DCMAKE_BUILD_TYPE=Debug \
58-
-DBOARD="$BOARD" \
59-
-DDMBOOT_EMULATION=ON \
60-
-S "$SOURCE_DIR" \
61-
-B "$BUILD_DIR"
62-
cmake --build "$BUILD_DIR" --config Debug
63-
echo "✓ Build completed"
64-
echo ""
65-
66-
# -------------------------------------------------------
67-
# Step 2 – Verify install-firmware target
68-
# -------------------------------------------------------
69-
echo "[2/4] Testing install-firmware target..."
70-
cmake --build "$BUILD_DIR" --target install-firmware
71-
if [ ! -f "$BUILD_DIR/renode_firmware.elf" ]; then
72-
echo "✗ renode_firmware.elf not found after install-firmware"
73-
exit 1
68+
if [ "$SKIP_BUILD" -eq 0 ]; then
69+
# -------------------------------------------------------
70+
# Step 1 – Build firmware with emulation mode enabled
71+
# -------------------------------------------------------
72+
echo "[1/4] Building firmware (BOARD=$BOARD, DMBOOT_EMULATION=ON)..."
73+
cmake -DCMAKE_BUILD_TYPE=Debug \
74+
-DBOARD="$BOARD" \
75+
-DDMBOOT_EMULATION=ON \
76+
-S "$SOURCE_DIR" \
77+
-B "$BUILD_DIR"
78+
cmake --build "$BUILD_DIR" --config Debug
79+
echo "✓ Build completed"
80+
echo ""
81+
82+
# -------------------------------------------------------
83+
# Step 2 – Verify install-firmware target
84+
# -------------------------------------------------------
85+
echo "[2/4] Testing install-firmware target..."
86+
cmake --build "$BUILD_DIR" --target install-firmware
87+
if [ ! -f "$BUILD_DIR/renode_firmware.elf" ]; then
88+
echo "✗ renode_firmware.elf not found after install-firmware"
89+
exit 1
90+
fi
91+
ls -lh "$BUILD_DIR/renode_firmware.elf"
92+
echo "✓ install-firmware target works correctly"
93+
echo ""
94+
else
95+
# --skip-build: just verify the firmware exists
96+
echo "[1/4] Skipping build (--skip-build specified)"
97+
if [ ! -f "$BUILD_DIR/renode_firmware.elf" ]; then
98+
echo "✗ renode_firmware.elf not found at $BUILD_DIR/renode_firmware.elf"
99+
echo " Run without --skip-build or build the firmware first."
100+
exit 1
101+
fi
102+
ls -lh "$BUILD_DIR/renode_firmware.elf"
103+
echo "✓ Firmware found"
104+
echo ""
74105
fi
75-
ls -lh "$BUILD_DIR/renode_firmware.elf"
76-
echo "✓ install-firmware target works correctly"
77-
echo ""
78106

79107
# -------------------------------------------------------
80108
# Step 3 – Start Renode in the background

0 commit comments

Comments
 (0)