Files
STM32F4-Base/Drivers/BSP
wandering1 6e0755f971 feat(ioboard): make KO_24V an auto relay supply enable (9 channels)
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.
2026-11-18 19:34:47 +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