MCU Testing & CI

STM32F103 Blue Pill & NUCLEO-F103RB simulation

Test STM32F103 Cortex-M3 firmware without flashing ST-LINK dongles—backed by passing HAL ADC, DMA, EXTI, I2C, SPI, TIM and UART oracles.

STM32F103 remains ubiquitous in motor controllers, BMS boards and industrial adapters, yet F1 peripherals have quirky AFIO remap bits and I2C1 SMBus errata. Testing the compiled ELF directly catches AFIO remap omissions and DMA channel-mapping errors immediately.

Both blue-pill-f103c8 and nucleo-f103rb are tracked in board-dashboard.json, with 7 of 7 STM32F103 HAL peripheral oracles passing on clean-tree records.

STM32F103 HAL oracle coverage (nucleo-f103rb)

OracleResultInstructions retired
stm32f103-hal-adc / dma / extiPASS (3/3)~12.0M instructions each
stm32f103-hal-i2c / spiPASS (2/2)~12.0M instructions each
stm32f103-hal-tim / uartPASS (2/2)~12.1M–12.2M instructions
ARMv7-M CPU differentialPASS (0 disagrees)Clean-tree differential record

Local CLI workflow

Shell — simulate Blue Pill ELF
ct run --json --board blue-pill-f103c8 build/bluepill.elf
ct debug --board blue-pill-f103c8 --gdb-port 3333 build/bluepill.elf

Suite & fault configuration

tests/bluepill.suite.yaml
version: 1
board: blue-pill-f103c8
firmware: build/bluepill.elf
tests:
  - name: eeprom-write-and-readback
    expect:
      console_contains: "EEPROM_CRC_OK"
      exit_code: 0
  - name: i2c-wrong-address-nack
    faults:
      - at_ms: 40
        bus: I2C1
        kind: nack
        address: 0x50
        count: 1
    expect:
      console_contains: "EEPROM_RETRY_OK"

CI pipeline integration

.github/workflows/bluepill-ci.yml
name: STM32F103 CI
on: [push, pull_request]
jobs:
  bluepill:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pio run -e bluepill_f103c8
      - uses: circuittwin/action@v1
        with:
          board: blue-pill-f103c8
          firmware: .pio/build/bluepill_f103c8/firmware.elf
          suite: tests/bluepill.suite.yaml

Troubleshooting checklist

SymptomFix
No output on PB6/PB7 I2C1 or PA9/PA10 USART1On STM32F1, alternate function outputs require GPIO CNF=10 (AF push-pull/open-drain) AND RCC_APB2ENR.AFIOEN if remapping.
bxCAN and USB fail simultaneouslySTM32F103 shares 512 bytes of packet SRAM between USB and CAN1; they cannot run concurrently.
Flash size overrun on 64 KB C8 vs 128 KB CBCheck linker script FLASH length (64K for strict C8 compatibility) and verify ELF section headers.
I2C BUSY flag stuck after resetAdd a 9-clock SCL recovery pulse before I2C1 init and verify it with a stuck-bus fault test.

Related boards & component twins

More in MCU Testing & CI