LeSpocky
Hei hei,

I investigated OpenPLC for starting a new project and some questions came up, but let me first shortly summarize how I understand the architecture of the whole thing, please correct me, if anything is wrong:
  1. User opens GUI editor on a workstation and creates a control program saved in a .st file
  2. User transfers that .st file to the embedded target box
  3. Target box transpiles .st into .c
  4. Target box compiles .c into binary using a complete linux build environment (CMake, gcc, …) on the embedded target
  5. Runtime on target executes that binary somehow

(Also, one could connect additional tiny boards like Arduino to extend ports, but there must be one central embedded target doing all that compilation stuff and executing the core runtime.)

From an embedded system engineer perspective, this looks like an unusual approach, requiring quite a lot of space (both RAM and Flash) on the embedded target for compiling.

I can image to execute steps 3 and 4 on the workstation instead. This would reduce compile times and allow to run the runtime on smaller embedded targets with fewer RAM and flash than a modern Raspberry Pi 3 or 4. (In the wild there are rugged embedded Arm boards running Linux on e.g. 128 MiB RAM and effectively 50 MiB of flash.)

That would of course require to build the transpiler along with the GUI and probably even harder have a working cross compiling toolchain (matching the target architecture and maybe the runtime core) on the workstation and somehow configure the application to use that.

Let's say I would put some effort in that approach. Would it have a chance to be integrated in the OpenPLC project?

Let me know what you think about it.

Greets
Alex

Reply 0 0
thiagoralves
LeSpocky wrote:

That would of course require to build the transpiler along with the GUI and probably even harder have a working cross compiling toolchain (matching the target architecture and maybe the runtime core) on the workstation and somehow configure the application to use that.

That's precisely the reason why I went on the other route. Compiling everything on the target means no cross compiling headaches on the IDE. In any case, my goal was always to run it on embedded SoC Linux platforms, so I really didn't care much about making a microcontroller-friendly runtime.
LeSpocky wrote:
Let's say I would put some effort in that approach. Would it have a chance to be integrated in the OpenPLC project?

Absolutely yes! In fact, this is something I'm looking for currently. Please check your PM.
Reply 0 0
LeSpocky

That's precisely the reason why I went on the other route. Compiling everything on the target means no cross compiling headaches on the IDE. In any case, my goal was always to run it on embedded SoC Linux platforms, so I really didn't care much about making a microcontroller-friendly runtime.


Actually what I have in mind are not tiny microcontrollers but embedded SoC Linux platforms, however smaller than Raspberry Pi. A typical SoC/board combination for embedded use in the field has for example something from 32 MiB to 128 MiB of RAM and less than 50 MiB of flash memory for the root filesystem. Big enough to run Linux and almost any C/C++ daemon software, but too small for big scripting language runtimes or even a compiler.

I know cross-compiling can cause serious headaches, especially if not for microcontrollers. What is needed in either case is a way to transfer the binary to the target and run it. Do you already have ideas how that can be solved or even already designed an interface?
Reply 0 0
thiagoralves
The work I've done in this area is related to small microcontrollers only. Having this for small Linux SBCs will be challenging, but possible. Perhaps SFTP will be a good candidate for binary transfer, along with a small daemon on the SBC to detect when a new file arrives in a specific folder.
Reply 0 0
Reply