Pro / open62541-arduino

open62541 OPC UA example for Arduino
35 stars 11 forks source link

Port to SAMD devices #2

Open dj-fiorex opened 6 years ago

dj-fiorex commented 6 years ago

Hi, i want to port your project to my cortex M0+ board (Feather M0 WiFi), so i download your repo and start a new arduino project with Arduino IDE, setup all things but i`m stuck with this error:

open62541.c: 38793:25: fatal error: arpa/inet.h: No such file or directory Could you help me? Thanks a lot

Pro commented 6 years ago

In the case of esp32, this header is part of the espressif library: https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/lwip/arpa/inet.h

It looks like the M0 board is not using lwip, but some proprietary network stack (did not look into that in more detail though...). https://github.com/arduino-libraries/WiFi101

So my guess is that you need to create your own arch implementation (in https://github.com/open62541/open62541/tree/fc59acccb9b983fa4426f677ce67444861e77c2f/arch) which does not use arpa/inet.h.

Also, I just checked the implementation for the arduino architecture, and there we do not include the inet.h file. Did you set the correct CMake flags:

set(UA_ARCHITECTURE "arduino" CACHE STRING "" FORCE)
add_definitions(-DUA_ARCHITECTURE_ARDUINO)

See also https://github.com/Pro/open62541-arduino/blob/19895218fcd6120244aac9fed1b05c3b8aa9dbaf/CMakeLists.txt#L47

dj-fiorex commented 6 years ago

First of all thanks for reply me 👍 I didn't set the correct CMake flags because i'm using Visual Studio + Visual Micro to write code and upload to my feather, so i don't know how to set them up, now i will go take a look :) Than i will update this thread

UPDATE: I saw that your link point to a specific tree of the open62541 repository, but i downloaded .h and .c files from release page, maybe there are different version about arduino support?

Thanks again