-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TW#14952] How to use CMake compile library for esp32 (Project: open62541) #921
Comments
FWIW, that STM32 branch is a mess when it comes to the Makefile... toolchain-specific hacks (like the nano.spec, Windows-specific and install-specific paths hardcoded, ... I'm not surprised you couldn't get it to compile. Actually, the vanilla project seems to almost compile given the correct makefile... I've whipped one up here: https://gist.github.com/Spritetm/3f0c30af13b92a06a91850996694997d . The only issue seems to be that the lwip bsd-socket implementation isn't entirely compatible. The library may need some mangling in the tcp connector, and you may be fine. |
Hi @Spritetm , thanks for you explanation and this Gist first! It enlight me to trying the other possible way to build up this library - Using esp-idf's build system directly 💡 P.s: |
Actually, esp-idfs build system normally handles compiling and linking itself, but it can be persuaded to relegate those tasks to other build systems - like cmake. The component.mk file in the gist does just that: it sets up the environment for cmake to understand esp-idfs compiler and include paths, then just calls on cmake to do the hard work of compiling and linking. Kconfig is the config file that is used in 'make menuconfig', most famously known from the Linux kernel. I don't know cmake too well, but I infer it also has a configuration mechanism that is somewhat alike to it, yes. |
Hi @Spritetm. Cool thanks for your answer firstly. I'll update my working status here later! (Hopfully do even a pull request for this.) 😎 |
Hi ESP, I'm back. 🖐 I've tried the
Because of the lack of library porting experience. Though I've invest another couple of hours, I still can't let
In my opinion it's the compiler restriction setting which controlled by
This is the point where I spend most of my time. According to This Question. I've tried to fake these files, but still with no luck. Is there some suggestions for me ❔
Is this means, even though I got succeed to port this library to esp_idf, I still need to fighting some incompatibilitys here. ♿️ If the full error log is needed, I'll post here. 😸 |
We don't use -Wstrict-prototypes when compiling IDF source code, so header files may contain constructs which are not compatible with this option.
At the moment, there is no sys/select.h on this platform. There is LwIP select, but it can only be used with LwIP sockets. So you need to port that part of the library (i.e. modify it to use LwIP's select) if you want to use it in ESP-IDF. |
Thanks @igrr ! 🥇 I'm putting some effort to inlcude the right header files for No matter what I've tried - Any suggestions are highly appreciated! 👼 |
Hi ESP-IDF, The test ist going on here. 🌞 My Question is somehow simplified: |
In case some one wanna see the compiling log of (I made a small sorting for the compiling log) Part1:
Part2:
|
Hi ESP-IDF, It's far more complecated then I expected. The problem that Now I believe I enter the next level of debugging. And I leave the result here:
|
Hi ESP-IDF, yesterday, I forget to write down some extra problem/discovery here: |
Hi ESP-IDF, What is the Macro of ESP32 / ESP-IDF for |
Got the library up and running! |
Note that support for ESP32 will be added through the PR #1595 (tested and working with my Adafruit ESP32 Board) |
My example project for OPC UA on an ESP32 using Arduino is now available here: |
I try to compile your example project with Arduino .. but I got stuck with following errors.. sketch/open62541.c.o:(.literal.ServerNetworkLayerTCP_listen+0x34): undefined reference to There is something wrong but I can't figure out what. |
Hi esp-idf,
In the past two days I've spent many hours trying to port open62541 project to esp32 platform with no luck. 🦄
About this protocol: Besides MQTT as communication protocol for IoT applications, many companys choose OPC UA as their preferred choice. Because OPC Classic is well adopted since late 90's as M2M protocol in industry. Till now this standard is going on developed, specified and well standardized as IEC TR 62541 by opc foundation and meanwhile very well documented on its online doc. Big Players like ABB, Bosch, Festo, KUKA, SAP, Siemens, Cisco, Microsoft ... are their paied members.
The "Problem" of OPC UA is that its not easy to getting started with and not real open-source. For example, as far as I know/understand, even this in public domain hosted UA-AnsiC Stack from opc foundation will only cost free for their paied members. The Project open62541 on the opposite side is the single open source implementation of OPC UA in C. (List of Open Source OPC UA Implementations).
Right now this project deploy CMake to build the library from its source. I've tested it on my linux boxes. I can build/use this library in Linux enviroment without any issue. Because esp-idf uses FreeRTOS+LWIP for xtensa cores. I started from this PR which is for ST32 (also FreeRTOS+LWIP based). After 2 day long tweaking around, I've learned pretty much from it. ("CMake Cross Compiling", "How does CMake works"...). But I still can not get this job done...
I've to say, it's beyond my right now skill range. I'll appreciate to any help from here. 🚀 🌝
P.s:
Because I really don't know how far what I've done before it makes open62541 works on esp32, So I don't post my error logs here. If it did make sense, I will.
The text was updated successfully, but these errors were encountered: