IEC 61131-3 Structured Text in VS Code, compiled to native code Write, run and debug PLC programs on Linux, macOS, Windows and microcontrollers. Documentation · Install · Examples · Changelog truST is an open platform for IEC 61131-3 Structured Text. You write programs in VS Code with a complete language server. trust-runtime compiles each program ahead of time into native machine code for the computer or chip that…
truST is an open platform for IEC 61131-3 Structured Text. You write programs in VS Code with a
complete language server. trust-runtime compiles each program ahead of time into native machine
code for the computer or chip that runs it, and runs it in a scan cycle. The debugger, Live Values
and the operator screens all work on the running program.
The aim is PLC programming as open and dependable as modern software: one plain-text project that
you review, version and test like any other code.
Why truST
If you need
truST gives you
A modern editor for Structured Text
a language server in VS Code: diagnostics as you type, completion, hover, go to definition, references, rename across files and formatting
PLC programs on ordinary computers
trust-runtime: native code on Linux and macOS, on x86-64 and AArch64, and on Windows x86-64
A small controller
the ESP32-C6 firmware, a complete truST runtime that you install over USB
Code from another PLC
vendor profiles for CODESYS and TwinCAT, Siemens SCL and Mitsubishi GX Works3, and PLCopen XML import and export
To see inside a running program
breakpoints, stepping, the call stack and variables on the compiled program, and Live Values to read, write and force I/O
Operator screens
the HMI Builder in VS Code; the runtime serves the screens at /hmi, with trends and alarms
Field devices
Modbus TCP, MQTT with Sparkplug B, OPC UA, Beckhoff ADS, EtherCAT and GPIO
Process data in a database
OpenOT records values, alarms and messages in SQLite, PostgreSQL, TimescaleDB, MySQL, MariaDB, SQL Server or InfluxDB 3
Tuned control loops
Control.PID, simulated plants and Control Studio, which identifies, tunes, validates and applies
PLC code in CI
a command line that builds, tests, deploys and rolls back, and Structured Text unit tests with JUnit output
Quick start
In VS Code
Install the extension: code --install-extension trust-platform.trust-lsp, or search for
truST in the Marketplace.
Run truST: Create Project from the Command Palette, or open one of the
examples.
Press Start in the truST side panel. It compiles the program and runs it on the simulator;
the first build installs the compiler toolchain that the extension carries.
Open Live Values to watch and force the I/O, or press Debug, set a breakpoint and step
through the scan.
From the command line
trust-runtime new --parent . --name my-plc # create a project
trust-runtime build --project ./my-plc # compile it to native code for this computer
trust-runtime play --project ./my-plc # run it
A new project serves its web UI on http://127.0.0.1:8080: the browser IDE at /ide and the
operator screens at /hmi. No Rust installation is needed: the extension and trust-runtime
install the compiler toolchain on the first build, also without a network connection
(trust-runtime toolchain install --from trust-toolchain-<platform>.tar.gz).
Features
Write Structured Text
IEC 61131-3 Structured Text, with classes, interfaces, methods and namespaces. The language server
checks the program as you type and knows every symbol of the project and its libraries.
Completion, hover, go to definition, find references, rename across files and formatting.
Write in VS Code, in the browser IDE that a runtime serves at /ide, or in Neovim, Zed and other
editors through the language server.
Visual editors for Ladder, SFC, Blockly and statecharts keep a Structured Text companion in the
project.
Libraries: OSCAT, PLCopen Motion, and truST’s control, plant, alarm, HMI and communication
libraries; share your own through a package registry.
Vendor profiles read the Structured Text of CODESYS and TwinCAT, Siemens SCL and Mitsubishi GX
Works3: their syntax, naming and formatting, with each vendor’s known limits written down.
PLCopen XML import and export, with a migration report of what was carried over and what was not.
Structured Text is translated into Rust and compiled with a pinned rustc into native code for
x86-64, AArch64 and RISC-V. Programs are not interpreted.
The simulator in VS Code, trust-runtime on a computer, or a truST runtime on a chip: the same
program and the same project.
IEC configurations, resources and tasks with their intervals and priorities; RETAIN values that
survive a restart and a power loss; a watchdog and defined fault handling.
The simulator runs the program against simulated I/O, scripted scenarios and injected faults.
The compiler toolchain ships inside the VS Code extension and is checked against its manifest;
you never install Rust yourself.
The HMI Builder designs operator screens in VS Code, stored as TOML pages that diff and review like
code. The runtime serves them at /hmi: process pictures, faceplates, trends, and an alarm library
after ISA-18.2 and EEMUA 191. The Plant library’s pumps, valves, instruments, loops and sequences
come with their operator panels.
The hmi_equipment example live at /hmi: an operator raises
LIC-101’s setpoint, and the level follows.
Modbus TCP, MQTT with Sparkplug B, OPC UA, Beckhoff ADS, EtherCAT and GPIO.
Devices & Connections in VS Code finds, configures and wires the devices of a project.
OpenOT records values, alarms, messages and the audit trail in SQLite, PostgreSQL, TimescaleDB,
MySQL, MariaDB, SQL Server or InfluxDB 3, over CA-verified TLS to a database server.
Prometheus metrics and historian files for monitoring.
Discovery and pairing between runtimes, data sharing over Zenoh, and fleet federation.
Control.PID is a documented PID function block, and simulated plants bring dynamics, actuator
limits, delays, disturbances, noise and faults through ordinary PLC I/O. Control Studio identifies
a plant from experiments, tunes and validates a controller against the model, applies it to a
running loop with a bumpless transfer, and restores the previous settings when needed. A control
course of 89 runnable lessons goes from feedback basics to state-space, predictive and adaptive
control.
You write, build and debug programs on a computer, and a computer or a microcontroller runs them.
A microcontroller does not run the development tools: you program it from one of the computers.
Platform
VS Code extension and command line
Runs PLC programs
Linux x86-64 and AArch64
yes
yes
macOS, Intel and Apple silicon
yes
yes
Windows x86-64
yes
yes
ESP32-C6
programmed from a computer above
yes: truST firmware, installed over USB, with Wi-Fi and firmware updates
STM32U5A9
programmed from a computer above
not yet: the firmware builds; it has not run on hardware
A Raspberry Pi runs the Linux AArch64 build; a board model counts as qualified only after it has
passed truST’s device-in-the-loop tests.
Linux PREEMPT_RT is a
supported deployment, not a deterministic-latency certification: latency depends on the kernel,
the hardware and the workload. Hardware behaviour is proven on the target where it is tested; see
Hardware and
Supported chips.
Downloads
Every release is built for
linux-x64, linux-arm64, darwin-x64, darwin-arm64 and win32-x64:
Asset
Contents
VS Code extension (.vsix)
the extension with the language server, runtime, debugger, Control Studio and the compiler toolchain for that platform
trust-runtime-<platform>
trust-runtime (runtime and command line), trust-dev (tests, docs, agent workflows) and trust-bundle-gen, with install notes and a systemd unit
trust-lsp-<platform>
the language server, for other editors
trust-toolchain-<platform>.tar.gz
the compiler toolchain: rustc, rust-lld, the target libraries and the PLC program library, with a hashed manifest
SHA256SUMS
the checksum of every asset, with the release’s provenance and conformance status
truST is written in Rust; PLC programs and libraries are written in Structured Text. Every runtime
and debugger behaviour is written down in a product specification and checked by native executable
tests (specifications); a claim that depends on hardware or on the
environment says what it was proven on.
Interpretations of IEC 61131-3 are recorded in IEC decisions, and
deliberate deviations in
IEC deviations. A release is tagged only after its exact commit has
passed formatting, Clippy, the documentation build, the full test suite and the VS Code tests.
评论