Files
STM32F4-Base/MDK-ARM
wandering1 515db819ab feat(ui): fold board inputs and outputs into the telemetry page
The 12 board-level rows now live at the end of the 遥信量 page instead of
a separate 开入开出 page: 8 opto inputs (DI_A..DI_H) and 4 relay outputs
(KO6/TRIP/ERT/CLZ). 33 rows become 45, five pages become six. The
standalone page, its menu entry, its golden references and both build
registrations are removed.

Folding the display is not folding the point table. The board rows
render from dio_di_* / dio_do_* and stay out of yx_bits / yx_valid /
yx_dp: any change to those carriers is provably absent from this diff.
IEC 104 mapping and YX_VALID_MASK are untouched, so nothing new is
reported to a master station.

Input polarity was wrong and is fixed here. On this board a 24 V input
drives the opto, which pulls the 74HC165 pin LOW, so the raw mask is
inverted relative to "has signal". The bit assembly only reordered bits;
nothing converted the level. The screen showed 分 on every channel no
matter what the operator drove in. Polarity now converts once, in the
driver, behind IOBOARD_DI_LEVEL_ACTIVE (0 = active low), so callers see
1 = has signal for both inputs and outputs.

Verified on the board: page 5 shows YX33 followed immediately by DI_A,
crossing the 33-point boundary with no drift; DI_C reads 合 because the
operator's signal is on channel C, the other seven read 分; page 6 shows
DI_H then all four outputs 释放. Page rows end at y=134, the footer
starts at y=144.

Input bit order is only partly verified: channel C was confirmed against
a real signal, the other seven have not been exercised channel by
channel. The board detects the presence of 24 V, not contact closure,
and the output rows show the shadow register (our intent) rather than
mechanical contact feedback. All three limits are recorded in the page
header and in the IOBOARD README.

Also adds a polarity guard to the host tests: the input polarity was
flipped once already, and until now no assertion would have caught a
silent re-flip, since only the DO side was pinned.
2026-11-16 23:30:35 +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