1

I'm trying to connect my esp8266 device to azure IOT hub, and from my understanding the way to go is to use the official AzureIoThub library (as distributed on library manager) but somewhy any code with this included library doesn't compile.

I get the following errors upon including the library.

Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Build options changed, rebuilding all
In file included from C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/azure_c_shared_utility/constbuffer.h:16:0,

                 from C:\Users\uriya\Documents\Arduino\libraries\AzureIoTHub\src\internal/iothub_client_private.h:9,

                 from C:\Users\uriya\Documents\Arduino\libraries\AzureIoTHub\src\iothub_client_ll_uploadtoblob.c:20:

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/umock_c_prod.h:114:30: error: pasting "MOCKABLE_" and "/*this creates a new constbuffer from a memory area*/" does not give a valid preprocessing token

 #define EXPAND_PROD_ENTRY(A) MOCKABLE_##A

                              ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:9069:1: note: in expansion of macro 'EXPAND_PROD_ENTRY'

 X(P1) \

 ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:8585:21: note: in expansion of macro 'MU_FOR_EACH_1_9'

 #define MU_C2_(x,y) x##y

                     ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/umock_c_prod.h:119:5: note: in expansion of macro 'MU_FOR_EACH_1'

     MU_FOR_EACH_1(EXPAND_PROD_ENTRY, __VA_ARGS__)

     ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/azure_c_shared_utility/constbuffer.h:35:1: note: in expansion of macro 'MOCKABLE_INTERFACE'

 MOCKABLE_INTERFACE(constbuffer,

 ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/umock_c_prod.h:114:30: error: pasting "MOCKABLE_" and "/*this creates a new constbuffer from an existing BUFFER_HANDLE*/" does not give a valid preprocessing token

 #define EXPAND_PROD_ENTRY(A) MOCKABLE_##A

                              ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:9073:1: note: in expansion of macro 'EXPAND_PROD_ENTRY'

 X(P1) \

 ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:9070:1: note: in expansion of macro 'MU_FOR_EACH_1_8'

 MU_FOR_EACH_1_8(X, P2, P3, P4, P5, P6, P7, P8, P9)

 ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/azure_macro_utils/macro_utils.h:8585:21: note: in expansion of macro 'MU_FOR_EACH_1_9'

 #define MU_C2_(x,y) x##y

                     ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/umock_c/umock_c_prod.h:119:5: note: in expansion of macro 'MU_FOR_EACH_1'

     MU_FOR_EACH_1(EXPAND_PROD_ENTRY, __VA_ARGS__)

     ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTUtility\src/azure_c_shared_utility/constbuffer.h:35:1: note: in expansion of macro 'MOCKABLE_INTERFACE'

 MOCKABLE_INTERFACE(constbuffer,

 ^

C:\Users\uriya\Documents\Arduino\libraries\AzureIoTHub\src\iothub_client_ll_uploadtoblob.c:26:27: fatal error: internal/blob.h: No such file or directory

 #include "internal/blob.h"

                           ^

compilation terminated.

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.

Any suggestion or comment would help me immensly

Uriyasama
  • 31
  • 2

4 Answers4

2

This post may be the solution.

Essentially edit .\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\platform.txt such that it has the following line:

build.extra_flags=-DESP8266 -DDONT_USE_UPLOADTOBLOB -DUSE_BALTIMORE_CERT
today
  • 32,602
  • 8
  • 95
  • 115
Benn
  • 21
  • 2
0

Please check if this helps or not http://learniotwithzain.com/2018/10/send-data-from-nodemcu-to-azure-iot-hub/

Zainu
  • 120
  • 1
  • 7
0

You may be hitting the following similar issue: https://github.com/arduino/Arduino/issues/7930

that turned out to be an arduino-builder one that was fixed with: https://github.com/arduino/arduino-builder/pull/285

Amicis
  • 59
  • 1
0

There is an important hint in file platform.txt in the line preceding build.extra_flags=:
# This can be overriden in boards.txt

Using a generic 8266 board I had to modify the build.extra_flag in file boards.txt as follows to get the Azure examples compiled:

generic.menu.CrystalFreq.40.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 -DDONT_USE_UPLOADTOBLOB -DUSE_BALTIMORE_CERT
Thomas
  • 1