Files
STM32F4-Base/Drivers/BSP
wandering1 12e0617909 fix(gates): close the BOM gate hole that let new files skip the check
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.
2026-11-16 23:59:49 +08:00
..

Drivers/BSP/ — 板级支持包(纯手工自研代码)

本目录全部为手工编写的板级驱动与中间层(非 CubeMX 生成、非第三方库、非 ST HAL)。 每个芯片/子模块一个子目录。改驱动前必读对应模块的 Trap Records(见下)。

子模块一览

目录 芯片/模块 接口 职责 关键文档
CH395F/ CH395F 以太网控制器 SPI2 以太网 MAC/PHY 控制器底层驱动 docs/问题记录/CH395F_Trap_Records.md
GD5F2GQ5UE/ GD5F2GQ5UE SPI NAND SPI1 NAND 驱动 + FTL(nand_ftl.c) docs/问题记录/GD5F2GQ5UE_Trap_Records.md
TPAFE5160/ TPAFE5160 高精度 ADC 并行 16 位 ADC 采样驱动(CONVST/BUSY 时序) —
SD2506/ SD2506 RTC I2C 实时时钟驱动 docs/问题记录/SD2506_Trap_Records.md
RS485/ RS-485 半双工 UART5 收发方向控制(DE 引脚)+ 时序 —
NET/ BSD Socket 网络抽象层 — Socket API + select + 轻量 FTP 服务器 docs/网络/(含 Net层阻塞模型架构设计.md)
NETCFG/ 网络配置 — /config.ini 网络段的加载/保存 docs/子系统设计/网络配置说明.md
UI/ LVGL UI 组件 — 菜单/内容页/组件/中文字体 docs/UI设计/

根级文件

文件 作用
dbg_log.h 调试日志宏(DBG_INFO 等),编译期开关
dbg_cfg.h 调试配置项
app_assert.h 模块级轻量断言宏(APP_ASSERT):编译期两态裁剪(默认关闭 = 零符号零开销;打开态与 configASSERT 共用同一个失败钩子)。试点见 Drivers/BSP/NET/net_socket.c

子模块 README

⚠️ 改驱动前必读(踩坑速查)

模块 陷阱
CH395F SPI 事务须 ch395f_spi_begin()/end() 包裹;分频系数必须为 8(PCB 约束,勿"优化");快速复连会因事件被读清消费致监听死亡(TRAP-NET-17 已修,E14 复核:非芯片丢事件);上传中止后首笔复连截断(TRAP-NET-18 已修)
GD5F2GQ5UE FatFs 移植版打开模式陷阱(FA_OPEN_APPEND 不含写位);文件名严格 8.3 短名、不得以点开头;f_write 簇分配失败返 FR_OK + 短写,须校验字节数
NET 就绪屏障位必须 osFlagsNoClear;s_net_errno 已按任务隔离(勿改回全局)
通用 自研代码禁用 C 库堆分配(MicroLIB 堆仅 512 B),动态内存只用 pvPortMalloc/vPortFree

完整平台约束的落点:隔离与错误码语义 → .dsh/roles/network-specialist.md(网络)/ .dsh/roles/storage-specialist.md(存储);中断与吞吐细节 → docs/网络/网络自愈架构设计.md、docs/架构设计/STM32F4-Base存储架构说明.md;C 库堆禁令 → docs/门禁说明/coding-standard.md。另见各模块的 Trap Records。

相关文档

  • 架构全景:docs/架构设计/项目架构总览.md
  • 存储栈:docs/架构设计/STM32F4-Base存储架构说明.md
  • 测试指南:docs/测试说明/板级测试/*_Test_Guide.md