Two comment-only follow-ups carried over from gate #33 (both deferred
by the reviewer to keep the accepted face frozen; no code, no size
impact - attestation restamped after a no-diff rebuild):
- Drivers/BSP/IOBOARD/README.md item 6: the "what I last asked for"
gloss of the software shadow register is exact for the 9 relay/LED
bits but not for bit6, which ioboard_do_get() reports as the
driver-synthesised supply state. Qualify it in place and point at
item 4 for the rule instead of restating it.
- test/host/ioboard/ioboard_test.c: the ACTIVE-level comment says the
polarity fact lives in README section 6 item 7; it has always been
item 5 (item 7 is the PE2/PE4 naming residue). This test is the
polarity pin, so a wrong cross-ref here is the worst place to
leave one.
KO_24V (PF4, bit6) is not an externally controllable output: it feeds
the other KO channels, so the driver now asserts it automatically
whenever any relay-class channel (bit0/1/2/3/7/8) is attracted, and
never for the three LED channels (bit4/5/9). Externally controllable
outputs become 9; physical bit map, DO_COUNT=10, DO_MASK_ALL=0x03FF,
k_do_pin[] binding, per-port BSRR segments and the uint16_t path are
unchanged.
- ioboard_do_write: clear the caller's bit6, synthesize it from
IOBOARD_DO_RELAY_MASK (0x18F), then one shadow store + one apply,
so bit6 changes in the same BSRR write as its GPIOF neighbours.
- ioboard_do_get: bit6 now reports the actual 24V supply state, not
an echo of the caller's write. Power-on release keeps PF4 low.
- board test Phase 3 derives expectations from RELAY_MASK (no second
truth table); the KO_24V row exercises "write ignored" and a new
auto-24V check verifies set-on-relay / drop-on-release.
- host contract test pins RELAY_MASK membership (excludes bit6 and
LED bits, union fills 0x3FF); 131/131 passed.
- docs: sync note v1.4 + BSP README unify the semantics (9
controllable + auto supply enable); stale "10 controllable" and
"24V interlock not implemented" wording removed; netlist-unknown
routing, PC15 backup-domain 3 mA limit and the missing auxiliary
contact remain documented as open facts.
Verified: Keil rebuild 0 error 0 warning (sizes identical to parent
wave), host unit tests 131/131, check_bsp_err / check_doc_links /
git diff --check clean. Board Phase 3 still needs a bench run.
Flat-expand the board output driver from 4 to 10 channels as decided:
IOBOARD_DO_COUNT 4->10, mask uint8_t->uint16_t, IOBOARD_DO_MASK_ALL
0x03FF. The 6 new pins keep their bit positions: KO_LED1=PF2(bit4),
KO_LED2=PF3(bit5), KO_24V=PF4(bit6), KO4=PF5(bit7), KO5=PC15(bit8),
KO_LED3=PE6(bit9); the original 4 (KO6/TRIP/ERT/CLZ) keep bit0..3.
Backups-domain PC15 is used as a signal bit only (+/-3 mA limit).
No 24V supply interlock and no LED special-casing: the driver writes
KO_24V as an ordinary bit; callers needing relay power sequencing must
assert it before energizing a channel. do_write/get/read_level and the
shadow register are all uint16_t; do_apply flushes four port segments
(GPIOC/GPIOF/GPIOC/GPIOE) and do_read_level caches three port ODRs.
UI: UI_DATA_DO_N 4->10, dio_do_mask uint16_t, UI_DATA_VER 3->4 because
dio_do_valid shifts 211->212; feed mask and dio row table extended;
content-page golden references regenerated for 51 rows / 7 pages.
Host ioboard tests 127/127 and ui_data tests 305/305 pass; Keil rebuild
0 errors 0 warnings. RAM ledger, memory snapshot and size attestation
refilled from the authoritative map. Docs: ioboard spec v1.2->v1.3 and
the resolved 6-pin question closed out.
The 12 board-level rows now live at the end of the 遥信量 page instead of
a separate 开入开出 page: 8 opto inputs (DI_A..DI_H) and 4 relay outputs
(KO6/TRIP/ERT/CLZ). 33 rows become 45, five pages become six. The
standalone page, its menu entry, its golden references and both build
registrations are removed.
Folding the display is not folding the point table. The board rows
render from dio_di_* / dio_do_* and stay out of yx_bits / yx_valid /
yx_dp: any change to those carriers is provably absent from this diff.
IEC 104 mapping and YX_VALID_MASK are untouched, so nothing new is
reported to a master station.
Input polarity was wrong and is fixed here. On this board a 24 V input
drives the opto, which pulls the 74HC165 pin LOW, so the raw mask is
inverted relative to "has signal". The bit assembly only reordered bits;
nothing converted the level. The screen showed 分 on every channel no
matter what the operator drove in. Polarity now converts once, in the
driver, behind IOBOARD_DI_LEVEL_ACTIVE (0 = active low), so callers see
1 = has signal for both inputs and outputs.
Verified on the board: page 5 shows YX33 followed immediately by DI_A,
crossing the 33-point boundary with no drift; DI_C reads 合 because the
operator's signal is on channel C, the other seven read 分; page 6 shows
DI_H then all four outputs 释放. Page rows end at y=134, the footer
starts at y=144.
Input bit order is only partly verified: channel C was confirmed against
a real signal, the other seven have not been exercised channel by
channel. The board detects the presence of 24 V, not contact closure,
and the output rows show the shadow register (our intent) rather than
mechanical contact feedback. All three limits are recorded in the page
header and in the IOBOARD README.
Also adds a polarity guard to the host tests: the input polarity was
flipped once already, and until now no assertion would have caught a
silent re-flip, since only the DO side was pinned.
New read-only content page under 实时数据 → 开入开出 showing the board's
8 opto inputs (DI_A..DI_H, 合/分) and 4 relay outputs (KO6/TRIP/ERT/CLZ,
吸合/释放) as a 12-row list, 8 rows per page, 2 pages.
Data path reuses the existing de-bounced input poll instead of adding a
second hardware reader:
defaultTask (50 ms) → ioboard_di_snap_publish() → de-bounced snapshot
→ ioboard_di_snap_lookup() [new registration channel]
→ ui_data_feed_tick() (uiTask, 200 ms)
→ ui_data_rt_t.dio_di_* / dio_do_*
No new critical sections, no new hardware access on the UI path. Outputs
come from the volatile shadow register (a memory read, no lock).
Semantic honesty, recorded in ui_page_di_do.c and README §6:
· Output state is the software shadow register (ODR mirror), NOT a
mechanical contact feedback — this platform has no auxiliary contact
readback path. ioboard_do_read_level() also reads ODR, so comparing
the two is tautological.
· IOBOARD_DO_LEVEL_ACTIVE polarity has not been checked against the
schematic.
· Input bit order has not been verified by manual shorting. The
2026-11-16 run read 0x00 eight times because the operator had no time
to short each channel — the data path itself was fine.
· Board-level inputs are deliberately kept out of the 33-point telemetry
bitmap (IEC 104 point-table semantics); the two have no mapping.
Invalid snapshots render "--", never 合/分 or 吸合/释放: painting "no data"
as "all inputs released" would tell the field the inputs are open when we
simply failed to read them.
Board-verified 2026-11-16: page 1 shows 分 on all 8 inputs, page 2 shows
释放 on all 4 outputs, page footer and paging correct. Input bit order
still pending manual shorting.
Also: regenerate ui_font_cn_12 for 吸/释, add golden references for both
pages, align check_menu_rows.py L2 geometry with the now-4-item submenu,
and register the new source file in both the Keil project and CMake.
Reviewed independently; zero blocking findings.
The suite ran on the bench and reset the target every 56 seconds, right
after the last Phase 3 assertion. Root cause was the suite itself: the
worker thread entry function returned instead of calling vTaskDelete.
Returning from a FreeRTOS task function is undefined behaviour, and on the
Cortex-M4F port the saved LR points at prvTaskExitError, so the return
trips configASSERT. This project routes configASSERT to
vApplicationAssertFailed, which resets the MCU. The assert banner never
reached the console because the reset happened 0.27 s after the last
line, while its bytes were still queued.
Two assertions were also wrong in ways that hid real state:
- The "which relay is commanded" mask was computed as MASK_ALL & ~bit,
i.e. the complement of what the comment claimed, so the suite reported
the three idle relays as commanded and failed every Phase 3 row even
though the shadow register was correct.
- The "other relays stay released" check was written as (a|b)==b, which
is the same predicate as "at least bit b set" and therefore duplicated
the check above it instead of testing the remaining channels. It now
asserts (active & ~only)==0.
Phase counters are also reset on entry to each phase. The report macro
only prints, so without a reset each phase summary carried every earlier
phase's failures and Phase 2 read 44/62 with no failures of its own.
Hard-coded 0x0F masks are replaced by IOBOARD_TEST_DO_MASK_ALL.
Bench result after the fix: the suite completes in about 54 s with one
reset cause line (boot only), and prints Phase 4, the final release check
and "IOBOARD Tests: 17/17 PASSED". Phase 2 moves to 21/21 and Phase 3 to
16/16.
Still unverified, and not claimed as passing: the eight DI channel order
needs a person to short the terminals, and the relay polarity needs a
person to hear the contacts. Note that ioboard_do_read_level reads ODR,
so the Phase 3 level assertions prove write intent propagation, not
electrical actuation.
Keil build with the suite enabled: Code=264880, 0 errors 0 warnings.
Product build after the suite switch is restored: Code=257932, unchanged.
Three of the six DWT CYCCNT users wrote the counter to zero on init:
console_log, net_latency_test and ch395f_reuse_bench. Every one of them
only ever takes the difference (CYCCNT - t0) against a local snapshot, so
the reset bought nothing and instead caused a bogus ~2^32 delta for
anyone who sampled across it. That delta trips the task_prof glitch guard
(TASK_PROF_GLITCH_CYC = 10 s worth of cycles), which discards the sample,
so a whole worst-case measurement could vanish silently.
All three call sites now leave the counter alone; the shared contract is
"enable only, never reset", documented at each of the six users. The
documented behaviour in the link latency test guide (section 4.3) is
updated to match.
Net source change is three deleted lines, no new executable code.
Verification:
- grep for a zero assignment to CYCCNT across the tree: no hits left.
- Keil build: Code=257932 RO-data=32108 RW-data=2104 ZI-data=152688,
0 errors 0 warnings.
- Host unit tests: console_log 153/153, task_prof 27/27, ioboard 100/100,
sb_link 164/164.
- Four console_log assertions pinned the absolute number of DWT register
touches; dropping the reset write lowers it by one, so their expected
counts move from 3 to 2 (and 4 to 3 for TC-CONLOG-093). The test text
now says why the third write disappeared.
- check_doc_links: 6 known issues, unchanged from baseline.
AGENTS.md stopped being the store of record for build steps, Python env,
hardware pins, doc conventions, log cost and task ownership. Those facts
already live in docs, skills and role files; the entry file now only
points at them. This commit moves every reference that used to name the
entry file to the authoritative landing point, so a reader who follows a
link arrives at the fact instead of at a sentence that no longer exists.
What changed is links and prose, not behaviour. Code, scripts and tests
only have comment and docstring lines touched; the only non-comment edit
in the whole changeset is one note string inside the generated pin table
JSON, and its generator was changed in the same step so the two stay
byte-identical.
New landing points created before the references were retargeted:
- The console single-writer log design doc, section 7.1, is now the single
authority for log cost: about 90 B flash and 216 B stack per DBG_ line,
and the rule that deep call chains must predefine DBG_LINE_BUF_MAX.
It also carries the full list of the twelve translation units that have
tightened it, plus the grep command that decides the truth if the list
and the code ever disagree.
- The document writing standard, section 2, now holds the BOM list.
- keil-build skill gains an exit code table: 0 success, 1 build failure,
2 BuildEnvError, 3 usage, 4 build lock held. This corrects a belief
that was never actually written down anywhere: exit 2 does not simply
mean environment error, argparse also exits 2 and the wrapper script
was remapped so the two no longer collide.
Regenerated and checked byte for byte:
- The end-to-end architecture SVG in docs/images from its generator.
- tools/netlist_semantics/pinout_kb.json from gen_kb.py.
Both are idempotent; running the generators again produces no diff.
Deliberately not touched, because machines read them:
- scripts/check_bom_drift.py joins every line containing BOM and asserts
four paths are present, so the entry file BOM line must stay one line.
- scripts/gen_task_table.py reads the TASK_TABLE anchors directly.
- scripts/rename_maps and scripts/archive keep their historical wording;
they describe what happened, not what is true now.
Verified: doc links report the same six pre-existing findings as the base
commit and no new ones, generated-fresh passes, bom drift is clean across
101 files, and AGENTS.md itself is unchanged in this commit.
Bench verification of the IO board needs an observation window: production
build has no consumer of ioboard_di_snap_read(), so the DI values were
invisible. Add TEST_SUITE_IOBOARD as a semi-automatic bench sequence and fix
two real bugs found while wiring it in.
New files:
- test/board/ioboard_test.h, test/board/ioboard_test_task.c
Test suite:
- Owns its own thread (iobTest, 4096 words) instead of running in testTask:
testTask is osPriorityBelowNormal, below defaultTask whose 1ms console
drain loop can starve a blocking wait in a lower priority context.
- Phases: bit-order self-check, DI eight-point bijection, DO point-by-point
toggle with operator confirmation, release-all on every exit path.
- Only exit is ioboard_release_all(); it is called from the entry guard,
every phase failure, the write-failure branch and the thread tail.
- Sample window is 20 reads x 2ms = 40ms and does overlap the 50ms
production poll. That is stated as harmless in the header: the driver
wraps the whole read in taskENTER_CRITICAL (26us, not the whole 40ms),
both sides only read, and a torn cross-reader sample is caught by the
debounce layer rather than acted upon.
default_task.c fix:
- DEFAULT_TASK_DI_PUBLISH_EN was defined twice: once at file scope and once
inside default_task_func(). #define has no scope, so the second was a
redefinition of the first. Collapsed to a single authoritative site.
- Add TEST_SUITE_STORAGE to the disable list: the STORAGE suite owns the
file system via testTask, and default_task_di_poll() referenced four
statics that live inside an !TEST_SUITE_STORAGE block, which broke the
STORAGE build with 11 errors.
- Shrink the !TEST_SUITE_STORAGE block to cover only
default_task_net_cfg_save_notify() and move the three declarations out;
move edges/fails into the #else branch so the empty branch references
none of the four statics.
Registration and gates:
- MDK-ARM/STM32F407-Demo.uvprojx and simulator/CMakeLists.txt entries.
- scripts/check_test_suite.py: whitelist TEST_SUITE_IOBOARD.
- scripts/stack_report.py: let a self-started thread that is not declared in
Src/freertos.c osThreadAttr_t still be budget checked.
- test/run_all_suites.py: bring the suite into the orchestrator view.
Verified: six-build matrix all 0 errors 0 warnings. CH395F/STORAGE/GD5F/RTC
and the product build are bit-identical at Code=257936; the IOBOARD build is
Code=264640 (+6704), which is the evidence that the suite really enters the
image. Host unit tests 100/100, stack report 1760/4096 words (57%).