Files
STM32F4-Base/App/protocol/iec60870/IMPORT.md
T
wandering1 2e9272cc8a feat(iec104): 在模拟器跑通共享协议核心与标准DTU点表
引入成熟 IEC 60870-5-104 子站的只读子集(App/protocol/iec60870,28 个源文件
按原字节复制,UPSTREAM.sha256 记录来源,兼容补丁保留全部断言与容量),在其上
装配单属主共享核心(Start/Poll/Stop/Get_Status),并把标准 DTU 演示点表全量
接入为唯一真源。

- iec104_core:threadless 推进,poll 零等待,通知/交互/COV 扫描全部有界;
  生命周期区分失败启动待重试、重复启动拒绝、断线保固化 RAM。
- iec104_dtu_table / iec104_source:标准 DTU 全点表注册,无数据源的点读 0,
  遥控只做模拟状态可读回,不触碰实际出口。
- iec104_sim:仅窗口与独立服务模式起真实 TCP,无头黄金模式保持确定性假统计。
- test/host/iec104_dtu:独立真实 TCP 11 项、传输层 10 项、生命周期与借用负例。

验证:lvgl_sim 真实 TCP 11/11、传输 10/10,UI 像素回归未回退;AC5 单 TU
编译 0 错误 0 诊断。板端尚未切换:完整库闭包 RAM 超 92% 门禁净增预算 25730B,
结论为停止转实施,记录在 IEC104_MCU最小可行性验证.md。旧实现与 board 服务
保持原样,未提交 MDK 工程改动,未烧板。
2026-11-17 20:48:00 +08:00

3.9 KiB

IEC60870-Slave product subset

Source: repository IEC60870-Slave/ at baseline f84855a5.

The source directory is retained as the independent validation baseline. Only this product subset is to be compiled into the replacement product target. No example main is included. Copying is byte-preserving; source hashes are recorded in the directory manifests before local compatibility edits.

Verification status

Check Status
Original byte provenance UPSTREAM.sha256; independent final 84-file check passed, six controlled source differences
C99 assertions 43 original invocations unchanged; independent AC5 true passes / false fails, invalid capacities including SOE128 rejected
Final compiler diagnostics Independent AC5 default/compact: 62 translation-unit compilations, RC0 and zero diagnostics; simulator and runtime tests tracked separately
Static memory / runtime integration Separate build-verifier and integration task evidence; no board runtime claim
License No license grant confirmed; redistribution not authorized by this import

Required scope: APCI transport, GI/CI, spontaneous/periodic measurements, commands, clock synchronization, read, standard parameters and Type200-203. History, recording, file storage and firmware-upgrade backends are not imported; product integrations must reuse existing subsystems. Organizational source import is not a rename; baseline paths remain unchanged. Local edits use the Edit tool only.

Local patches

  • Added common/IEC60870_StaticAssert.h, included by shared Types and the standalone Net header. In pre-C11 C, each existing assertion expands to a line-unique typedef with array bound (condition) ? 1 : -1; false assertions are compile errors. C11 targets retain native assertions. All 43 assertion invocations and their conditions/messages remain unchanged, including SOE=256.
  • 104/IEC104_TcpServer.c: two explicit IEC104_TcpEventType_t casts when expanding the byte-sized ring header into event validation helpers; no condition, capacity, storage layout or runtime behavior is changed.
  • 104/IEC104_SendManager.c and 104/business/IEC104_Spontaneous.c: convert nonnegative enum range checks to unsigned upper-bound comparisons. Invalid negative values still convert above the valid range and are rejected; AC5 no longer diagnoses pointless unsigned comparisons against zero.
  • 104/business/IEC104_Command.h: mask each TYPE_BIT shift count with 15. Selected valid branches already use shifts 0..13; range guards still return zero for unsupported types. This avoids MSVC diagnostics about unsigned underflow in unselected conditional branches, not a proven executed runtime UB.
  • Added common/IEC60870_FaultEvent.c as an exact-copy link dependency of IEC104_Spontaneous_Publish_Fault_Event, with Lead authorization.
  • UPSTREAM.sha256: 84 original byte hashes (29 implementations, 54 directory headers and the declarative profile header). Paths are relative to this directory and to IEC60870-Slave/; hashes describe upstream bytes, not the six locally patched files. The compatibility header is new and not upstream.
  • Independent hash/diff and AC5 true/false assertion verification is performed by build-verifier; product integration and simulator build have separate owners.

License

No license grant has been inferred. The baseline license must be checked before redistribution outside this authorized project integration.

Layout

  • common: shared ASDU, information-object codecs and time representation.
  • 104: mature transport and business state machines.
  • examples: DTU declarative point-profile header only, never an example main.

The board network backend is a later integration task; importing this subset does not by itself remove dependencies of the current board service.

Resource capacities must be measured before adjustment. No assertions, quality gates, stack limits or compiler diagnostics are disabled by this import.