dulse

Embedded tools grounded in what the chip actually does.

Dulse is a series of open-source tools to help make embedded development reliable, even when using questionable code coming from LLMs. Dulse builds hardware contracts from vendor documentation, hardware tests, and errata to catch common hardware errors before you ever flash them to a chip.

ST's own Class B safety example for the NUCLEO-G474RE (X-CUBE-CLASSB-G4 v4.0.1), built unmodified. The code passes safety self-tests, but leaves the system in a state that may fail at higher temperatures.

dulsec check stl.elf --board nucleo-g474re
error E1222: after this store the PLL runs at 170 MHz, above its 150 MHz cap in the range in force (RM0440 rev 9 §7.2.8 Table 50 p.280 (Range 1 normal mode: HSI16 16 MHz, HSE 48 MHz, PLL 150 MHz))
  --> stm32g4xx_hal_rcc.c:653 (HAL_RCC_OscConfig+0x51a, pc 0x080030ea)
   |
653|         __HAL_RCC_PLL_ENABLE();
   |
  fix: raise the range before configuring the PLL this fast, or configure it slower
coverage: 128 of 147 functions reached; 10 of 10 peripherals touched have a protocol; 68 of 68 MMIO write sites sequence-checked, 29 store(s) through an address the walk could not resolve
9 error(s), 3 warning(s)
On the board: the CPU reads R1MODE = 1 (boost off) and PWREN = 0 with the PLL at 170 MHz. main.c asks for SCALE1 where it needs SCALE1_BOOST, after the clock switch and with the PWR clock off, so the call does nothing. The CPU, flash CRC, RAM and clock self-tests all pass anyway. With the fix the error goes and the board reads R1MODE = 0. Works at room temperature, but out of spec.

The contract is checked against the chip, not the PDF

STM32G4 Errata

ST's errata sheet for the STM32G474 (ES0430 rev 9), tried item by item on a rev Y part: 24 reproduced, 2 of the 24 are worse than printed, e.g., the printed workaround for §2.2.8 doesn't work, and code after WFI runs wrongly every time. 3 errata from other ST parts' sheets hold here unlisted, plus about a dozen behaviours the manual doesn't describe (why we use the chip as the contract, not the PDF).

results/g4-e-errata-2026-11
TIM2 Duplicate INT

1000 of 1000 duplicate TIM2 interrupts when UIF is cleared last and a DSB is the 'fix', at APB1 /4 on the F429 and F746. A DSB is not a completion barrier on a divided APB: seen since on the L152, WL55, U585, L562, G474, G071 and (598 of 1000) the SAM G55. A read-back of the same peripheral fixes the flag-clear case.

GAPS G294
STM32F4 CRC

22,995 of 32,000 CRC blocks come out wrong on an STM32F401 when DMA2 writes CRC->DR while it also serves APB2 peripherals, and all 32,000 at the faster pace. The errata sheet (ES0299 §2.2.11) names GPIO as the victim, which didn't reproduce in 12 million writes; the CRC isn't listed. Zero with the printed workaround or with the APB2 traffic off, same counts on 3 of 3 boots.

errata-sweep F401-C1
udiv Timing

42, or 16 to 25 cycles for a udiv on the F429. At 5 wait states with the flash accelerator off it takes 42 whatever the operands are; with the instruction cache on it takes 16, 18 or 25 depending on them. The F401 at 1 wait state separates either way, so it is the wait states that hide it. A timing table measured in the slow configuration would call division constant-time.

results/ct-2026-10-14, GAPS G447

A contract with time in it

The control loop's deadline is a term the compiler holds, not a comment.

A task says how often it runs and how late it may be. The period isn't trusted from the source: it's derived from the timer's PSC and ARR writes, the APB prescaler and the clock tree the program set up, and a mismatch is an error. The response time is the task plus everything that can delay it: the longest interrupts-off span, every more urgent handler once per period, and the flash.

// pwm-rc-loop/src/main.dul (NUCLEO-F429ZI, PI loop on an RC circuit) task fn control() every 1ms deadline 100us on TIM6 { ... } // dulsec time . --> control: period 1 ms (PSC 89, ARR 999 at 180 MHz), response 3.2 µs, PASS

Trying to use a flash for storage during real-time operation is one example of a small change with major timing implications. On an STM32F4 a sector erase stalls every fetch from that bank for up to 2 s, so a settings save in main is a 2 s masked section as far as every handler in flash is concerned. The inverted pendulum port steps every 25 µs. The build refuses the image and names the fix.

One line does the same over a C image: [deadlines.TIM2_IRQHandler] period = true in an annotation file, and the erase inside a library, C or Dulse, gets the error with its file and line.

dulsec build .pendulum port, F429
error E1210: deadline of `step` not met: the erase of sector 7 (128 KB, PSIZE x32) in `params::save` (src/params.dul:351:5, from `main`) stalls every flash fetch for up to 2 s, against 25 µs; met when `step` and what it calls run from RAM (`[mpu] exec_ram`: 41 functions, 5212 bytes; no check is weakened), or when the erase can't run while control::MODE is outside {Idle, Fault} (the modes requirement C.STEP gives this deadline)
10 µs100 µs 1 ms10 ms 100 ms1 s 10 s step every 25 µs word program 100 µs 16 KB erase, measured 204 ms 128 KB, printed max 2 s

F4 flash: the deadline is held against the printed maximum for the sector being erased (2 s for a 128 KB one). The measured mark is a 16 KB sector on an F401, printed maximum 500 ms. A handler in RAM with the erase loop still in flash was blocked just the same; a stricter rule for that is proposed, not built.

The arms

One System for Everyone

Check

Any Cortex-M ELF, any toolchain. Reads and reports, alters nothing.

foundThe Class B example above. A typo in ST's CubeL5 TIM_OutputCompare example that reads the unclocked TIM2, so TIM3's compare is 0 instead of 499. Microchip's HAL read-modify-writing the write-only SUPC_CR, core-off bit included (latent: it reads 0 on both dies tried). The SAMD21 XOSC32K.AAMPEN erratum in a Zephyr SoC file that builds into nine boards, seven of them SAMD21. Four in ChibiOS master's HALs, e.g., the G4 'boost' option writes the bit that turns boost off, so the part runs 170 MHz in the 150 MHz mode (read back on a NUCLEO-G474RE). None filed upstream yet.

gapPrecision on vendor code is 0.06 to 0.16 per site held out; recall on historical bugs 1 to 3 in 46.

Contracts

Per-chip models from the SVD, the manual and the errata sheet, corrected on silicon. The rule is the stricter of the errata sheet and the board.

haveOver 2,000 recorded gaps and 163 errata-vs-silicon entries. ST, Microchip, Nordic, Espressif. dulsec hw <project> path USART2 Enabled prints the register sequence that gets there.

gapThe F429's registers are 83 % covered by rules; the older parts were built demo-first.

Secrets & constant time

A C project links a library written in Dulse. The compiler guarantees no branch or address depends on the secret, zeroes what it touched, and refuses a secret in a memory configuration nothing measured. verify proves the shipped bytes are the checked bytes. For C you already have, check image.elf --secret KEY follows a symbol you mark through the binary.

measuredAES-128 matches FIPS-197 on the board, 203 obligations. Flat in every memory configuration on F429, F401, L152, F746. --set CTL_BRANCH=1 gives E0901. Over a C ELF: mbedTLS's table AES with the key marked gives 70 secret-indexed lookups, and the Dulse AES comes out clean.

gapA * on a secret emits umull on an M3 and leaks; the per-part instruction table covers the F429 and F401 only. The walk loses the secret in BearSSL's bitsliced aes_ct, and no finding on a C image has been adjudicated by hand yet. Power and EM out of scope.

What a change does

For a PR to a firmware project, the register-level diff of what the board actually runs. 'Nothing hardware-visible' is an answer.

ran81 open PRs over Zephyr, RIOT, TinyUSB, Embassy, NuttX, MicroPython, Tock. RIOT 22413 changes every nRF52's UART baud value inside a PR titled as a new chip.

gapLooking back, 2 of the 4 known bugs it could reach were visible at the commit that introduced them (RIOT #10351, #7546), which is a small sample. In our planted-PR bench a model reading the code was the better reviewer; this shows what the hardware sees, it doesn't review.

Setup code from the model

Say the board and the goal. The init sequence comes out of the model with every write carrying its rule, then the checker judges it.

builtdulsec gen, C and Rust output, in the main tree.

gapOne small agent study so far (L562, Stop 2 wake-up): the Claude models ran it and still handed back HAL code, only the small open model kept the generated code, and it passed 0 of 3. Drives a part to a state; it doesn't write your driver.

The language

The same checker over Dulse source says more, because the compiler owns the instructions: the deadlines above, DMA ownership across handlers, the MPU table from the grants.

bench0 of 7 Dulse images broke the control loop, 11 of 14 C images did. Qwen 27B: 0 of 6 in C, 7 of 8 in Dulse.

gap2 to 3x the cost per session in the early rounds (cheaper in the two newest servo ones), and a frontier model didn't need it. Cells of one to five runs on the bench the model was calibrated on. The runs, and the newer rounds, are at dyno.dulse.dev.

Side channels and faults

Timing side channels today. Faults next, fault record first.

The memory system is a function of the address sequence and the configuration, and no language's semantics mentions either. So a program that is correct by every definition the compiler has still leaks a key, and this might change based on optimization level or device clock setting.

Embedded AES implementations leak if tables are placed on Flash, a common default in resource-constrained devices. The leak and fix is written in academic papers or subtle documentation notes. The compiler doesn't know this as has no device model.

Dulse owns the emitter and the layout.E0907 refuses the configuration moving while the secret is live, and E0908 refuses a secret computed in a memory configuration no bench capture covers (the F429 and F401 have captures so far). No branch, address or information flow is involved; a source-level tool can't say it, because the configuration is a register write it never sees.

Fault Injection: Model + Emitter

Glitching a chip makes it execute code incorrectly, skipping a password check or entering an unauthorized mode. Firmware hardening attempts to build countermeasures like double or hardened checks, but do people update them when changing devices? Glitch effects vary across devices, and Dulse having the device model + code emitter allows it to build effective countermeasures backed by real measurements.

Not public yet

Get a Notification of Release and Updates