Azure IoT Hub (over-the-air updates) - ESP32

Hello everybody,

I am working with a fleet of ESP32s and updating firmware on every device with a USB becomes tedious. I would like to use Azure IoT Hub OTA to automatically update my devices when triggered from GitHub actions.

Thankfully there is a project that connects ESP32 to Azure IoT Hub: iot-middleware-freertos-samples/demos/projects/ESPRESSIF/adu at main · Azure-Samples/iot-middleware-freertos-samples · GitHub

It compiles using the idf.py without any issues, uploads and works. However most of my work is done using PlatformIO. I tried to configure it as so: iot-middleware-freertos-samples/demos/projects/ESPRESSIF/adu at main · mkuznecovs/iot-middleware-freertos-samples · GitHub

It compiles all the source files, but fails during linking due to http_parser functions (coreHTTP) being defined twice. But somehow it compiles using idf.py. I was wondering if you ever faced a similar issue? Here is an example of the error:

/home/maksims/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/11.2.0/../../../../xtensa-esp32-elf/bin/ld:
.pio/build/esp-wrover-kit/esp-idf/coreHTTP/libcoreHTTP.a(http_parser.o): in function `http_parser_version':
/home/maksims/esp/examples/iot-middleware-freertos-samples/libs/azure-iot-middleware-freertos
/libraries/coreHTTP/source/dependency/3rdparty/http_parser/http_parser.c:2566: multiple definition of 
`http_parser_version'; .pio/build/esp-wrover-kit/esp-idf/http_parser/libhttp_parser.a(http_parser.o):
/home/maksims/.platformio/packages/framework-espidf/components/http_parser/http_parser.c:2490: first defined here

Here are the packages that I am using:

  • framework-espidf @ 3.50000.0 (5.0.0)
  • tool-cmake @ 3.21.3
  • tool-esptoolpy @ 1.40400.0 (4.4.0)
  • tool-ninja @ 1.7.1
  • toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
  • toolchain-xtensa-esp32 @ 11.2.0+2022r1

I also tried compiling with framework-espidf @ 3.40403.0 (4.4.3) linking errors slightly change:

/home/maksims/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld:
.pio/build/esp-wrover-kit/esp-idf/coreHTTP/libcoreHTTP.a(http_parser.o): in function `http_parser_version':
/home/maksims/Documents/PlatformIO/Projects/iot-middleware-freertos-samples-old/libs/azure-iot-middleware-freertos/libraries/coreHTTP/source/dependency/3rdparty/http_parser/http_parser.c:2566:
multiple definition of `http_parser_version';
.pio/build/esp-wrover-kit/esp-idf/nghttp/libnghttp.a(http_parser.o):
/home/maksims/.platformio/packages/framework-espidf@3.40403.0/components/nghttp/port/http_parser.c:2490: first defined here

I am curious how could idf.py compile without any conflicts? And how could I make it work for PlatformIO?

Any help would be really appreciated!

Maksim

It is solved now, I’ve added azure-iot-middleware-freertos as a dependency, created library.json with include paths and selected source files (using srcFilter).

1 Like

Would you mind giving a bit more information on how you solved the issue? I can’t find it in your github repo. Thanks.

Sure, I uploaded the github repo with a project. I am happy to help.