Files
STM32F4-Base/App
wandering1 da66c500ea fix(console): gate adcTask logs on console-writer readiness
B1 on-board closed loop surfaced a byte-level console interleave: before
the console writer (defaultTask) registers, con_append() routes to
dbg_console_write_raw() -> con_tx_bounded(), which is register-level
polling with no mutual exclusion. adcTask logged every 1 ms, so its
first-frame line collided with defaultTask's [NAND_FTL] init line and
the required marker spanned two interleaved lines -> false FAIL.

- console_log: add dbg_console_writer_ready() (returns s_con_writer_up)
- adc_task: gate first-frame and 10 s stats logs on writer readiness;
  defer the first-frame report until the writer is up
- docs: close B1/P1-1 in the registry; flip stale "remaining @test"
  notes; correct the console doc's obsolete "drop-only, no interleave"
  claim (that held for HAL gState, not register-level raw send)

Bench (run_boot_test.py): VERDICT PASS, readback OK. adcTask
frames/seq +10000 per 10 s = 1000 Hz, idle=0, frst_err=0; stack
496/2048 (75%). @build 0/0.
2026-10-10 14:53:36 +08:00
..

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
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