Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Suggestion for wider HW support
Suggestion for wider HW support [message #1860481] Wed, 09 August 2023 08:39 Go to next message
Michael Schmid is currently offline Michael SchmidFriend
Messages: 2
Registered: August 2023
Junior Member
Dear 4Diag community,

I am new here, and greet all of you.

I would like to suggest some additions/modifications for the existing 4Diag. Currently, the deployment concept is to generate C++ code, and compile it to a hex file for a specific target. This makes distribution on different targets, what may have a different architecture (x86, ARM, MIPS, RISC-V) difficult.

This was recognized (I guess) and LuaJIT is offered now as a architecture independent option to add function blocks / "dynamic type loader". This is a great step into the right direction. The infrastructure for a VM(Virtual Machine) is already established.

There is a faster, better supported alternative to LuaJIT, called WASM. The WASM engine can execute code with near native speed, offer JIT and AOT(Ahead Of Time) compilation, and also offer WAMR (WebAssembly Micro Runtime, https://github.com/bytecodealliance/wasm-micro-runtime). Dont let you fool by the term "web", the WASM engine is a VM just as Lua. Its roots came from JavaScript world, but today is the most advanced VM with lots of compiler knowledge from LLVM. I read speed tests comparing Lua with WASM, and WASM with AOT is 10 to 30 times faster then LuaJIT.

C++ can be directly compiled to WASM, so it would fit into the existing code generation, no extra work needed.

Because of its near-native-speed execution, architecture independence, WASM could become the binary distribution format for 4Diag Forte. On the target device (can then be x86, ARM big like A7, ARM-Cortex M3/4/7, MIPS(ESP32), RISC-V, ect.) a WASM Virtual machine can execute the code and may use JIT or AOT to speed up.

WASM has even more features, making it very interesting:
- support XiP (eXecute in Place) -> can execute from FLASH, instead RAM
- Small runtime binary size (~85K for interpreter and ~50K for AOT) and low memory usage -> many Cortex-M3/4/7, or ESP32 can run this.
- WAMR Module loader: allows to load modules at runtime, for embedded systems.
Tech giants like ARM, Intel, Mozilla, .. are behind this VM.

The transition could be done as:
1. implement a WASM dynamic loader parallel to the LuaJIT
2. add a build target "WASM" parallel to the existing C++ native compilation
3. replace / remove LuaJIT.

One further advantage of having a VM running on the target: the VM can offer things like debugging interface, file server, runtime parameter watching, ect., without having a OS.

As I not yet have detailed knowledge of 4Diag and Forte's internals, is there anything speaking against this?

Best regards,
Michael
Re: Suggestion for wider HW support [message #1860496 is a reply to message #1860481] Thu, 10 August 2023 06:12 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Dear Michael,

welcome to Eclipse 4diac! Great to have you here!

I know about WASM but never had time to look into it. When we where looking for alternatives of a full compile of 4daic FORTE everytime you change an FB WASM was not yet an option and LUA was to our understanding the best option. Especially as LUA was developed for Embedded systems and the LUA VM is really small. But as state in some of our messages also our LUA support is still work in progress and would need some love.

Adding WASM support or replacing our LUA implementation with WASM would be interesting. Would you be interesting in developing such a thing?

Cheers,
Alois
Re: Suggestion for wider HW support [message #1860498 is a reply to message #1860496] Thu, 10 August 2023 07:06 Go to previous messageGo to next message
Michael Schmid is currently offline Michael SchmidFriend
Messages: 2
Registered: August 2023
Junior Member
Hello Alois and 4Diag community,

glad to woke your interest, and that you share the idea of usefulness of the WASM implementation. Yes, I would be interested to develop a WASM implementation. I might need some assistance here and there, with Forte and the 4Diac, and tester.

I am developing mostly on x86 Ubuntu, but also have a Windows 10 machine, and some embedded devices. Building for other target (Mac OS), I cant test.

Cheers,
Michael
Re: Suggestion for wider HW support [message #1860531 is a reply to message #1860498] Sun, 13 August 2023 14:38 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

We are happy to assist you. Having it running on some of the suggested machines is definitely a good starting point.

Cheers,
Alois

P.S.: as I see some mixture of terms in your posts. Please note:
- Eclipse 4diac(tm) is the overall project providing two main products:
- 4diac IDE
- 4diac FORTE

From a branding perspective the D is never capital.
Previous Topic:Error with FORTE and 4DIAC
Next Topic:Can't compile forte in Raspberry Pi with OPC UA
Goto Forum:
  


Current Time: Sun Apr 28 00:09:53 GMT 2024

Powered by FUDForum. Page generated in 0.03044 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top