Files
STM32F4-Base/MDK-ARM
wandering1 10323c4c22 feat(ioboard): board test suite for DI/DO, fix default_task conditional compile
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%).
2026-11-16 19:35:15 +08:00
..

MDK-ARM/ — Keil MDK-ARM v5 工程与构建/烧录/探针脚本

唯一工具链:Keil MDK-ARM v5(ARMCC,C99)。本目录含工程文件、启动文件、 命令行构建/烧录脚本,以及台架探针与判读脚本。

关键文件

文件/目录 作用
STM32F407-Demo.uvprojx Keil 工程文件(源文件清单、编译选项、目标配置)
STM32F407-Demo.uvoptx Keil 用户选项(调试器、断点等)
startup_stm32f407xx.s 启动文件(Heap_Size EQU 0x200(512B)在此限定)
.dsh/skills/stlink-flash/scripts/stlink_flash.py 复位/烧录/回读(ST-LINK_CLI 封装,见下;原 reset.bat 已于 2026-10-10 删除)

构建与烧录

# 编译(keil-build skill 的 keil_build.py;相对路径,勿用绝对路径)
& '.venv\Scripts\python.exe' .dsh\skills\keil-build\scripts\keil_build.py   # 退出码 0 = 0 errors, 0 warnings

# 烧录 + 复位运行(@download = stlink-flash skill)
& '.venv\Scripts\python.exe' .dsh\skills\stlink-flash\scripts\stlink_flash.py flash <文件.hex|.bin>

# 仅复位
& '.venv\Scripts\python.exe' .dsh\skills\stlink-flash\scripts\stlink_flash.py reset

⚠️ 烧录铁律

  • stlink_flash.py flash = ST-LINK_CLI -c SWD -P <文件> -Rst -Run——-Rst -Run 不可省略! 裸 -P 会报 Programming Complete,但目标核处于异常状态时写入并不落地(芯片内容不变)
  • 烧录后必须回读校验:ST-LINK_CLI -c SWD -CmpFile <文件> 0x08000000(No difference found 才算真写入)
  • 本机 3 线接线(nRST 未接),只重启不烧录用 stlink_flash.py reset

台架探针与判读脚本

脚本 作用
bench_verdict.py 台架判读(把运行结果判为 PASS/FAIL)
ftp_freeze_probe.py FTP 上传+回读哈希(真实路径冻结探针)——被 Trap 记录当作可信判据引用,保留;2026-10-22 起用设备账号登录(设备无匿名通道)
tcp_reconnect_probe.py TCP 快速复连探针(TRAP-NET-17)
audit_runs.py / audit_tcpclient.py 运行记录审计 / TCP 客户端审计
check_crecipe_content.py 检查创建配方内容

子目录

目录 内容
RTE/ Keil Run-Time Environment 配置
DebugConfig/ 调试会话配置
STM32F407-Demo/ 构建输出(.o/.axf/.map 等,产物不提交)
bench_diag/ 2026-10-22 删除:4 个一次性台架诊断脚本,全库零引用、且自设备启用 FTP 鉴权起就登录不上(需要时从 git 历史取回)
retracted_bench_20260922/ 已撤回的台架数据(存证)

⚠️ 注意

  • 工具路径经 DTU_* 环境变量解析(DTU_KEIL_UV4 = UV4.exe 完整路径,DTU_STLINK_CLI = ST-LINK_CLI.exe 完整路径;换机设变量即可,无需改脚本;契约见 docs/环境与部署/本地工具路径环境变量方案.md)
  • 本目录被 pre-commit 门禁排除
  • 启动文件的 Heap_Size = 512B 是自研代码禁用 malloc 的根因(见 AGENTS.md)

相关文档

  • 烧录/复位:docs/测试说明/测试工具/ST-LINK_CLI_复位使用说明.md
  • 构建与验证:根 AGENTS.md「构建与验证」章
  • 测试流程:docs/测试说明/流程与规范/自动化测试流程.md