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!


#6

any update on this? I am using

versionPlatformIO, version 3.6.0a10
and
Updating tool-scons @ 2.20501.4 [Up-to-date]
Updating tool-unity @ 1.20403.0 [Up-to-date]
Updating contrib-pysite @ 0.3.2 [Up-to-date]
Updating contrib-piohome @ 1.0.1 [Up-to-date]
Updating tool-pioplus @ 1.4.2 [Up-to-date]

Platform Manager
================
Platform Espressif 32
--------
Updating espressif32                     @ 1.1.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.6.0          [Up-to-date]
Updating tool-espotapy                   @ 1.1.1          [Up-to-date]
Updating framework-espidf                @ 2.301.0        [Up-to-date]
Updating tool-esptoolpy                  @ 1.20410.0      [Up-to-date]

.platformio/packages/framework-espidf/components/aws_iot/include/aws_iot_config.h:40:33: error: 'CONFIG_AWS_IOT_MQTT_TX_BUF_LEN' undeclared here (not in a f

unction)


#7

Have you tried this example and the latest upstream version of dev/platform?


Initial use of PlatformIO for ESP IDF and AWS IoT
#8

@ivankravets that was helpful. I have one problem. My DCONFIG_WIFI_SSID is two words, so
DCONFIG_WIFI_SSID=“first’s part” and I am getting parsing errors.
i have tried to do multiple slashes
DCONFIG_WIFI_SSID=“first’s"part” similar to this: “hello"world”, but it still fails.
Suggestions?


#9

Try to escape password with \\ char. -DCONFIG_WIFI_SSID=“first’s\ part” or -DCONFIG_WIFI_SSID=“first’s\\ part”


#10
  -DCONFIG_WIFI_SSID=\"first'spart\"
  -DCONFIG_WIFI_PASSWORD=\"password\"

If I don’t have the leading and trailing , i get parsing errors and random character errors, but neither the\ or \\ works for me.
It doesn’t like the apostrophe either. If I remove the ', it works fine.


#11

any updates or suggestions on how to solve this?


#12

@valeros could you help here?


#13

Hi @wegunterjr! What is your OS? Could you provide a minimal project with this behavior so I can reproduce the issue?


#14

I am using Windows 10, and using the example AWS IoT project.
The issue is the SSID having two words and an apostrophe.


#15

Could you try something like this:

build_flags = -DSSID_NAME=\"It\'s\ a\ ssid\"

#16

So far, so good. That worked.

No parsing errors.

It fails, but not because of this.

It fails because it can’t find some references (after trying to link)
Does it still required the upstream https://github.com/platformio/platform-espressif32.git

_start'
.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.aws_iot_task+0x1c): undefined reference to `_binary_src_certificate_pem
_crt_start'
.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.aws_iot_task+0x20): undefined reference to `_binary_src_private_pem_key
_start'
.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.aws_iot_task+0x8c): undefined reference to `aws_iot_mqtt_init'

.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.aws_iot_task+0x90): undefined reference to `aws_iot_mqtt_connect'
.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.aws_iot_task+0x94): undefined reference to `aws_iot_mqtt_subscribe'
.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.aws_iot_task+0x98): undefined reference to `aws_iot_mqtt_yield'
.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.aws_iot_task+0xa0): undefined reference to `aws_iot_mqtt_publish'
.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.aws_iot_task+0xa4): undefined reference to `aws_iot_mqtt_autoreconnect_
set_status'
.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.disconnectCallbackHandler+0x14): undefined reference to `aws_iot_is_aut
oreconnect_enabled'
.pioenvs\esp32dev\src\subscribe_publish_sample.o:(.literal.disconnectCallbackHandler+0x18): undefined reference to `aws_iot_mqtt_a
ttempt_reconnect'
.pioenvs\esp32dev\src\subscribe_publish_sample.o: In function `aws_iot_task':
subscribe_publish_sample.c:(.text.aws_iot_task+0x91): undefined reference to `aws_iot_mqtt_init'
subscribe_publish_sample.c:(.text.aws_iot_task+0xf5): undefined reference to `aws_iot_mqtt_connect'
subscribe_publish_sample.c:(.text.aws_iot_task+0x165): undefined reference to `aws_iot_mqtt_subscribe'
subscribe_publish_sample.c:(.text.aws_iot_task+0x1c2): undefined reference to `aws_iot_mqtt_yield'
subscribe_publish_sample.c:(.text.aws_iot_task+0x207): undefined reference to `aws_iot_mqtt_publish'
subscribe_publish_sample.c:(.text.aws_iot_task+0x238): undefined reference to `aws_iot_mqtt_publish'
subscribe_publish_sample.c:(.text.aws_iot_task+0x286): undefined reference to `aws_iot_mqtt_autoreconnect_set_status'
.pioenvs\esp32dev\src\subscribe_publish_sample.o: In function `disconnectCallbackHandler':
subscribe_publish_sample.c:(.text.disconnectCallbackHandler+0x1d): undefined reference to `aws_iot_is_autoreconnect_enabled'
subscribe_publish_sample.c:(.text.disconnectCallbackHandler+0x4d): undefined reference to `aws_iot_mqtt_attempt_reconnect'
collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\esp32dev\firmware.elf] Error 1

#17

Thanks, fixed in https://github.com/platformio/platformio-core/commit/8f19dd50fe245e7eb4f98469b2ef665f22e497f4


#18

Got same problem. ESP32 projects not compiling anymore.

.platformio\packages\framework-espidf\components\aws_iot\aws-iot-device-sdk-embedded-C\src\aws_iot_mqtt_client.c:43:
D:/users/ad/.platformio/packages/framework-espidf/components/aws_iot/include/aws_iot_config.h:40:33: error: ‘CONFIG_AWS_IOT_MQTT_TX_BUF_LEN’ undeclared here (not in a function)

What can i do? How to use your patch?
Latest PIO installed now (Home 1.0.2·Core 3.6.0)


#19

Please use sdkconfig.h from https://github.com/platformio/platform-espressif32/tree/develop/examples/espidf-aws-iot/src


#20

Copied (with replace) all CONFIG_AWS_XXXX options into my sdkconfig.h and now all works fine.

Thanks a lot!