I am trying to get the Azure IoT hub to compile via makeEspArduino but not having any luck with a previous declaration.
To start, I can compile the example file inside of https://github.com/Azure/azure-iot-arduino/tree/master/examples/esp8266/iothub_ll_telemetry_sample
A few changed I made was to comment out the round, and changed the Azure Platform Local to build.extra_flags= -DDONT_USE_UPLOADTOBLOB -DUSE_BALTIMORE_CERT and it will compile perfectly in the Arduino IDE with the following output.
arduino_output.txt
Now I tried a minimum viable test with just the 3 files plus the makeEspArduino and I start running into compile issues.
[brain@Craptop-Deux ino]$ make -f makeEspArduino.mk
core_esp8266_wiring.cpp
In file included from /home/brain/Arduino/libraries/AzureIoTUtility/src/umock_c/aux_inc/cstdint:7:0,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/bits/char_traits.h:376,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/string:40,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/random:41,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:65,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/algorithm:62,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/Arduino.h:238,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/wiring_private.h:31,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/core_esp8266_wiring.cpp:22:
/home/brain/Arduino/libraries/AzureIoTUtility/src/umock_c/aux_inc/stdint.h:25:28: error: conflicting declaration 'typedef signed char int_fast8_t'
typedef signed char int_fast8_t;
^
In file included from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/sdk/libc/xtensa-lx106-elf/include/sys/pgmspace.h:6:0,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/sdk/libc/xtensa-lx106-elf/include/sys/stdio.h:6,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/sdk/libc/xtensa-lx106-elf/include/stdio.h:63,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/wiring_private.h:28,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/core_esp8266_wiring.cpp:22:
/home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/sdk/libc/xtensa-lx106-elf/include/stdint.h:74:30: error: 'int_fast8_t' has a previous declaration as 'typedef int int_fast8_t'
typedef __INT_FAST8_TYPE__ int_fast8_t;
^
In file included from /home/brain/Arduino/libraries/AzureIoTUtility/src/umock_c/aux_inc/cstdint:7:0,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/bits/char_traits.h:376,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/string:40,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/random:41,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/bits/stl_algo.h:65,
from /home/brain/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/xtensa-lx106-elf/include/c++/4.8.2/algorithm:62,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/Arduino.h:238,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/wiring_private.h:31,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/core_esp8266_wiring.cpp:22:
/home/brain/Arduino/libraries/AzureIoTUtility/src/umock_c/aux_inc/stdint.h:29:28: error: conflicting declaration 'typedef unsigned char uint_fast8_t'
typedef unsigned char uint_fast8_t;
^
In file included from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/sdk/libc/xtensa-lx106-elf/include/sys/pgmspace.h:6:0,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/sdk/libc/xtensa-lx106-elf/include/sys/stdio.h:6,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/sdk/libc/xtensa-lx106-elf/include/stdio.h:63,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/wiring_private.h:28,
from /home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/cores/esp8266/core_esp8266_wiring.cpp:22:
/home/brain/.arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/sdk/libc/xtensa-lx106-elf/include/stdint.h:75:31: error: 'uint_fast8_t' has a previous declaration as 'typedef unsigned int uint_fast8_t'
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
The arduino.mk for this process was :
# Board definitions
CORE_DEBUG_LEVEL ?=
F_CPU ?= 80000000L
FLASH_MODE ?= qio
FLASH_SPEED ?= 40
UPLOAD_RESET ?= --before default_reset --after hard_reset
UPLOAD_SPEED ?= 115200
COMP_WARNINGS ?= -w
INCLUDE_VARIANT = nodemcu
# Commands
C_COM=$(C_COM_PREFIX) "$(ESP_ROOT)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I$(ESP_ROOT)/tools/sdk/include" "-I$(ESP_ROOT)/tools/sdk/lwip2/include" "-I$(ESP_ROOT)/tools/sdk/libc/xtensa-lx106-elf/include" "-I$(BUILD_DIR)/core" $(C_PRE_PROC_FLAGS) -c $(COMP_WARNINGS) -std=c17 -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DNONOSDK22x_190703=1 -DF_CPU=$(F_CPU) -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10605 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_$(CHIP) -DARDUINO_BOARD=\"ESP8266_NODEMCU\" -DFLASHMODE_QIO -DESP8266 $(BUILD_EXTRA_FLAGS) $(C_INCLUDES)
CPP_COM=$(CPP_COM_PREFIX) "$(ESP_ROOT)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I$(ESP_ROOT)/tools/sdk/include" "-I$(ESP_ROOT)/tools/sdk/lwip2/include" "-I$(ESP_ROOT)/tools/sdk/libc/xtensa-lx106-elf/include" "-I$(BUILD_DIR)/core" $(C_PRE_PROC_FLAGS) -c $(COMP_WARNINGS) -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DNONOSDK22x_190703=1 -DF_CPU=$(F_CPU) -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10605 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_$(CHIP) -DARDUINO_BOARD=\"ESP8266_NODEMCU\" -DFLASHMODE_QIO -DESP8266 $(BUILD_EXTRA_FLAGS) $(C_INCLUDES)
S_COM="$(ESP_ROOT)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I$(ESP_ROOT)/tools/sdk/include" "-I$(ESP_ROOT)/tools/sdk/lwip2/include" "-I$(ESP_ROOT)/tools/sdk/libc/xtensa-lx106-elf/include" "-I$(BUILD_DIR)/core" $(C_PRE_PROC_FLAGS) -c -g -x assembler-with-cpp -MMD -mlongcalls -DNONOSDK22x_190703=1 -DF_CPU=$(F_CPU) -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10605 -DARDUINO_ESP8266_NODEMCU -DARDUINO_ARCH_$(CHIP) -DARDUINO_BOARD=\"ESP8266_NODEMCU\" -DFLASHMODE_QIO -DESP8266 $(BUILD_EXTRA_FLAGS) $(C_INCLUDES)
LIB_COM="$(ESP_ROOT)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar"
CORE_LIB_COM="$(ESP_ROOT)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-ar" cru "$(CORE_LIB)"
LD_COM="$(ESP_ROOT)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc" -fno-exceptions -Wl,-Map "-Wl,$(BUILD_DIR)/$(MAIN_NAME).map" -g $(COMP_WARNINGS) -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static "-L$(ESP_ROOT)/tools/sdk/lib" "-L$(ESP_ROOT)/tools/sdk/lib/NONOSDK22x_190703" "-L$(ESP_ROOT)/tools/sdk/ld" "-L$(ESP_ROOT)/tools/sdk/libc/xtensa-lx106-elf/lib" "-Teagle.flash.4m2m.ld" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o "$(BUILD_DIR)/$(MAIN_NAME).elf" -Wl,--start-group $^ $(BUILD_INFO_OBJ) "$(CORE_LIB)" -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group "-L$(BUILD_DIR)"
PART_FILE?=$(ESP_ROOT)/tools/partitions/default.csv
GEN_PART_COM=
ELF2BIN_COM="$(PYTHON3_PATH)/python3" "$(ESP_ROOT)/tools/elf2bin.py" --eboot "$(ESP_ROOT)/bootloaders/eboot/eboot.elf" --app "$(BUILD_DIR)/$(MAIN_NAME).elf" --flash_mode $(FLASH_MODE) --flash_freq $(FLASH_SPEED) --flash_size 4M --path "$(ESP_ROOT)/tools/xtensa-lx106-elf/bin" --out "$(BUILD_DIR)/$(MAIN_NAME).bin"
SIZE_COM="$(ESP_ROOT)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-size" -A "$(BUILD_DIR)/$(MAIN_NAME).elf"
ESPTOOL_COM?=$(error esptool must be installed for this operation! Run: pip install esptool)
UPLOAD_COM?="$(ESP_ROOT)/tools/python3/python3" "$(ESP_ROOT)/tools/upload.py" --chip esp8266 --port "$(UPLOAD_PORT)" --baud "$(UPLOAD_SPEED)" $(UPLOAD_RESET) write_flash 0x0 "$(BUILD_DIR)/$(MAIN_NAME).bin"
SPIFFS_START?=0x200000
SPIFFS_SIZE?=0x1FA000
SPIFFS_BLOCK_SIZE?=8192
MK_FS_COM?="$(MK_FS_PATH)" -b $(SPIFFS_BLOCK_SIZE) -s $(SPIFFS_SIZE) -c $(FS_DIR) $(FS_IMAGE)
RESTORE_FS_COM?="$(MK_FS_PATH)" -b $(SPIFFS_BLOCK_SIZE) -s $(SPIFFS_SIZE) -u $(FS_RESTORE_DIR) $(FS_IMAGE)
FS_UPLOAD_COM?="$(ESP_ROOT)/tools/python3/python3" "$(ESP_ROOT)/tools/upload.py" --chip esp8266 --port "$(UPLOAD_PORT)" --baud "$(UPLOAD_SPEED)" $(UPLOAD_RESET) write_flash 0x0 "$(BUILD_DIR)/$(MAIN_NAME).bin"
CORE_PREBUILD=
SKETCH_PREBUILD=
VTABLE_FLAGS?=-DVTABLES_IN_FLASH
LINK_PREBUILD="$(ESP_ROOT)/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc" -CC -E -P $(VTABLE_FLAGS) "$(ESP_ROOT)/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "$(BUILD_DIR)/local.eagle.app.v6.common.ld"
MEM_FLASH=^(?:\.irom0\.text|\.text|\.text1|\.data|\.rodata|)\s+([0-9]+).*
MEM_RAM=^(?:\.data|\.rodata|\.bss)\s+([0-9]+).*
FLASH_INFO=4MB (FS:2MB OTA:~1019KB)
LWIP_INFO=v2 Lower Memory
In another effort I want and defined the LIBS as :
PROJECT_DIRECTORY = $(HOME)/ino_test
ESP_ROOT = $(PROJECT_DIRECTORY)/lib/Arduino
LIBS = $(PROJECT_DIRECTORY)/lib/packages/AzureIoTHub/src
$(PROJECT_DIRECTORY)/lib/packages/AzureIoTUtility
include $(PROJECT_DIRECTORY)/lib/makeEspArduino/makeEspArduino.mk
This is is part of trying to organizing a project better, but anyhow, testing multiple methods.
With this method, I got 2 errors and 2 notes this time.
spiffs_api.cpp
In file included from /home/brain/ino_test/lib/packages/AzureIoTUtility/src/umock_c/aux_inc/cstdint:7,
from /home/brain/ino_test/lib/Arduino/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/10.1.0/memory:94,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/FS.h:24,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/spiffs_api.h:28,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/spiffs_api.cpp:24:
/home/brain/ino_test/lib/packages/AzureIoTUtility/src/umock_c/aux_inc/stdint.h:25:28: error: conflicting declaration 'typedef signed char int_fast8_t'
25 | typedef signed char int_fast8_t;
| ^~~~~~~~~~~
In file included from /home/brain/ino_test/lib/Arduino/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/10.1.0/bits/atomic_base.h:36,
from /home/brain/ino_test/lib/Arduino/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/10.1.0/bits/shared_ptr_atomic.h:33,
from /home/brain/ino_test/lib/Arduino/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/10.1.0/memory:85,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/FS.h:24,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/spiffs_api.h:28,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/spiffs_api.cpp:24:
/home/brain/ino_test/lib/Arduino/tools/sdk/libc/xtensa-lx106-elf/include/stdint.h:74:30: note: previous declaration as 'typedef int int_fast8_t'
74 | typedef __INT_FAST8_TYPE__ int_fast8_t;
| ^~~~~~~~~~~
In file included from /home/brain/ino_test/lib/packages/AzureIoTUtility/src/umock_c/aux_inc/cstdint:7,
from /home/brain/ino_test/lib/Arduino/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/10.1.0/memory:94,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/FS.h:24,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/spiffs_api.h:28,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/spiffs_api.cpp:24:
/home/brain/ino_test/lib/packages/AzureIoTUtility/src/umock_c/aux_inc/stdint.h:29:28: error: conflicting declaration 'typedef unsigned char uint_fast8_t'
29 | typedef unsigned char uint_fast8_t;
| ^~~~~~~~~~~~
In file included from /home/brain/ino_test/lib/Arduino/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/10.1.0/bits/atomic_base.h:36,
from /home/brain/ino_test/lib/Arduino/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/10.1.0/bits/shared_ptr_atomic.h:33,
from /home/brain/ino_test/lib/Arduino/tools/xtensa-lx106-elf/xtensa-lx106-elf/include/c++/10.1.0/memory:85,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/FS.h:24,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/spiffs_api.h:28,
from /home/brain/ino_test/lib/Arduino/cores/esp8266/spiffs_api.cpp:24:
/home/brain/ino_test/lib/Arduino/tools/sdk/libc/xtensa-lx106-elf/include/stdint.h:75:31: note: previous declaration as 'typedef unsigned int uint_fast8_t'
75 | typedef __UINT_FAST8_TYPE__ uint_fast8_t;
| ^~~~~~~~~~~~
At this point, I am lost as to what is causing the makefile to handle the Azure IoT files differently as from the Arduino IDE.
If you need any other info, please let me know as this is bugging me why it works one place and not the other.
Thanks
Brian