I simply have no luck when trying to use the non Low-Level APIs from Arduino and ESP8266.
When using the Low Level API (i.e.
IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, HTTP_Protocol) )
, everything works fine.
But when I try to switch to the "normal" and none-low-level (i.e.
IOTHUB_CLIENT_CONFIG config;
IOTHUB_CLIENT_HANDLE iotHubClientHandle;
....
iotHubClientHandle = IoTHubClient_Create(&config);
) then I get compiler error:
Arduino: 1.6.12 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), nodemcu, Disabled, None"
libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.create_iothub_instance+0x28): undefined reference to `Lock'
libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.create_iothub_instance+0x2c): undefined reference to `Unlock'
libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.create_iothub_instance+0x30): undefined reference to `Lock_Init'
libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.create_iothub_instance+0x34): undefined reference to `Lock_Deinit'
libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `create_iothub_instance':
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Init'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Init'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Deinit'
libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.garbageCollectorImpl$isra$0+0x3c): undefined reference to `Lock'
libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `garbageCollectorImpl':
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Deinit'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'
libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `ScheduleWork_Thread':
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'
libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `dispatch_user_callbacks':
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
libraries\AzureIoTHub\sdk\iothub_client.c.o:(.text.IoTHubClient_Destroy+0x1c): undefined reference to `Lock'
libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `IoTHubClient_Destroy':
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock_Deinit'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Lock'
libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `IoTHubClient_SendEventAsync':
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:813: undefined reference to `Unlock'
libraries\AzureIoTHub\sdk\iothub_client.c.o: In function `IoTHubClient_SetMessageCallback':
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:816: undefined reference to `Lock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothub_client.c:839: undefined reference to `Unlock'
libraries\AzureIoTHub\sdk\iothubtransport.c.o:(.text.transport_worker_thread+0xe): undefined reference to `Lock'
libraries\AzureIoTHub\sdk\iothubtransport.c.o: In function `transport_worker_thread':
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothubtransport.c:286: undefined reference to `Unlock'
C:\playground\Arduino\libraries\AzureIoTHub\src\sdk/iothubtransport.c:286: undefined reference to `Unlock'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Generic ESP8266 Module.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Which, I don't understand. I have installed all 4 Arduino libraries - AzureIoTHub, AzureIoTProtocol_HTTP, AzureIoTProtocol_MQTT, AzureIoTUtility
Initially I had a lot of other errors, like "undefined IOTHUB_CLIENT_HANDLE", which I overcame with editing the AzureIoTHub.h by adding the following line:
#include "sdk/iothub_client.h"
because it is not there. Is it intentionally that the "high-level" APIs are not included by default for Arduino?
I see that AzureIoTHub.h already includes the Utility:
#include "AzureIoTUtility.h"
which, at least in theory, should also include the:
#include "azure_c_shared_utility/lock.h"
#include "azure_c_shared_utility/threadapi.h"
where the Lock/Unlock are defined. But I see these compilation errors. Arduino IDE is 1.6.12, which should not affect the results, since the Low Level APIs works fine, as already mentioned.