Files
STM32F4-Base/test/board
wandering1 cc7f17f231 fix(dwt): stop resetting CYCCNT, a counter six modules share
Three of the six DWT CYCCNT users wrote the counter to zero on init:
console_log, net_latency_test and ch395f_reuse_bench. Every one of them
only ever takes the difference (CYCCNT - t0) against a local snapshot, so
the reset bought nothing and instead caused a bogus ~2^32 delta for
anyone who sampled across it. That delta trips the task_prof glitch guard
(TASK_PROF_GLITCH_CYC = 10 s worth of cycles), which discards the sample,
so a whole worst-case measurement could vanish silently.

All three call sites now leave the counter alone; the shared contract is
"enable only, never reset", documented at each of the six users. The
documented behaviour in the link latency test guide (section 4.3) is
updated to match.

Net source change is three deleted lines, no new executable code.

Verification:
- grep for a zero assignment to CYCCNT across the tree: no hits left.
- Keil build: Code=257932 RO-data=32108 RW-data=2104 ZI-data=152688,
  0 errors 0 warnings.
- Host unit tests: console_log 153/153, task_prof 27/27, ioboard 100/100,
  sb_link 164/164.
- Four console_log assertions pinned the absolute number of DWT register
  touches; dropping the reset write lowers it by one, so their expected
  counts move from 3 to 2 (and 4 to 3 for TC-CONLOG-093). The test text
  now says why the third write disappeared.
- check_doc_links: 6 known issues, unchanged from baseline.
2026-11-16 19:58:44 +08:00
..

test/board/ — 板端测试套件

⚠️ 编入固件的测试代码(由 testTask 执行)。这些 .c 已注册到 Keil 工程 MDK-ARM/STM32F4-Demo.uvprojx,占用 MCU 的 RAM/Flash。

文件一览

文件 测试对象 / 作用
test_config.c/h 测试任务配置:TEST_SUITE_* 套件选择开关(互斥)+ ENABLE_DESTRUCTIVE_TESTS
test_common.h 公共断言内核:test_stats_t + TEST_CHECK_IMPL/TEST_REPORT_IMPL;各套件用一行宏绑定自身统计变量
ch395f_test_task.c/h + ch395f_test.h CH395F 以太网(硬件层 Phase 15 / NET 层 Phase 611)
gd5f_test_task.c/h + gd5f_test.h GD5F2GQ5UE SPI NAND 存储
sd2506_test_task.c/h + sd2506_test.h SD2506 RTC
storage_test_task.c/h + storage_test.h 存储性能
net_test_task.c/h 网络层测试
net_latency_test.c/h 链路时延探针(DWT CYCCNT 时基,MCU 专属)

⚠️ 构建约束(详见本节与 test_config.h)

  • 套件互斥:test_config.h 的 TEST_SUITE_CH395F/STORAGE/GD5F/RTC 一次只能启用一个 (违反则 #error);全部注释 = 产品构建
  • ⚠️ 测试固件不得静默提交:TEST_SUITE_* 开关受 pre-commit 钩子 test-suite-switch 门禁——默认要求全部注释。跑完套件回归务必改回产品构建再提交(2026-10-01 实测已提交 HEAD 里 TEST_SUITE_CH395F 就是开启状态,纯靠人记得改;故补此门禁)。确需提交测试构建时用 ALLOW_TEST_BUILD=1 git commit ... 或 python scripts/check_test_suite.py --allow-test-build 显式放行
  • 破坏性用例默认关闭:ENABLE_DESTRUCTIVE_TESTS(默认注释)控制写/擦 NAND、格式化、 坏块注入。关闭时为只读模式(横幅 mode: READ-ONLY),可随时在在用设备上跑
  • ⚠️ 实测一轮破坏性 GD5F 运行即让 dhara 多记一个坏块(容量下降且需全片擦除恢复)—— 只在产线首启或明确需要时打开
  • CH395F 套件:硬件层与 NET 层模式互斥
  • 总线独占:CH395F 硬件层模式下 netTask 自挂起,testTask 独占 CH395F

添加新测试套件

  1. 在 test_config.h 加开关(并入互斥 #error 检查)
  2. 新建 <模块>_test_task.c/h
  3. 注册进 Keil 工程(<FilePath>..\test\board\xxx.c</FilePath>)
  4. 跑回归:/serial-boot-test(.dsh/skills/serial-boot-test/scripts/run_boot_test.py)

相关文档

  • 测试指南:docs/测试说明/板级测试/CH395F_Test_Guide.md、GD5F2GQ5UE_Test_Guide.md、SD2506_Test_Guide.md、FTP_Test_Guide.md
  • 套件配置:本节「构建约束」+ board-test-suite skill(套件互斥、破坏性开关代价、跑后恢复产品构建)
  • 容量恢复:docs/测试说明/专项验证/存储维护与容量恢复.md