Files
STM32F4-Base/App
wandering1 e4981aa2f6 refactor(docs): point entry-file references at their new homes
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.
2026-11-16 19:38:27 +08:00
..

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