MCU Testing & CI
STM32F7 firmware CI without a bench
Gate STM32F7 pull requests on the same Cortex-M7 ELF you flash to NUCLEO-F767ZI, including I2C/SPI sensor faults and exit code 4 unmodelled-register checks.
STM32F7 firmware fails in two ways that unit tests on x86 never see: misconfigured RCC peripheral clocks causing precise BusFaults, and DMA/cache coherency bugs on the Cortex-M7 data cache. Running the cross-compiled ARMv7E-M ELF on a deterministic STM32F767ZI twin exercises your real startup vector table, CubeHAL or LL register writes, and sensor drivers.
NUCLEO-F767ZI is the reference host for all 10 published vendor-driver oracles (MCP9808, HDC1080, INA219, PCA9685, AT24C256C, ADXL345, MPU-6050, SHT31-DIS, LSM6DSO, MAX31855). Attach any of them in your suite config and assert exact console markers or fault recovery.
STM32F767ZI twin checkpoints
| Subsystem | What the twin verifies | Common regression caught |
|---|---|---|
RCC + APB1/APB2 | Peripheral clock enable bits before MMIO writes | Writing I2C1->CR1 before RCC_APB1ENR returns BusFault |
Cortex-M7 FPv5-D16 | 2.2M-case ARMv7E-M differential instruction set | Wrong -mfpu flag or unenabled CPACR CP10/CP11 |
I2C / SPI / USART | Real driver framing, ACKs, baud dividers | APB1 vs APB2 clock mismatch halving USART baud |
Unmodelled regs | Exit code 4 (inconclusive) with peripheral + PC | Silent pass when code touches unmodelled ETH/USB bits |
Local CLI workflow
arm-none-eabi-gcc -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard ... -o build/app.elf
ct run --json --board nucleo-f767zi --timeout-ms 3000 build/app.elf
ct test run --json --junit results/f7.xml tests/stm32f7.suite.yamlSuite & fault configuration
version: 1
board: nucleo-f767zi
firmware: build/app.elf
tests:
- name: boot-and-imu-read
timeout_ms: 2500
expect:
console_contains: "IMU_OK"
exit_code: 0
- name: i2c1-nack-recovery
faults:
- at_ms: 80
bus: I2C1
kind: nack
address: 0x68
count: 3
expect:
console_contains: "I2C_RETRY_OK"CI pipeline integration
name: STM32F7 Twin CI
on: [push, pull_request]
jobs:
test-f767:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cmake --preset stm32f7 && cmake --build --preset stm32f7
- uses: circuittwin/action@v1
with:
suite: tests/stm32f7.suite.yaml
junit-out: results/stm32f7.xmlTroubleshooting checklist
| Symptom | Fix |
|---|---|
| Exit code 4 naming RCC_DCKCFGR2 or an ETH register | Inspect the JSON diagnostic; isolate unmodelled register paths or pass --unmodelled warn only for non-critical probes. |
| HardFault with CFSR=0x00080000 (NOCP) at boot | Enable CP10/CP11 in SCB->CPACR inside SystemInit() before any C++ static constructor uses floating point. |
| UART output missing in CI log | Verify USART3 (ST-LINK VCP on PD8/PD9 for NUCLEO-F767ZI) baud divider against APB1 clock. |
| Timeout waiting for HSE ready | Check whether your CubeMX clock init expects HSE bypass mode (8 MHz MCO from ST-LINK) vs crystal. |