ryannn
Hello, I plan to use a Raspberry Pi, but I want OPENPLC to treat it as a microcontroller (i.e., the Raspberry Pi does not run a Windows or Linux operating system but operates as bare-metal).
After referring to the documentation on your official website, specifically section 1.5 "Installing OpenPLC Runtime on Microcontrollers," I would like to make some modifications to the OPENPLC Editor (potentially including OPENPLC Runtime when targeting microcontrollers) to support deploying both PLC programs (including their Runtime, as mentioned in section 1.5) and another program entirely written in the C language to the hardware platform. Ideally, once completed, the hardware platform should be capable of running both the PLC program and the C-language program simultaneously.
I would like to know if this plan is feasible. Looking forward to your response!
Reply 0 0
thiagoralves
Anything is feasible if you’re willing to code it. However, uploading bare metal programs to the Pi is an extremely challenging project. At minimum you would have to build a custom bootloader to load your bare metal programs into memory. Not to mention all of the code needed to handle the hardware peripherals. It would take months (if not years) for an experienced embedded systems engineer to build something like this. Not worth it unless you have a really good reason for it (which I can’t think of any)
Reply 0 0
ryannn
Thank you for your response. After further consideration, I believe I should not choose Raspberry Pi but rather Arduino. Now, I have another question.

I know that "The MatIEC Compiler compiles the uploaded PLC program into an equivalent C program. However, this C program is incomplete, as it only contains the logic created by the user. Additional functionality must be added to the system to be usable. OpenPLC provides extra C files that add support for network connectivity, internal image tables (Input and Output Image Tables), hardware interface (to handle physical I/O), and a real-time library that adds real-time behavior for OpenPLC. When combined with the logic created by the user, these extra C files provide the entire environment for the PLC application."

I would like to know, when targeting microcontrollers, in which folder are all these "extra C files" located? This is crucial for me as I intend to study the runtime of OPENPLC, particularly the runtime for microcontrollers.

Looking forward to your kind response.

Reply 0 0
thiagoralves
/editor/arduino/src
/editor/arduino/examples/Baremetal
Reply 0 0
ryannn
/editor/arduino/src
/editor/arduino/examples/Baremetal
Great, thank you very much for your response.
I'm also excited that the two folders I was thinking of are the right ones. I'll continue to study them, and when there are uncertain issues, I'll definitely seek your help again.
 
kind regards,
Ryannn
Reply 0 0
ryannn

Hello, I'm back to consult with you so soon.

I would like to make some memory layout requirements for the uploaded PLC program. Therefore, I would like to ask if you know whether Arduino CLI supports the use of custom linker scripts (i.e., .ld files)? For example, gcc supports specifying custom linker scripts using the -T parameter. This question may not be something I should ask you, but I've googled for a long time and haven't found a definitive answer, so I wanted to ask you about it.

Reply 0 0
thiagoralves
Arduino-cli is just a front end to gcc or whatever toolchain a particular board uses. If you check the command line on builder.py that calls arduino-cli you will see that it sends custom parameters to gcc
Reply 0 0
Reply