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.
This commit is contained in:
2026-11-16 19:38:27 +08:00
parent ab20302999
commit e4981aa2f6
134 changed files with 276 additions and 212 deletions
+3 -3
View File
@@ -42,7 +42,7 @@ C_KEYWORDS = {'if', 'for', 'while', 'switch', 'do', 'else', 'return',
NAME_PAREN_RE = re.compile(r'([A-Za-z_][A-Za-z0-9_]*)\s*\(')
# CODE-RULE-20 的例外:平台分配后端的**宿主侧实现**(AGENTS.md「只用 pvPortMalloc/vPortFree,
# CODE-RULE-20 的例外:平台分配后端的**宿主侧实现**(口径「只用 pvPortMalloc/vPortFree,
# 或把分配收进平台后端」说的就是这种收口点)。只点名到文件 + 只放行这两个函数名,
# 不做目录级豁免——新增一个想 malloc 的文件必须显式加进这里,评审时看得见。
HEAP_ALLOC_ALLOWLIST = {
@@ -291,14 +291,14 @@ def check_file(path):
# CODE-RULE-19 (4.4.2) 函数定义左大括号必须与右括号同行
# CODE-RULE-20 (平台约束,2026-10-23) 禁止 C 库堆分配
# 出处**不在规范 V1.0**(其 §6.1 示例本身就写着 malloc/free,属通用 C 模板遗留,已同日在示例
# 下方加"本仓禁止"批注),而在 AGENTS.md「平台约束」+ docs/内存管理/RAM使用分析与优化方案.md:
# 下方加"本仓禁止"批注),而在本脚本的 FORBIDDEN 名单 + docs/内存管理/RAM使用分析与优化方案.md:
# MicroLIB 的 C 堆由 startup_stm32f407xx.s 的 Heap_Size EQU 0x200 限定为 **512 B**,KB 级分配
# 必然返回 NULL,而**模拟器(宿主 CRT 堆)完全正常、照不出来** —— 典型"只有真机才炸",必须机器拦。
# 判据细节(三条都是踩过坑之后定的):
# - 大小写敏感:pvPortMalloc / vPortFree(唯一允许的配对)不会中招;
# - 词边界 \b:dhara_nand_is_free(、buf_alloc( 这类"同形后缀"的自有函数名不会误报;
# - 跑在 masked 上:注释与字符串字面量里提到 malloc 不报(规范示例就是这种命中)。
# 覆盖名比 AGENTS 列的五枚多带上 strndup / aligned_alloc —— 同族同类,漏一个就等于留个后门。
# 覆盖名比口径列的五枚多带上 strndup / aligned_alloc —— 同族同类,漏一个就等于留个后门。
norm = path.replace('\\', '/')
allow = frozenset()
for suffix, names in HEAP_ALLOC_ALLOWLIST.items():