Skip to content

Commit fa39f8c

Browse files
authored
Merge pull request #12 from intercreate/feat/serial-recovery-raw-cobs
feat: COBS-framed raw serial recovery fixture (intercreate/mcuboot#5)
2 parents 27c5483 + e93b72f commit fa39f8c

5 files changed

Lines changed: 830 additions & 4 deletions

File tree

.github/workflows/build.yaml

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,16 @@ jobs:
7676

7777
- uses: astral-sh/setup-uv@v8.1.0
7878

79+
# No patches here: `--exclude-tag patched` drops fixtures needing an
80+
# out-of-tree module patch so these stay on pinned upstream revisions. The
81+
# build-patched job builds them in isolation.
7982
- name: Build fixtures (Twister, all configs for this leg)
8083
working-directory: working_directory
8184
run: |
8285
args=""
8386
for p in ${{ matrix.platforms }}; do args="$args -p $p"; done
84-
west twister -T apps --build-only --inline-logs -O twister-out $args
87+
west twister -T apps --build-only --inline-logs -O twister-out $args \
88+
--exclude-tag patched
8589
8690
- name: Collect fixtures with canonical names and a manifest
8791
working-directory: working_directory
@@ -111,9 +115,67 @@ jobs:
111115
name: twister-logs-${{ matrix.leg }}
112116
path: working_directory/twister-out/**/build.log
113117

118+
# Builds the `patched`-tagged fixtures (only the COBS serial recovery one today,
119+
# intercreate/mcuboot#5) in isolation from the mainline build, so a module patch
120+
# touches only these binaries. west patch apply must run after action-zephyr-setup
121+
# (its west update resets modules to pinned revisions) and before Twister.
122+
build-patched:
123+
name: Build patched fixtures (out-of-tree module patches)
124+
needs: check-script
125+
runs-on: ubuntu-24.04
126+
steps:
127+
- uses: actions/checkout@v6
128+
with:
129+
path: working_directory
130+
persist-credentials: false
131+
132+
- uses: actions/setup-python@v6
133+
with:
134+
python-version: '3.13'
135+
136+
- uses: zephyrproject-rtos/action-zephyr-setup@v1
137+
with:
138+
app-path: working_directory
139+
toolchains: arm-zephyr-eabi
140+
ccache-cache-key: patched
141+
142+
- uses: astral-sh/setup-uv@v8.1.0
143+
144+
- name: Apply out-of-tree patches (west patch)
145+
working-directory: working_directory
146+
run: west patch -l patches.yml -b patches apply
147+
148+
- name: Build patched fixtures (Twister, tag=patched)
149+
working-directory: working_directory
150+
run: >-
151+
west twister -T apps --build-only --inline-logs -O twister-out
152+
-p mps2/an385 --tag patched
153+
154+
- name: Collect fixtures with canonical names and a manifest
155+
working-directory: working_directory
156+
run: |
157+
ver=$(west list zephyr --format='{revision}'); ver=${ver#v}
158+
if [ "${#ver}" -ge 40 ]; then ver=${ver:0:12}; fi
159+
uv run .github/scripts/collect_fixtures.py \
160+
--git-sha "$GITHUB_SHA" --zephyr-version "$ver" \
161+
--leg patched --twister-out twister-out --out-dir fixtures
162+
163+
- uses: actions/upload-artifact@v7
164+
with:
165+
name: fixtures-patched
166+
path: working_directory/fixtures/*
167+
if-no-files-found: error
168+
169+
- name: Upload Twister logs on failure
170+
if: failure()
171+
uses: actions/upload-artifact@v7
172+
with:
173+
name: twister-logs-patched
174+
path: working_directory/twister-out/**/build.log
175+
114176
release:
115177
name: Publish per-commit release (newest is the repo 'latest')
116-
needs: build
178+
needs: [build, build-patched]
117179
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
118180
runs-on: ubuntu-24.04
119181
permissions:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ ships a machine-readable [`manifest.json`](#manifest) describing every fixture.
2424
| **`serial`** (roomy) | mps2 | Cortex-M3, 4 MB SRAM via a flash overlay: one runnable image with **every** non-img group, fs file round-trips, and large buffers. |
2525
| **`serial_recovery`** | mps2 | Do-it-all MCUboot RAM_LOAD image — boots **straight into the full app** (every group incl. img) serving SMP on uart0 and logging on uart1. `os reset boot_mode=1` re-enters MCUboot **serial recovery** on demand; an upload there persists across the soft reset (slots live in a non-erased RAM-backed flash simulator). Recovery advertises the MCUmgr params command, so a client can negotiate buffers against the bootloader (see `recovery_buf_size`). Launched with two QEMU loaders: the MCUboot `.hex` plus the `.signed.bin` dropped into slot0. |
2626
| **`serial_recovery_raw`** | mps2 | The `serial_recovery` image, but both MCUboot recovery and the app speak the **raw** (non-console) SMP serial encoding — no base64/CRC/console framing, packets framed by the SMP header length (`CONFIG_BOOT_SERIAL_RAW_PROTOCOL` + `CONFIG_UART_MCUMGR_RAW_PROTOCOL`). For testing a client's raw serial transport against a real recovery server. Same two-loader launch as `serial_recovery`. |
27+
| **`serial_recovery_raw_cobs`** | mps2 | The `serial_recovery_raw` image, but MCUboot recovery wraps each raw SMP packet as `COBS(header ‖ payload ‖ CRC16) ‖ 0x00` (`CONFIG_BOOT_SERIAL_RAW_PROTOCOL_COBS`) — a self-synchronising, CRC-checked framing. Needs an out-of-tree MCUboot patch ([intercreate/mcuboot#5](https://github.com/intercreate/mcuboot/pull/5)) carried by [`patches.yml`](patches.yml); built by the isolated `build-patched` CI job so every other fixture stays on pinned upstream sources. The app stays plain raw. |
2728
| **`serial`** | qemu_cortex_m0 | Merged MCUboot + signed app — exercises the img (DFU) group under emulation. |
2829
| **`serial`, `ble`, `serial_recovery`** | nrf52840dk | Build-only images for a hardware bench. |
2930

apps/smp-server/sample.yaml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ tests:
464464
integration_platforms: [mps2/an385]
465465
extra_args:
466466
- *mps2_doitall_suffix
467-
- >-
467+
- &mps2_doitall_raw_conf >-
468468
EXTRA_CONF_FILE="raw_serial.conf;
469469
grp_os.conf;
470470
grp_fs.conf;
@@ -483,7 +483,33 @@ tests:
483483
- *mps2_doitall_log
484484
- *mps2_doitall_mcuboot_log
485485
- *mps2_doitall_mcuboot_dbg
486-
- mcuboot_CONFIG_BOOT_SERIAL_RAW_PROTOCOL=y
486+
- &mps2_doitall_raw_protocol mcuboot_CONFIG_BOOT_SERIAL_RAW_PROTOCOL=y
487+
488+
# COBS-framed raw recovery: like serial_recovery_raw, but MCUboot wraps each raw
489+
# SMP packet as COBS(header || payload || CRC16) || 0x00 (intercreate/mcuboot#5,
490+
# not upstream -- patches.yml + the build-patched CI job carry it). The app stays
491+
# plain raw_serial (COBS is an MCUboot boot_serial feature), so the test drives
492+
# recovery. For smpclient's COBS raw transport.
493+
smp_server.fixture.serial_recovery_raw_cobs.mps2_an385:
494+
sysbuild: true
495+
# `patched`: needs an out-of-tree module patch. The mainline build drops this
496+
# tag (--exclude-tag); the build-patched job builds it (--tag) after west patch.
497+
tags: [smp_server, fixture, patched]
498+
platform_allow: [mps2/an385]
499+
integration_platforms: [mps2/an385]
500+
extra_args:
501+
- *mps2_doitall_suffix
502+
- *mps2_doitall_raw_conf
503+
- *mps2_doitall_overlay
504+
- *mps2_doitall_mcuboot
505+
- *mps2_doitall_ramload
506+
- *mps2_doitall_unsigned
507+
- *mps2_doitall_hex
508+
- *mps2_doitall_log
509+
- *mps2_doitall_mcuboot_log
510+
- *mps2_doitall_mcuboot_dbg
511+
- *mps2_doitall_raw_protocol
512+
- mcuboot_CONFIG_BOOT_SERIAL_RAW_PROTOCOL_COBS=y
487513

488514
# mps2/an385 buffer-size matrix on the do-it-all RAM_LOAD image: the same
489515
# every-group-incl-img recovery fixture above, swept across

patches.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
checkout-command: git checkout .
2+
clean-command: git clean -d -f -x
3+
patches:
4+
- author: JP Hutchins
5+
date: '2026-06-24'
6+
email: hidden@github.com
7+
merge-pr: https://github.com/intercreate/mcuboot/pull/5
8+
merge-status: false
9+
module: bootloader/mcuboot
10+
path: boot-boot-serial-add-COBS-framing-for-raw-serial-recovery.patch
11+
sha256sum: a2a60b134fabb07417a330cb77ec6a756c8a4927fbbbd9797b13670168468bd7
12+
upstreamable: true

0 commit comments

Comments
 (0)