Files
STM32F4-Base/MDK-ARM
wandering1 2b466b85f0 feat(ui): add DI/DO status page showing 8 inputs and 4 outputs
New read-only content page under 实时数据 → 开入开出 showing the board's
8 opto inputs (DI_A..DI_H, 合/分) and 4 relay outputs (KO6/TRIP/ERT/CLZ,
吸合/释放) as a 12-row list, 8 rows per page, 2 pages.

Data path reuses the existing de-bounced input poll instead of adding a
second hardware reader:

  defaultTask (50 ms) → ioboard_di_snap_publish() → de-bounced snapshot
    → ioboard_di_snap_lookup()  [new registration channel]
    → ui_data_feed_tick() (uiTask, 200 ms)
    → ui_data_rt_t.dio_di_* / dio_do_*

No new critical sections, no new hardware access on the UI path. Outputs
come from the volatile shadow register (a memory read, no lock).

Semantic honesty, recorded in ui_page_di_do.c and README §6:
  · Output state is the software shadow register (ODR mirror), NOT a
    mechanical contact feedback — this platform has no auxiliary contact
    readback path. ioboard_do_read_level() also reads ODR, so comparing
    the two is tautological.
  · IOBOARD_DO_LEVEL_ACTIVE polarity has not been checked against the
    schematic.
  · Input bit order has not been verified by manual shorting. The
    2026-11-16 run read 0x00 eight times because the operator had no time
    to short each channel — the data path itself was fine.
  · Board-level inputs are deliberately kept out of the 33-point telemetry
    bitmap (IEC 104 point-table semantics); the two have no mapping.

Invalid snapshots render "--", never 合/分 or 吸合/释放: painting "no data"
as "all inputs released" would tell the field the inputs are open when we
simply failed to read them.

Board-verified 2026-11-16: page 1 shows 分 on all 8 inputs, page 2 shows
释放 on all 4 outputs, page footer and paging correct. Input bit order
still pending manual shorting.

Also: regenerate ui_font_cn_12 for 吸/释, add golden references for both
pages, align check_menu_rows.py L2 geometry with the now-4-item submenu,
and register the new source file in both the Keil project and CMake.

Reviewed independently; zero blocking findings.
2026-11-16 21:45:08 +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 的根因(CODE-RULE-20,依据与豁免 → docs/门禁说明/coding-standard.md)

相关文档

  • 烧录/复位:docs/测试说明/测试工具/ST-LINK_CLI_复位使用说明.md
  • 构建与验证:keil-build skill(.dsh/skills/keil-build/SKILL.md,含 exit 2 三种分型与 "0 错误 0 警告" 判定)
  • 测试流程:docs/测试说明/流程与规范/自动化测试流程.md