# 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, seventeen locally differing files: twelve reviewed patches and five trailing-blank-line-only. The command-table patch spans two files in one directory (`IEC104_Command.h` and `.c`) and both are counted. The SOE-128 change touches `IEC104_TcpServer_Config.h` and `IEC104_AsduQueue.h` (capacity) plus `IEC104_TcpServer.c` (assert message text), with three comment-only corrections in `IEC104_Slave.h`, `IEC104_TcpServer.h`, `IEC104_Spontaneous.h` (stale "256" SOE wording fixed to 128, quantifiers only, semantics untouched; Lead decision 2026-11-18). | | C99 assertions | 43 original invocations remain; every assertion condition unchanged (one message text tracks the SOE capacity macro); 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 remain, and every assertion CONDITION is unchanged. The only message text that differs is the SOE guard's event count, which tracks the capacity macro this product sets to 128 (see below); on C99 the message is discarded by the shim, so no assertion semantics move with it. - `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` + `104/business/IEC104_Command.c`: mask each TYPE_BIT shift count with 15, and remove the per-point `common_address`. 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. The point table now sorts by IOA only; the instance binds its station CA on the first accepted request and `Find_Point` rejects any other CA before searching, so a CA mismatch still takes the unchanged unknown-IOA path. Point entry size drops from 12 to 8 bytes on ARM Compiler 5, letting the application hold the table in const Flash instead of static RAM. No capacity, SOE, ordering or acceptance semantics change; see `ci-artifacts/iec104-mcu-skeleton/core-trim/` for the element-wise and lookup equivalence probes. - 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 twelve locally differing files. The compatibility header is new and not upstream. - Trailing blank lines: five files (`common/IEC60870_Codec.c`, `common/IEC60870_InformationObjects.c`, `common/IEC60870_InformationObjects.h`, `common/IEC60870_InformationObjects_Internal.h`, `examples/iec104_dtu_profile.h`) differ from upstream by exactly one end-of-file blank line, removed by the repository's `end-of-file-fixer` pre-commit hook (it does not exempt this tree). Content normalized for that single line is byte-identical to upstream, and `verify_vendor.py` asserts as much: its `BLANK` class may only list such files, and a semantic edit carried into one of them fails the check instead of hiding behind the class. - SOE capacity: this product sets `IEC104_TCP_SOE_CAPACITY` and `IEC104_ASDU_SOE_MAX_CAPACITY` to `128U` (upstream `256U`) to fit the RAM budget, and the guard message text follows the new count. IEC 60870-5-101/104 does not specify SOE depth; the only numeric lower bound in play is the Swedish Svk TR02-04-04 ยง7.4.1 guidance of 100 entries, so 128 stays compliant. The assertion CONDITION (`SOE_CAPACITY == ASDU_SOE_MAX_CAPACITY`) is untouched, so the invariant it guards still holds. ## Capacity override surface (skeleton profile) Eleven per-module capacity macros are already wrapped in `#ifndef`, so a build may override them with `-D` **without editing any source file**. This is what keeps the MCU skeleton profile small while the simulator keeps every business module enabled. `verify_vendor.py` compiles both the default and compact configurations and would catch an undefined-macro regression, but note that no `-D` is baked into any source. | Macro | Default | File | | --- | --- | --- | | `IEC104_INTERROGATION_TASK_CAPACITY` | `4U` | `104/business/IEC104_Interrogation.c` | | `IEC104_INTERROGATION_EVENT_CAPACITY` | `4U` | `104/business/IEC104_Interrogation.c` | | `IEC104_SYSTEM_COMMAND_TASK_CAPACITY` | `4U` | `104/business/IEC104_SystemCommand.c` | | `IEC104_SYSTEM_COMMAND_RESET_CAPACITY` | `4U` | `104/business/IEC104_SystemCommand.c` | | `IEC104_PERIODIC_SCAN_GROUP_CAPACITY` | `4U` | `104/business/IEC104_PeriodicScan.c` | | `IEC104_PARAMETER_TASK_CAPACITY` | `4U` | `104/business/IEC104_Parameter.c` | | `IEC104_REMOTE_PARAMETER_TASK_CAPACITY` | `2U` | `104/business/IEC104_RemoteParameter.c` | | `IEC104_CLOCK_SYNCHRONIZATION_TASK_CAPACITY` | `4U` | `104/business/IEC104_ClockSynchronization.c` | | `IEC104_READ_TASK_CAPACITY` | `4U` | `104/business/IEC104_Read.c` | | `IEC104_COMMAND_REPLY_CAPACITY` | `4U` | `104/business/IEC104_Command.c` | | `IEC104_SPONTANEOUS_CAPACITY` | `IEC104_TCP_SERVER_CAPACITY` | `104/business/IEC104_Spontaneous.c` | `IEC104_SPONTANEOUS_CAPACITY` is overrideable but yields no RAM saving (its pool element is callbacks/state, not a capacity-sized array), so the skeleton profile leaves it at its default. The 92% gate is unaffected: these macros size single instance work queues inside a business module, not the TCP server pool, SOE=128, k/w windows or concurrency semantics. - 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.