Using esp-azure in a component

MoritzSchwoerer
Posts: 2
Joined: Tue Jul 06, 2021 2:03 pm

Using esp-azure in a component

Postby MoritzSchwoerer » Fri Jul 09, 2021 9:16 am

Hello,

we want to use the esp-azure library in a esp-idf-component, but we are getting errors during the linker-process.
The code below shows a section of the error messages.

We are using the esp-idf v4.3 with the actual version from the esp-azure library with an ESP32S2.
  1. [986/987] Linking CXX executable app.elf
  2. FAILED: *******.elf
  3. cmd.exe /C "cd . && ~\.espressif\tools\xtensa-esp32s2-elf\esp-2020r3-8.4.0\xtensa-esp32s2-elf\bin\xtensa-esp32s2-elf-g++.exe  -mlongcalls   @CMakeFiles\esign.elf.rsp  -o esign.elf  && cd ."
  4. ~/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: esp-idf/cloud/libcloud.a(cloud.c.obj):(.literal.register_device_callback+0xc): undefined reference to `mallocAndStrcpy_s'
  5. ~/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: esp-idf/cloud/cloud.a(cloud.c.obj):(.literal.cloud_init+0x10): undefined reference to `Prov_Device_MQTT_Protocol'
  6. [...]
  7.  
In our CMakeList.txt of the cloud component we have already specified the "port" component as required.
  1. set(component_srcs "src/cloud.c")
  2.  
  3. idf_component_register(SRCS "${component_srcs}"
  4.                        INCLUDE_DIRS "include" "."
  5.                        PRIV_INCLUDE_DIRS ""
  6.                        PRIV_REQUIRES "driver"
  7.                        REQUIRES "port"
  8.                        EMBED_FILES  "certificates/leaf_certificate.pem"
  9.                                             "certificates/leaf_private_key.pem")
  10.  
  11. component_compile_definitions(SET_TRUSTED_CERT_IN_SAMPLES)
In our top-level-CMakeList we have already set the extra component directory:
  1. cmake_minimum_required(VERSION 3.5)
  2.  
  3. include($ENV{IDF_PATH}/tools/cmake/project.cmake)
  4.  
  5. set (EXTRA_COMPONENT_DIRS "../../esp-azure/port")
  6.  
  7. set(COMPONENT_ADD_INCLUDEDIRS ".")
  8.  
  9. project(......)
  10. idf_build_set_property(COMPILE_OPTIONS "-Werror" APPEND)
  11.  
Can anybody post an example, with the esp-azure library used in a component?

Thank you!

ESP_Minatel
Posts: 364
Joined: Mon Jan 04, 2021 2:06 pm

Re: Using esp-azure in a component

Postby ESP_Minatel » Fri Jul 09, 2021 12:40 pm

Hi,

Here is one example: https://github.com/pedrominatel/esp32-p ... -component

To clone this repo use:

Code: Select all

git clone --recursive git@github.com:pedrominatel/esp32-projects.git
This is the branch you can use for the Azure SDK for C as a submodule (already used by the repo I shared):

https://github.com/Azure/azure-sdk-for- ... ef0e3cd76a

MoritzSchwoerer
Posts: 2
Joined: Tue Jul 06, 2021 2:03 pm

Re: Using esp-azure in a component

Postby MoritzSchwoerer » Mon Jul 12, 2021 1:02 pm

Hi,
thank you for the quick reply. I got this running, but i want to use the esp-azure library inside a component. In the example you sent, you are using the azure-component in the main file. Do you have any tips to use the azure-component in a idf-component?

For example: I have a azure component, a cloud component and the main file. Now i want to use the azure-component in the cloud-component.

Thanks for your help.

Who is online

Users browsing this forum: No registered users and 95 guests