amos ac3d3db9e0 Add 13 more Qwen-measured tasks from batches 26 and 27 (8 HARD, 5 MEDIUM)
Route D (real fixes in embedded open-source projects) keeps producing the
hard tasks: of 64 measured so far, 15 are HARD and 4 MEDIUM, mostly because
Qwen exhausts its context in the larger real workspaces. This adds
CANopen SRDO and ASCII timing, FreeRTOS DHCP, lwIP MQTT fragments, printf
extremal exponents, Zephyr packet buffers and heatshrink (HARD), plus
lwjson, RFM9x, SFUD and nanopb proto3 (MEDIUM).

From batch 27 (spec-dense implementation tasks) come one HARD and one
MEDIUM; that batch is winding down after 30 tasks gave 1 HARD and 3 MEDIUM.

Each task comes from the commit Qwen measured, its digest matches, and it
is still present at the batch branch head. Agent timeouts stay excluded:
a pyserial attempt timed out on Qwen's own blocking read yet graded PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 16:29:21 +08:00

11 KiB
Raw Blame History

SFUD NOR command and initialization state

  • Task: dev-sfud-flash-command-state, version 1, family device-io, C.
  • Route D: real upstream reliability fixes, not an invented defective library. Difficulty is unmeasured; no model sampling was run for this batch.
  • Upstream / split group: armink/SFUD, armink/SFUD.
  • Frozen base: 944563b713fcd35fa865e149dd4c65a371d1960d.
  • Fix A: 4b41297127ec27ba9c08358fa072629e1c08ca1c, 8 additions / 4 deletions in sfud/src/sfud.c.
  • Fix B: e815c98e1dfe3aca64cf8d956d589504b3d5d1db, 6 additions / 1 deletion in the same candidate file.
  • License: MIT, copyright 2016–2018 Armink. LICENSE and original file copyright notices are retained byte for byte. No third-party board SDK or example code is included.

Source and independence

A expands device preparation beyond AAI-capable parts: port-configured MX25L3206E must leave software block protection disabled, using its nonvolatile WREN/WRSR sequence. Its preparation errors must reach the caller. The frozen implementation prepares only AAI devices, so an otherwise successful settings update can leave protected bytes unchanged.

B corrects the QSPI helper's ordinary 32-bit-address read instruction. The frozen helper adds one to all 3-byte read opcodes, turning ordinary read 03h into write-disable 04h; the dedicated ordinary 4-byte read is 13h. Other fast-read forms do use the existing increment mapping.

These are independent upstream changes to disjoint hunks: hardware initialization and read-command formatting. Each complete patch applies to the frozen base with patch --fuzz=0 -p1; gold is exactly both patches applied, with no intervening historical changes. only_protection and only_read apply one complete patch each, and each fails the other defect's behavior checks. No extra defect was introduced. Source byte identities and patch copies are retained in the author report directory.

The base already exposes the affected path through public APIs: sfud_device_init, sfud_qspi_fast_read_enable(flash, 1) on a device larger than 16 MiB, and sfud_read invoke the port's QSPI callback. Unlisted extended-mode profiles also take ordinary-read fallback for maximum widths 2 and 4. No static function is exposed or called by the observation harness.

Frozen and completed files

All paths below are relative to template/. There are 13 files, with no symlinks and none larger than 1 MiB.

Path Provenance / purpose
LICENSE Upstream frozen, unchanged MIT license
sfud/inc/sfud.h Upstream frozen, unchanged public API
sfud/inc/sfud_cfg.h Upstream frozen, unchanged SFDP/table/QSPI configuration
sfud/inc/sfud_def.h Upstream frozen, unchanged API types, opcodes and retry definitions
sfud/inc/sfud_flash_def.h Upstream frozen, unchanged device and extended-mode tables
sfud/src/sfud.c Upstream frozen, unchanged defective implementation; only collected candidate
sfud/src/sfud_sfdp.c Upstream frozen, unchanged discovery context; original comment encoding retained
support/virtual_flash.h Completed: board-port model interface and device state
support/virtual_flash.c Completed: synchronous NOR bus, command interpretation, storage and deterministic fault injection
support/smoke.c Completed: public observation program; default path avoids both defects
Makefile Completed: direct GCC build plus smoke/repro targets
README.md Completed: build, integration context and collection boundary
docs/storage-contract.md Completed: public API/device contract, paraphrased from the sources below

The two upstream C implementations total 1,423 physical lines and 894 nonblank noncomment lines. sfud.c alone has 652 nonblank noncomment lines. Including the supplied C headers and model, the task has 2,351 physical C/header lines and 1,458 nonblank noncomment lines. Counts do not include sample variants, checker code or duplicated grader support.

Only sfud/src/sfud.c is collected. Private build_inputs.json is a base64-encoded, byte-identical copy of the five frozen noncandidate C/header inputs and the two public model files needed by the build (seven files total: four SFUD headers, SFDP C, model C/header). This prevents edits outside the candidate boundary from affecting grading. The observation main is embedded in check.py, not in the candidate workspace.

Public authority

  • SFUD public headers at the frozen base: initialization, read, mode-selection, erase/write, status API and error enumerators. The existing extended-mode table defines supported read preferences and the callback format for this port.
  • Macronix MX25L3206E PM1568 revision 1.5: Table 2 block-protection regions, command definitions, WREN/RDSR/WRSR descriptions, erase/program behavior. Official indexed text confirms WREN before register writes, nonvolatile BP3:BP0 and protected writes being ignored. Full-PDF retrieval from the vendor was unavailable during authoring; the relevant vendor-indexed clauses were accessible.
  • Winbond W25Q256FV revision F, April 29, 2013: manufacturer-authored datasheet hosted by its distributor; sections 6.1.5, 8.1.2 and 8.2.10–8.2.18 distinguish active addressing modes, 03h/13h and the dual/quad instructions. The full PDF was accessible.
  • The public contract states which board-port assumptions are software integration requirements: full-array ownership of the MX profile, synchronous completion, no alternate-byte phase and supported configured fallback profiles. These are supplied openly rather than inferred from hidden hardware.

Behavior checks and authority mapping

check.py prepares 112 deterministic scenarios and compares 142 rows of observations. Each row contains API return codes, a public status-register observation, invalid bus-command observations and returned data. It never inspects SFUD's internal initialization flags, static helpers, object layout or algorithm. It does not enforce counts of polling, reset, write-enable, lock or read transactions.

Check item Public basis
Supported, discovered and port-configured devices initialize successfully docs/storage-contract.md:3, sfud/inc/sfud.h:47
MX block protection is cleared for initial values 00h, 04h, 1Ch, 20h, 3Ch and 80h docs/storage-contract.md:5, :17; Macronix Table 2 / RDSR / WRSR
Unrelated page-program devices retain their protection policy docs/storage-contract.md:5
Failed MX WREN or WRSR preparation returns failure, with no required choice among nonzero SFUD errors docs/storage-contract.md:7, sfud/inc/sfud_def.h:193
Protected MX updates erase and program the requested data; single-byte and multi-page sizes including 1, 5 and 258 bytes are covered docs/storage-contract.md:5, :15, :19
Separate erase/write and combined erase-write preserve data at page/sector boundaries and return correct surrounding bytes docs/storage-contract.md:15, sfud/inc/sfud.h:118
SST byte/AAI word writes remain usable for 1, 7 and 510 bytes crossing page/sector boundaries docs/storage-contract.md:17, sfud/inc/sfud_flash_def.h:132
Array bytes are returned through ordinary and dual/quad configurations at maximum widths 1, 2 and 4 docs/storage-contract.md:9, :11, :13
16 MiB threshold, high addresses in 32/64 MiB devices and the last valid byte retain address/data meaning docs/storage-contract.md:9, :11; Winbond 6.1.5, 8.2.10–8.2.11
Missing extended-mode entry falls back to ordinary reading at each maximum bus width docs/storage-contract.md:9, :21
Repeated mode changes on the same initialized descriptor preserve reads docs/storage-contract.md:9
Out-of-capacity reads and writes return the documented boundary error docs/storage-contract.md:15, sfud/inc/sfud_def.h:199
Bus callbacks receive valid command, address and phase semantics; no invalid-command observation is accepted docs/storage-contract.md:11, :13, :17, :19; public support/virtual_flash.c

The header API's size argument permits zero, but this task does not add a new zero-size contract or test for it. There are no hidden required operation counts. Both 13h with its explicit 32-bit address and valid 03h in active 4-byte mode are accepted; the latter is calibrated as a valid alternate solution. Non-protection MX status bits may be preserved.

Fixtures

Fixture Expected Meaning
gold PASS Both complete upstream code patches
template FAIL Frozen defects
noop FAIL Reports successful reads without writing the buffer
cheat FAIL Returns all-FF bytes instead of reading storage
cheat_read_grader FAIL Isolation calibration
only_protection FAIL Complete A patch only; ordinary large-device read still fails
only_read FAIL Complete B patch only; initialization protection defect remains
mask_status FAIL Applies preparation only to the reported 1Ch status; other initial policies fail
valid_alternative PASS Switch-based ordinary-read mapping; independent preparation control flow preserving unrelated MX status bits
valid_spi_fallback PASS Uses 03h in active 4-byte mode for ordinary SPI reads; fast modes retain upstream mapping

Isolation, observations and acceptance

verify.py is an exact copy of rollout/bos_verify.py. check.py plus the non-Python build_inputs.json are the only private attachments. The trusted checker reads all fixed support and candidate bytes, creates all build inputs and constructs all scenario/expectation data before its first candidate-controlled compiler process. It then only starts UID-65534 compiler/observation subprocesses and compares captured output. It never revisits scratch paths after the compiler starts. Expected data and verdicts stay in the checker; the candidate-linked observation main only prints observed values.

The model is a supplied SPI/QSPI port interpreting publicly described NOR commands; it does not implement the SFUD API or contain either driver fix. No board code, real timing or networking is required. This establishes deterministic software behavior, not physical flash certification.

Both public smoke and repro were executed only in a unique trace6 Docker container with --network none and --rm. Frozen smoke printed equal=1; its repro printed equal=0 and archive return 3. Gold printed equal=1 and archive return 0.

The final calibration uses the pinned trace6 digest and all ten classes five times each. Paths, current task digest, trial outcomes and cleanup evidence are recorded in factory/20261102-D-oss-fix-26/subagents/sfud-4b41297/report.json. The initial full calibration is preserved separately; a checker-compatibility relaxation and a stronger valid variant required a fresh final calibration. The root agent owns the full repository unittest run and independent admission review. No model trial, difficulty classification or hardware validation is claimed.