Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
ff4707e
Init project with simple .so generation, CMakeLists for project build
lucasbutzke Aug 8, 2025
97864b4
Readme update instructions to compile project
lucasbutzke Aug 8, 2025
2e30afd
Declaring all other Runtime variables
lucasbutzke Aug 12, 2025
46f0919
Moving code functions to utils.c
lucasbutzke Aug 12, 2025
888c745
Declaring pointers to access located variables
lucasbutzke Aug 12, 2025
9f4642b
Fix function prototype
lucasbutzke Aug 12, 2025
2e8d51c
Fix utils.h pointers variables declaration
lucasbutzke Aug 12, 2025
78eb3f9
[RTOP-46] PLC generated program test
lucasbutzke Aug 18, 2025
1e4b84f
Adding -O3 flag to enforce compiler to inline functions in .so
lucasbutzke Aug 19, 2025
6c35999
[RTOP-47] Moving I/O buffers declaration and definition from main
lucasbutzke Aug 19, 2025
4388b97
[RTOP-46] fix plc_main.c include image_tables.h
lucasbutzke Aug 19, 2025
71d7a36
[RTOP-46] Separation of plc program and plc library
lucasbutzke Aug 26, 2025
9063fa8
[RTOP-46] fix plc runtime core import of shared object
lucasbutzke Aug 26, 2025
c138788
[RTOP-46] Files Fix
lucasbutzke Aug 26, 2025
b8c74c5
[RTOP-46] Fix CMake
lucasbutzke Aug 26, 2025
df88008
[RTOP-46] Creation, destruction and symbols management
lucasbutzke Aug 27, 2025
bac0e9f
[RTOP-46] Fix filenames
lucasbutzke Aug 27, 2025
a230486
[RTOP-46] Fix build for share object in bash script
lucasbutzke Aug 27, 2025
73fff0d
[RTOP-49] Adding files
lucasbutzke Aug 27, 2025
4665412
[RTOP-46] Fix files and adding installation
lucasbutzke Aug 28, 2025
3a480fa
[RTOP-46] Add doxygen comments on functions
lucasbutzke Aug 29, 2025
4394e42
[RTOP-50] Fix time metrics for us
lucasbutzke Aug 28, 2025
5713d73
Adding current project compilation steps
lucasbutzke Sep 1, 2025
e615673
Fix readme.md
lucasbutzke Sep 1, 2025
f1196a5
Fix shared object and core text
lucasbutzke Sep 1, 2025
eb0c70f
Add project app files location
lucasbutzke Sep 1, 2025
1fecdf3
Update README with detailed build instructions
marconetsf Sep 2, 2025
8d7ebd4
Merge branch 'development' into RTOP-46-Compile-C-Program
lucasbutzke Sep 5, 2025
7182cf0
Merge pull request #1 from Autonomy-Logic/RTOP-46-Compile-C-Program
lucasbutzke Sep 5, 2025
ca6c965
Include iec_types.h
thiagoralves Sep 8, 2025
c9982e0
Remove items that were moved to image_tables.h
thiagoralves Sep 8, 2025
f1abded
Remove commented code
thiagoralves Sep 8, 2025
68b95c4
Merge pull request #2 from Autonomy-Logic/fix-core-compilation
thiagoralves Sep 8, 2025
ece6717
Fix code identation; adjust code format to match BARR-C:2018
Sep 8, 2025
c1f869c
Cleanup main code
Sep 8, 2025
04a8108
Standard code formatter
marconetsf Sep 9, 2025
6d35775
Separate timing stats in a different file; redone timing calculations
Sep 9, 2025
e91eae8
More cleanups; print plc stats
Sep 9, 2025
c0e6241
Fix cmake
Sep 9, 2025
8348b5e
Fix include path
Sep 9, 2025
19b53db
Fix build
Sep 9, 2025
31691f4
Fix watchdog to only monitor when PLC is running
Sep 9, 2025
c04b339
Graceful shutdown, improve cycle time calculation, and other fixes
Sep 9, 2025
db89c3f
Fix compile script
Sep 9, 2025
578f9f7
Fix compile script to only create folder if it does not exist
Sep 9, 2025
e7bf3da
Final fixes on time computations
Sep 9, 2025
ae87774
Added scan time to logs
Sep 9, 2025
5c394ef
Merge pull request #3 from Autonomy-Logic/improve-code-structure
thiagoralves Sep 10, 2025
dc58b98
Initial draft of UNIX socket support
Sep 10, 2025
bd08f3e
Added PLC State Manager; Finished UNIX socket implementation
Sep 10, 2025
b0c4dc0
Small fixes
Sep 10, 2025
6da41b9
Fix unix socket close
Sep 10, 2025
62773cf
Start UNIX socket
Sep 10, 2025
b1e82f4
Fix lock on shutdown
Sep 10, 2025
588f4dd
Reduce debug noise
Sep 10, 2025
f58cf16
Small UNIX socket fixes
Sep 10, 2025
79f368a
Implement responses on UNIX socket
Sep 10, 2025
0ee9b1f
Small fixes
Sep 10, 2025
b8d2a0d
Final fixes
Sep 10, 2025
d1b3c8a
[RTOP-49] Rest API queue commands to unix server
lucasbutzke Sep 11, 2025
32e7e0c
[RTOP-49] Python Unix socket client init
lucasbutzke Sep 11, 2025
45b5e1c
[RTOP-49] Rest API test start/stop commands
lucasbutzke Sep 11, 2025
8bb794f
[RTOP-49] Fix credentials datetime validation
lucasbutzke Sep 11, 2025
22a6624
[RTOP-49] Unix socket client test recv/send
lucasbutzke Sep 11, 2025
9f445b8
[RTOP-49] Python unix socket client fix
lucasbutzke Sep 12, 2025
6bba641
[RTOP-68] Async lock to handle one command at a time
lucasbutzke Sep 12, 2025
c202a2d
[RTOP-49] Pytest for rest api
lucasbutzke Sep 12, 2025
0b59f35
[RTOP-49] Fix rest api database path
lucasbutzke Sep 12, 2025
e46c37a
[RTOP-49] Refactor rest api callbacks
lucasbutzke Sep 12, 2025
cf724da
[RTOP-49] Rest API shutdown fix
lucasbutzke Sep 12, 2025
4e3bc90
Removing commented code
lucasbutzke Sep 12, 2025
3f5d030
[RTOP-49] Docker fix
lucasbutzke Sep 12, 2025
a87efb8
[RTOP-49] Path fixes
lucasbutzke Sep 15, 2025
f0c63a4
[RTOP-49] Docker run rest api and runtime
lucasbutzke Sep 15, 2025
575307e
[RTOP-49] Added pre-commit to README
lucasbutzke Sep 15, 2025
6c1cafd
[RTOP-49] Fix linux install
lucasbutzke Sep 15, 2025
f09dfa8
[RTOP-49] Sync unix socket client refactor
lucasbutzke Sep 16, 2025
cc4de73
Merge branch 'RTOP-50-Implement-base-code-to-Commands' of https://git…
lucasbutzke Sep 16, 2025
bf48595
[RTOP-49] Adding python unix socket mutex and removing comments
lucasbutzke Sep 16, 2025
29b9e2c
Fix exec.sh script to start both processes
Sep 16, 2025
ff9eec8
Merge pull request #4 from Autonomy-Logic/RTOP-49-Implement-base-code…
thiagoralves Sep 16, 2025
26d5f0a
[RTOP-70] implement command logs (#7)
thiagoralves Sep 22, 2025
72f21fe
Initial draft of the runtime_manager
Sep 23, 2025
c5f4657
Fix socket creation error
Sep 23, 2025
6e1f890
Add psutil to requirements.txt
Sep 23, 2025
8d83ed5
Removed plc_main from exec.sh
Sep 23, 2025
9e464fa
Addressed PR comments
Sep 24, 2025
4af0986
Remove .DS_Store files
Sep 24, 2025
d2a99a3
Merge pull request #8 from Autonomy-Logic/RTOP-73-Create-runtime-mana…
thiagoralves Sep 24, 2025
98c729d
adding ceedling configuration and tests folder (#10)
marconetsf Sep 25, 2025
4b703c5
[RTOP-69] implement base code to commands (#9)
lucasbutzke Sep 25, 2025
c9f1c93
Allow runtime to run without libplc.so
Sep 29, 2025
79fb6df
Print logs in json; conditional stdout printing
thiagoralves Oct 2, 2025
a1c03eb
Fix va-args segmentation fault
thiagoralves Oct 2, 2025
c746670
Replace printf calls with log calls
thiagoralves Oct 2, 2025
55be6cd
Compilation fix
thiagoralves Oct 2, 2025
e0c6927
Remove new line at the end of message
thiagoralves Oct 2, 2025
58096da
Remove new line at the end of message
thiagoralves Oct 2, 2025
6918ef4
Merge pull request #12 from Autonomy-Logic/json-logs
thiagoralves Oct 2, 2025
e77bc79
Added change to compile-clean.sh
devin-ai-integration[bot] Oct 2, 2025
565ef64
Improved compilation flow
thiagoralves Oct 6, 2025
f901b6a
Minor changes in the compilation flow
thiagoralves Oct 6, 2025
aab681a
[RTOP 52] External Plugins driver + Modbus Slave (#15)
marconetsf Oct 7, 2025
19252e0
[RTOP-76] runtime logs parser (#13)
lucasbutzke Oct 8, 2025
980fbb2
Replace Python Cryptography with OpenSSL CLI for certificate generation
devin-ai-integration[bot] Oct 9, 2025
b75f1fe
Fix certificate logic in main app. Removed http-only implementation
thiagoralves Oct 9, 2025
f768d21
Merge pull request #16 from Autonomy-Logic/devin/1728420279-replace-c…
thiagoralves Oct 9, 2025
2bd3ccb
Security: Add input validation to certificate generation
devin-ai-integration[bot] Oct 9, 2025
a4bbed7
Fix regex on hostname
thiagoralves Oct 9, 2025
697749f
Add missing * character in dn_special_chars
thiagoralves Oct 9, 2025
6465e0a
Merge pull request #19 from Autonomy-Logic/devin/1760027828-security-…
thiagoralves Oct 9, 2025
1e04dcc
Fix file path validation logic
thiagoralves Oct 9, 2025
f0c3d7e
Fix failed build due to logger
thiagoralves Oct 15, 2025
a67a365
Rtop 78 create log filters (#18)
lucasbutzke Oct 16, 2025
d372087
Bring debugger external functions
thiagoralves Oct 16, 2025
a680e53
Added debug command on Unix socket
thiagoralves Oct 16, 2025
23eb714
Fix missing lib
Oct 16, 2025
11f53b6
Added missing debug_handler import
thiagoralves Oct 16, 2025
f7e1656
small fixes
Oct 16, 2025
8f9dbc1
Implement debugger handler for runtime v4
devin-ai-integration[bot] Oct 16, 2025
39e2c3e
Merge pull request #21 from Autonomy-Logic/devin/1760648960-implement…
thiagoralves Oct 16, 2025
41702a8
Add WebSocket debug endpoint for secure real-time debugging
devin-ai-integration[bot] Oct 16, 2025
b809315
Fix WebSocket connection error by adding root namespace handler
devin-ai-integration[bot] Oct 17, 2025
6c4936f
Add Python client example to WebSocket documentation
devin-ai-integration[bot] Oct 17, 2025
869ef5e
Fix 500 error on WebSocket disconnect
devin-ai-integration[bot] Oct 17, 2025
0a1977a
Attempt to fix disconnect error with allow_upgrades=False
devin-ai-integration[bot] Oct 17, 2025
51c6512
Suppress harmless WSGI disconnect error in debug WebSocket
devin-ai-integration[bot] Oct 17, 2025
5438dec
Merge pull request #22 from Autonomy-Logic/devin/1760657007-websocket…
thiagoralves Oct 17, 2025
45775e3
Merge pull request #24 from Autonomy-Logic/RTOP-91-Integrate-debugger…
thiagoralves Oct 17, 2025
7ecd8a1
Add proper program MD5 to debugger
thiagoralves Oct 17, 2025
fabefff
Missing definition in utils.h
thiagoralves Oct 17, 2025
662d0cd
Fixed declaration od md5 char
Oct 17, 2025
00a9ec7
Temporary add libplc.so for debugging purposes
Oct 17, 2025
2f96432
Add libplc.so for testing
Oct 17, 2025
a4e9c44
fix: Increase buffer sizes to handle large debug responses
devin-ai-integration[bot] Oct 17, 2025
5b0366a
fix: Check for newline in entire buffer, not just last chunk
devin-ai-integration[bot] Oct 18, 2025
3c1528f
fix: Support multiple concurrent Unix socket clients
devin-ai-integration[bot] Oct 18, 2025
369d5ce
fix: Add newline to DEBUG responses and handle large responses
devin-ai-integration[bot] Oct 18, 2025
4e47dbc
fix: Enforce single Unix socket connection and atomic send+receive
devin-ai-integration[bot] Oct 18, 2025
fedbabc
fix: Use send_and_receive in RuntimeManager methods
devin-ai-integration[bot] Oct 18, 2025
6b88614
Merge pull request #25 from Autonomy-Logic/fix-md5
thiagoralves Oct 18, 2025
8df1614
Delete libplc.so leftover
thiagoralves Oct 18, 2025
6c8e61b
Rtop 89 integrate pytest (#26)
lucasbutzke Oct 21, 2025
f83767d
Add support for C++ Function Blocks
thiagoralves Oct 21, 2025
7a009d9
Fix libplc.so caching issue by using unique timestamped filenames
devin-ai-integration[bot] Oct 21, 2025
d468e75
Reduce required python version
thiagoralves Oct 21, 2025
83f0915
Fix name issue on the new libplc
thiagoralves Oct 21, 2025
333a785
Avoid removing new libplc
thiagoralves Oct 21, 2025
2574d27
Merge pull request #27 from Autonomy-Logic/devin/1761079589-fix-libpl…
thiagoralves Oct 21, 2025
8dffb66
Rtop 79 unit tests runtime logs (#28)
lucasbutzke Oct 27, 2025
6d4b616
Fix webserver exec inside docker
lucasbutzke Oct 29, 2025
b0c8488
[RTOP-93] bugfix users db permission
marconetsf Oct 30, 2025
7701944
enabling initial build test workflow
marconetsf Nov 5, 2025
469f2cb
Add multi-architecture Docker build support
devin-ai-integration[bot] Nov 18, 2025
d9ebd7f
Remove useless install script
thiagoralves Nov 18, 2025
bdb5f74
Docker adjustments
Nov 18, 2025
b03a2a4
Adjust build script
thiagoralves Nov 18, 2025
c5714b7
Add pkg-config for Ubuntu targets
thiagoralves Nov 18, 2025
eccbf19
Fix plugin system compilation error on 32-bit architectures (arm/v7)
devin-ai-integration[bot] Nov 18, 2025
4a186e4
Fix Flask-SocketIO production server error by switching to eventlet
devin-ai-integration[bot] Nov 18, 2025
c98bef5
Revert eventlet addition on requirements
thiagoralves Nov 18, 2025
70dba83
Revert using eventlet on debug socket
thiagoralves Nov 18, 2025
df89fa6
Allow werkzeug on docker
thiagoralves Nov 18, 2025
de5010c
Merge pull request #34 from Autonomy-Logic/devin/1763481207-multi-arc…
thiagoralves Nov 18, 2025
047b900
Remove emoji
thiagoralves Nov 18, 2025
2849d27
revert accidental changes
thiagoralves Nov 18, 2025
cc02348
Remove emojis
thiagoralves Nov 18, 2025
50a8218
Remove emojis
thiagoralves Nov 18, 2025
98b90e2
Remove emojis
thiagoralves Nov 18, 2025
e0f0fea
Remove emojis
thiagoralves Nov 18, 2025
748e46e
Merge pull request #35 from Autonomy-Logic/remove-emojis
thiagoralves Nov 18, 2025
07aaa3b
Fix initialization error when there is no PLC program to load
thiagoralves Nov 18, 2025
18d8c55
Fix initialization errors when there is no PLC program
thiagoralves Nov 18, 2025
8df1b31
Handle empty PLC state
thiagoralves Nov 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BasedOnStyle: LLVM
IndentWidth: 4
UseTab: Never
ColumnLimit: 100
BreakBeforeBraces: Allman # (ou Attach, Linux, etc.)
AllowShortFunctionsOnASingleLine: Empty
SpaceBeforeParens: ControlStatements
AlignConsecutiveAssignments: true
42 changes: 42 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Publish Multi-Arch Docker Image

on:
push:
branches: [ main, development ]
pull_request:
branches: [ main, development ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Build and Push Multi-Arch Image
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
ghcr.io/autonomy-logic/openplc-runtime:latest
ghcr.io/autonomy-logic/openplc-runtime:${{ github.sha }}
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Ignore all files in the build output directory
/build*/
/core/generated/
/memory-bank

.vscode/
#.*/
/venvs/
.venv/
__pycache__/
.clinerules

# Temporary files
*.txt
*.log
*.env
*.pem
*.db
*.socket
*.installed
*.egg-info
*.pytest_cache/

# Ignore all object files and shared libraries
*.o
*.so
52 changes: 52 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
repos:
- repo: https://github.com/pycqa/pylint
rev: v3.3.8
hooks:
- id: pylint
# args: [--fail-on=F,E]
args: [
"--disable=C0114,C0411,C0115,C0116,C0412,E0401,W0718,R1702,R0911,R0912,R0915,R1705,W0404,W0603,W0613,W0511",
] # example: disable missing-docstring
additional_dependencies:
[flask, flask-sqlalchemy, flask_jwt_extended, werkzeug]
entry: pylint
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
args: ["--profile=black", "--filter-files"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.11
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
args: []
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.17.1
# hooks:
# - id: mypy
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.0 # Let autoupdate find the latest
hooks:
- id: clang-format
files: \.(c|h)$
args: [--style=file] # Assumes a .clang-format file is present
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0 # Use this specific modern version
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
args: ["--maxkb=500"]
# The following hooks are very stable and widely available
- id: check-ast # Check that files contain valid syntax (for any language)
- id: check-case-conflict # Check for files that would conflict in case-insensitive filesystems
- id: check-json # Check JSON files for validity
- id: check-yaml # Check YAML files for validity
- id: destroyed-symlinks # Check for destroyed symlinks
- id: detect-private-key # Detect the presence of private keys
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"files.associations": {
"sched.h": "c",
"scan_cycle_manager.h": "c",
"dlfcn.h": "c",
"utils.h": "c",
"plc_state_manager.h": "c",
"unix_socket.h": "c",
"plugin_driver.h": "c"
},
"editor.rulers": [
80
],
"[c]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"editor.formatOnSave": true
}
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(plc_project C)

# add_subdirectory(./core/generated)
add_subdirectory(./core/src)
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# syntax=docker/dockerfile:1

FROM debian:bookworm-slim

WORKDIR /workdir

# Copy source code
COPY . .

# Setup runtime directory and permissions
RUN mkdir -p /var/run/runtime && \
chmod +x install.sh scripts/* start_openplc.sh

# Clean any existing build artifacts to ensure clean Docker build
RUN rm -rf build/ venvs/ .venv/ 2>/dev/null || true

# Run installation script
RUN ./install.sh

# Expose webserver port
EXPOSE 8443

# Default execution - Start OpenPLC Runtime
CMD ["bash", "./start_openplc.sh"]
19 changes: 19 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Dockerfile
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y \
python3 python3-venv python3-pip bash \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /workdir
COPY . .
RUN mkdir -p /var/run/runtime
# Clean any existing build artifacts to ensure clean Docker build
RUN rm -rf build/ venvs/ 2>/dev/null || true
RUN chmod +x install.sh scripts/* start_openplc.sh
RUN ./install.sh

EXPOSE 8443

CMD ["bash", "./scripts/setup-tests-env.sh"]
192 changes: 191 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,192 @@
# openplc-runtime
# OpenPLC Runtime v4

OpenPLC Runtime v4 designed to run programs built on OpenPLC Editor v4

## Prerequisites

### Linux

- GCC compiler
- Make
- CMake
- Python (for xml2st tool)

### Windows

- Python (required to run xml2st)
- Docker Desktop (contains GCC and Make internally)

## Run project

### Docker

1. Build image

```
sudo bash ./scripts/build-docker-image.sh
```

2. Run image

```
sudo bash ./scripts/run-image.sh
```

### Linux

1. Installation

```
sudo bash ./install.sh
```

2. Start

```
sudo bash ./start_openplc.sh
```

## Unit Tests

1. Run locally

```
sudo bash ./scripts/setup-tests-env.sh
```

or

2. Build development docker image

```
sudo bash ./scripts/build-docker-image-dev.sh
```

3. Run development docker image

```
sudo bash ./scripts/run-image-dev.sh
```

## Pre-commit setup

1. Install

```
pip install pre-commit
pre-commit install
```

2. Normal commit

```
git add .
git commit -m "Your commit message" # Pre-commit checks run automatically

```

3. Skip pre-commit checks

```
git commit --no-verify -m "Your commit message"
```

Use the --no-verify flag for quick fixes or when pre-commit checks aren't necessary. This bypasses all pre-commit validation for that specific commit.

## 🛠️ Build Instructions

### Step 1: Build Application in OpenPLC IDE

1. Create your PLC program in the **OpenPLC IDE**
2. **Important**: Your project must include **Location Variables (IEC 61131-3)** to compile successfully
3. Click **Compile** in the IDE
4. This will generate a `LOCATED_VARIABLES.h` file in `{projectfolder}/build/OpenPLC Runtime/src/`

### Step 2: Generate glueVars.c with XML2ST

1. Clone and setup xml2st:

```bash
git clone https://github.com/Autonomy-Logic/xml2st.git
cd xml2st
git switch development
```

2. Run xml2st with the path to your LOCATED_VARIABLES.h:

```bash
xml2st --generate-gluevars /path/to/LOCATED_VARIABLES.h
```

3. Copy **all generated files** from `{projectfolder}/build/OpenPLC Runtime/src/` to `core/generated/` directory in this project

### Step 3: Build Runtime

#### 🐧 Linux Build

```bash
# Build the runtime core
mkdir build
cd build
cmake ..
make
```

#### 🪟 Windows Build (Docker)

1. **Build Docker image** (run from project root):

```bash
docker build -t openplc-runtime .
```

2. **Run Docker container** in interactive mode:

```bash
docker run -it --rm -v ${PWD}:/workspace openplc-runtime bash
```

3. **Inside the Docker container**, build the project:

```bash
mkdir build
cd build
cmake ..
make
```

## 🚀 Running the Application

After successful compilation, you can run the OpenPLC Runtime:

```bash
./plc_main
```

## 📁 Project Structure

```
openplc-runtime/
├── core/
│ ├── src/ # Core runtime source files
│ └── generated/ # Generated files from OpenPLC IDE (copy here)
├── scripts/ # Build scripts
├── Dockerfile # Docker configuration for Windows builds
└── CMakeLists.txt # CMake build configuration
```

## 🔧 Troubleshooting

### Common Issues

- **Missing Location Variables**: Ensure your OpenPLC IDE project includes IEC 61131-3 location variables
- **Docker not found**: Install Docker Desktop on Windows
- **Build failures**: Verify all generated files are copied to `core/generated/`

### File Requirements

The `core/generated/` directory should contain:

- `glueVars.c` (generated by xml2st)
- `LOCATED_VARIABLES.h` (from OpenPLC IDE compilation)
- Other generated files from OpenPLC IDE build process
Loading