Replies: 4 comments 1 reply
-
|
Hi, i dived into this a while ago, and one approach might be: use a "WebAssembly Micro Runtime" on the Embedded Device. maybe worth looking into it... Advantage: if the WASM Code is crashing, the PLC keeps running, |
Beta Was this translation helpful? Give feedback.
-
|
Hi @FelixBen, thank you for your interest in Eclipse 4diac. In order to successfully load your own modules into 4diac FORTE using shared libraries, you first need to perform a shared build of 4diac FORTE itself and then build your external module against that. You can find instructions on how to perform a shared build of 4diac FORTE and your own modules in Building your own 4diac FORTE and Building your own modules, respectively. Afterwards, you can load modules at startup using the |
Beta Was this translation helpful? Give feedback.
-
|
Hi, |
Beta Was this translation helpful? Give feedback.
-
|
Hi, thanks for the clarification. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear 4diac developers,
as part of my master’s thesis, I am investigating approaches for dynamically loading new function blocks (FBs). Specifically, my goal is to support defining multiple FBs within a shared library (currently only .so files) and loading them together at runtime.
I successfully built the RTE using the 4diac-fbe repository and switched to a GNU compiler by adding an appropriate configuration file. In addition, I defined two FBs and exported them together. By creating a separate CMakeLists.txt file and using the same compiler version, I was able to build these FBs as a dynamic library.
For testing purposes, I created an additional FB and modified its algorithm to call dlopen. This appears to work correctly: the call produces no errors, and the process shows that the library is mapped.
To verify whether the FBs are properly defined and registered with the RTE, I attempted to instantiate them using ST_CREAT_FB blocks. However, this was not successful. I suspect this is because the function behind DEFINE_FIRMWARE_FB macro is not invoked correctly when FBs are loaded dynamically in this way. I also tried adding an extern "C" function in each .cpp file to perform the same registration call upon library loading, but this did not resolve the issue.
My assumption is that the problem lies in the registration of new FB types, as the setup works immediately when using static linking.
Therefore, I am considering implementing a module that loads these libraries at startup. However, I am unsure where such a module would best fit within the architecture. I am also uncertain how type registration should be handled to avoid problematic interactions between statically and dynamically linked code.
I would greatly appreciate your guidance and suggestions on this matter.
Thank you very much.
Best regards
Felix Bentele
Beta Was this translation helpful? Give feedback.
All reactions