ESP32 Cannot reference aws_iot since latest update (1.0.2)


#1

Good day;

I am currently using PlatformIO via Visual Studio Code on Windows, using the latest esp32 frameworks (1.0.2, see below for an output of pio update), and currently cannot get the aws_iot files to compile / link / copy for my projects anymore… I do not see the aws_iot folder with the object files copied to the project directory, and while the project appears to build, it cannot link as it cannot find the references that would be present if the object files were present.

Now, this was working prior to the update, however no amount of updating the sdkconfig.h file appears to help? I am at the least adding

#define CONFIG_AWS_IOT_SDK 1

to the sdkconfig.h file with no luck…

You can reproduce this issue with a new project using the IDF and create a main.c file simply containing

//********************************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <limits.h>
#include <string.h>

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event_loop.h"
#include "esp_log.h"
#include "esp_vfs_fat.h"
#include "driver/sdmmc_host.h"
#include "nvs.h"
#include "nvs_flash.h"
#include "aws_iot_config.h"
#include "aws_iot_log.h"
#include "aws_iot_version.h"
#include "aws_iot_mqtt_client_interface.h"

void app_main()
{
     AWS_IoT_Client client;
     aws_iot_mqtt_autoreconnect_set_status(&client, true);
}
//********************************************************************************************
  • Note this code does ‘nothing’ however it reproduces the same error / effect with my project, resulting in
    .pioenvs\esp32dev\src\main.o:(.literal.app_main+0x0): undefined reference to aws_iot_mqtt_autoreconnect_set_status

Is there a new / different way to add aws_iot to my project, or am I missing something simple(hopefully!)

Thank you!

//****************************************************************
pio update information:
platformio update
Updating tool-scons                      @ 2.20501.4      [Up-to-date]
Updating tool-unity                      @ 1.20403.0      [Up-to-date]
Updating contrib-pysite                  @ 0.2.0          [Up-to-date]
Updating contrib-piohome                 @ 0.9.6          [Up-to-date]
Updating tool-pioplus                    @ 1.3.1          [Up-to-date]

Platform Manager
================
Platform Espressif 32
--------
Updating espressif32                     @ 1.0.2          [Up-to-date]
Updating toolchain-xtensa32              @ 2.50200.80     [Up-to-date]
Updating tool-mkspiffs                   @ 2.230.0        [Up-to-date]
Updating framework-arduinoespressif32    @ 1.5.3          [Up-to-date]
Updating tool-espotapy                   @ 1.1.0          [Up-to-date]
Updating framework-espidf                @ 2.300.0        [Up-to-date]
Updating tool-esptoolpy                  @ 1.20310.0      [Up-to-date]

Platform Espressif 32
--------
Updating espressif32                     @ c9e69a8        [Up-to-date]
Updating toolchain-xtensa32              @ 2.50200.80     [Up-to-date]
Updating tool-mkspiffs                   @ 2.230.0        [Up-to-date]
Updating framework-arduinoespressif32    @ 1.5.3          [Up-to-date]
Updating tool-espotapy                   @ 1.1.0          [Up-to-date]
Updating framework-espidf                @ 2.300.0        [Up-to-date]
Updating tool-esptoolpy                  @ 1.20310.0      [Up-to-date]

#2

Does it work with platform = espressif32@<1 in platformio.ini?


#3

Not quite - while it is compiling and copying the aws_iot folder object files if i change this, I now am getting some compile errors regarding defines missing with the sdkconfig.h file that comes with a New Project.

  • specifically,
    brownout.c:34:45: error: ‘CONFIG_BROWNOUT_DET_RESETDELAY’ undeclared (first use in this function)
    so I’ve addressed this by changing
    #define CONFIG_BROWNOUT_DET 0
    which then yields
    error: ‘CONFIG_BTDM_CONTROLLER_RUN_CPU’ undeclared
  • which is addressed by adding
    #define CONFIG_BTDM_CONTROLLER_RUN_CPU 0
    to sdkconfig.h
    resulting in
    error: ‘CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX’ undeclared
    , addressed with
    #define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0

At this point I’m reasonably certain that platformio.ini change requires a different sdkconfig.h file - as it’s now ‘building’, however linking results in a syntax error:

Linking .pioenvs\esp32dev\firmware.elf
c:/users/hammondeggs/.platformio/packages/toolchain-xtensa32@1.50200.2/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe:esp32_out.ld:23: syntax error
collect2.exe: error: ld returned 1 exit status


#4

Just remove this new file from project, old version of dev/platform will create a new one.


#5

Ok, with the platform = espressif32@<1 change in platform.ini, deleting the sdkconfig.h does cause it to be recreated however it does not appear to use the ‘older’ sdkconfig.h (as I still need to make those changes I mentioned above) -

However…

I do know what caused this particular error now, and I’m not sure if this is related to platformio or the toolchain…

The error in the esp32_out.ld file was in my case being caused by the sdkconfig.h file having a commented out line in it.

For instance, in sdkconfig.h

#define CONFIG_LOG_DEFAULT_LEVEL_INFO 1
//#define CONFIG_BT_RESERVE_DRAM 0x10000
#define CONFIG_FATFS_FS_LOCK 0

This //define above here was causing the issue, but note you may have to perform a clean before it occurs, where it will continue to do so. On opening the esp32_out.ld file you see

  • Automatically generated file; DO NOT EDIT.
  • Espressif IoT Development Framework Configuration

/
//#define CONFIG_BT_RESERVE_DRAM 0x10000
MEMORY
{
/
All these values assume the flash cache is on, and have the blocks this uses subtracted from the length
of the various regions. The ‘data access port’ dram/drom regions map to the same iram/irom regions but
are connected to the data port of the CPU and eg allow bytewise access. */
…etc

Right above “MEMORY” the commented out #define is for some reason copied to the .ld file, causing this error.

So it appears this error was being caused by commenting out defines in the sdkconfig.h. Removing these or setting them to 0 where appropriate is likely the best course of action. The issue however with the latest version does not work with aws_iot remains however.

Thank you!