12e0617909
The BOM gate claimed to stop BOMs from being stripped, but it only ever inspected files that were already tracked AND already had a BOM. A new file under a BOM-listed directory could be born without one and never be noticed, because the scan never returned it and, even if it had, the "no HEAD version" branch skipped it. Editing a listed file and losing its BOM is a real accident that already happened once; creating one without a BOM was the same accident with no safety net at all. Measured before and after on the same untracked file with no BOM: before: checked 101 files, no drift, exit 0 after: FAIL, names the file, exit 1 The count of 101 was itself the symptom: with one more file present the honest number is 102. The old code was not "silently passing a clean tree", it was not looking. The scan now includes untracked files, and a listed file with no HEAD version must carry a BOM. Files that are tracked without a BOM keep their historical pass so this does not flood existing code with failures; instead the two that were listed but had no BOM were given one so the list means what it says. That exposed a conflict nobody had hit yet. The font file is generated, and the generator rewrites it from scratch on every run, so a hand-added BOM survived until the next regeneration and then vanished. The BOM gate and the generated-fresh gate could not both pass. The generator now puts the BOM back as its last step, idempotently, so the two gates agree and the whole UI directory keeps its uniform encoding. Font content is untouched: everything after the first three bytes is byte-identical. The menu generator gains a real read-only mode. It previously had no options at all and always rewrote its outputs; the arrows it printed were accurate. That made it easy to mistake for a checker, since an unchanged tree produces identical bytes and looks untouched. --check now reports up to date or stale without writing anything, and the registration tables are checked the same way. Default behaviour and output are unchanged. The telemetry page header no longer restates the board's input hardware facts. They live in the IOBOARD README, which is where the board's electrical behaviour belongs; the page keeps only what it alone can say: that the output rows show the shadow register rather than contact feedback, why an invalid sample draws -- instead of 分, and that these twelve rows are not in the point table. One fact, one place. The team rule for experiments now requires the file hash, the located line number, and both runs. A report once cited a line number that did not exist in the final file, which left no way to confirm which version had actually been tested.
App/ — 应用层
自研代码(非 CubeMX 生成、非第三方库)。本目录是项目的应用层:任务编排、业务逻辑、 日志与配置引擎、工具函数。所有文件遵循
docs/代码规范/嵌入式C语言代码规范_V1.0.md。
职责
Src/main.c(CubeMX 初始化)→ app_main_init(本目录 app/app_main.c)→ osKernelStart →
6 个 FreeRTOS 任务(见 task/)。osKernelStart 之前全是内核启动前代码,禁止调用任何
FreeRTOS/CMSIS-RTOS API(本条与「就绪屏障位必须 osFlagsNoClear」的理由 → docs/子系统设计/控制台单写者日志设计.md §2.5 与 docs/架构设计/项目启动顺序管理.md)。
目录结构(按职责分层)
| 目录 | 内容 | README |
|---|---|---|
app/ |
应用入口与全局:app_main.c/h(初始化入口)、app_cfg.h(裁剪决策占位说明,当前无宏)、sys_events.h(就绪事件) |
app/README.md |
cfg/ |
配置引擎:/config.ini 解析 + 原子持久化(旧二进制档已废弃,2026-10-10) |
cfg/README.md |
sync/ |
时间同步任务:time_sync.c/h |
sync/README.md |
algo/ |
采集与算法层:语义取数 + 有效性判定 + 采样环/相量/测频 + 定值模型 + 保护元件框架 | algo/README.md(索引);设计 → docs/算法/采集与算法层设计说明.md |
log/ |
日志子系统:syslog(NAND)+ 控制台单写者日志 | log/README.md |
task/ |
FreeRTOS 任务实现(6 个任务) | task/README.md |
util/ |
通用工具:CRC / 环形缓冲 / 墙钟时间 | util/README.md |
protocol/ |
通信协议(预留,当前为空) | protocol/README.md |
关键约束
- 配置引擎单任务收敛:
cfg/为静态态、属主是 defaultTask;UI 保存请求经SYS_EVT_CFG_SAVE事件唤醒,netTask/uiTask 不得直接触碰配置引擎 - syslog 唯一写者:
/log/*只由 defaultTask 写入 - 新增任务/缓冲/栈前必须先核算 RAM 余量(
docs/内存管理/)
相关文档
- 架构全景:
docs/架构设计/项目架构总览.md - 启动顺序:
docs/架构设计/项目启动顺序管理.md - 配置引擎:
docs/子系统设计/配置文件设计.md - 日志:
docs/子系统设计/控制台单写者日志设计.md、docs/子系统设计/运行与自检记录设计.md