10323c4c22
Bench verification of the IO board needs an observation window: production build has no consumer of ioboard_di_snap_read(), so the DI values were invisible. Add TEST_SUITE_IOBOARD as a semi-automatic bench sequence and fix two real bugs found while wiring it in. New files: - test/board/ioboard_test.h, test/board/ioboard_test_task.c Test suite: - Owns its own thread (iobTest, 4096 words) instead of running in testTask: testTask is osPriorityBelowNormal, below defaultTask whose 1ms console drain loop can starve a blocking wait in a lower priority context. - Phases: bit-order self-check, DI eight-point bijection, DO point-by-point toggle with operator confirmation, release-all on every exit path. - Only exit is ioboard_release_all(); it is called from the entry guard, every phase failure, the write-failure branch and the thread tail. - Sample window is 20 reads x 2ms = 40ms and does overlap the 50ms production poll. That is stated as harmless in the header: the driver wraps the whole read in taskENTER_CRITICAL (26us, not the whole 40ms), both sides only read, and a torn cross-reader sample is caught by the debounce layer rather than acted upon. default_task.c fix: - DEFAULT_TASK_DI_PUBLISH_EN was defined twice: once at file scope and once inside default_task_func(). #define has no scope, so the second was a redefinition of the first. Collapsed to a single authoritative site. - Add TEST_SUITE_STORAGE to the disable list: the STORAGE suite owns the file system via testTask, and default_task_di_poll() referenced four statics that live inside an !TEST_SUITE_STORAGE block, which broke the STORAGE build with 11 errors. - Shrink the !TEST_SUITE_STORAGE block to cover only default_task_net_cfg_save_notify() and move the three declarations out; move edges/fails into the #else branch so the empty branch references none of the four statics. Registration and gates: - MDK-ARM/STM32F407-Demo.uvprojx and simulator/CMakeLists.txt entries. - scripts/check_test_suite.py: whitelist TEST_SUITE_IOBOARD. - scripts/stack_report.py: let a self-started thread that is not declared in Src/freertos.c osThreadAttr_t still be budget checked. - test/run_all_suites.py: bring the suite into the orchestrator view. Verified: six-build matrix all 0 errors 0 warnings. CH395F/STORAGE/GD5F/RTC and the product build are bit-identical at Code=257936; the IOBOARD build is Code=264640 (+6704), which is the evidence that the suite really enters the image. Host unit tests 100/100, stack report 1760/4096 words (57%).
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(见 AGENTS.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