Files
STM32F4-Base/App/app
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
..

App/app/ — 应用入口与全局定义

应用层的入口与全局定义:初始化编排、功能编译开关、跨模块的就绪事件定义。

文件一览

文件 作用
app_main.c/h 应用初始化入口 app_main_init:时间子系统优先 → RS485 → NAND → ADC → 诊断(在 osKernelStart 之前执行)
app_cfg.h 功能裁剪的决策占位说明——2026-10-22 起不含任何宏(原 3 个 APP_*_ENABLE 零消费点,已删;接回方法见该文件修改记录 v1.2)
sys_events.h 系统就绪事件定义(CMSIS-RTOS v2 Event Flags:SYS_EVT_NET_READY / SYS_EVT_STORAGE_READY / SYS_EVT_FTP_READY / SYS_EVT_TIMESYNC_READY 及命令位)

初始化顺序(app_main_init)

sd2506_init            // 时间子系统优先,使后续日志带时间戳
sys_clock_init         // 墙钟(RTC 故障降级并返回 -1 → 触发自检)
rs485_init
gd5f2gq5ue_init
tpafe5160_init
SD2506 诊断            // ID / 时间 / 温度 / 电池
tpafe5160_start_conv_irq  // 首次 ADC 转换

⚠️ 以上全部在内核启动前执行 → 禁止任何 FreeRTOS/CMSIS-RTOS API 调用 (osMessageQueueNew 等会杀死启动)。内核前日志走无锁静态缓冲(见 ../log/)。

相关文档

  • 架构全景:docs/架构设计/项目架构总览.md
  • 启动顺序与就绪屏障:docs/架构设计/项目启动顺序管理.md
  • 墙钟:docs/子系统设计/系统墙钟时间维护说明.md