PlatformIO Community

Error on xtensa

Hi,
Hello everybody,
i am having an error with xtensa. Can anyone tell me what it could be?
image

PlatformIO already officially supports 2.0.3. Does the same error happen when using platform = espressif32?

image

Is your ESP32 platform up-to-date? Please use CLI and pio platform update espressif32.

Utente@PC-Fabio ~/D/P/P/a/abiot-gateway (master)> pio platform update espressif32

WARNING: This command is deprecated and will be removed in the next releases.
Please use pio pkg update instead.

Platform Manager: espressif32@4.4.0 is already up-to-date
Tool Manager: framework-arduinoespressif32@3.20003.220619 is already up-to-date
Tool Manager: tool-esptoolpy@1.30300.0 is already up-to-date
Tool Manager: tool-mklittlefs@1.203.210628 is already up-to-date
Tool Manager: tool-mkspiffs@2.230.0 is already up-to-date
Tool Manager: toolchain-esp32s2ulp@1.22851.191205 is already up-to-date
Tool Manager: toolchain-riscv32-esp@8.4.0+2021r2-patch3 is already up-to-date
Tool Manager: toolchain-xtensa-esp32@8.4.0+2021r2-patch3 is already up-to-date
Tool Manager: toolchain-xtensa-esp32s2@8.4.0+2021r2-patch3 is already up-to-date
Utente@PC-Fabio ~/D/P/P/a/abiot-gateway (master)>

This error comes from the package itself and just including Arduino.h, that’s not good. Please remove the folder C:\Users\<user>\.platformio\packages\framework-arduinoespressif32 and try building again.

All 4?
image

The first one would be sufficient.

I deleted the folder, and I also deleted the “.pio” folder and then compiled. But it gives me another mistake:

Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-cpu.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-dac.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-gpio.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-i2c-slave.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-i2c.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-ledc.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-matrix.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-misc.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-psram.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-rmt.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-sigmadelta.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-spi.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-time.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-timer.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-tinyusb.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-touch.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\esp32-hal-uart.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\firmware_msc_fat.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\libb64\cdecode.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\libb64\cencode.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\main.cpp.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\stdlib_noniso.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\abiot-gateway-arduinoesp32\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\abiot-gateway-arduinoesp32\libFrameworkArduino.a
Linking .pio\build\abiot-gateway-arduinoesp32\firmware.elf
c:/users/utente/.platformio/packages/toolchain-xtensa-esp32s2@8.4.0+2021r2-patch3/bin/…/lib/gcc/xtensa-esp32s2-elf/8.4.0/…/…/…/…/xtensa-esp32s2-elf/bin/ld.exe: .pio/build/abiot-gateway-arduinoesp32/src/lora/CommunicationAbiot.cpp.o:(.literal._ZN18CommunicationAbiot11initModemTXEv+0x14): undefined reference to LoRa_E220::LoRa_E220(SoftwareSerial*, unsigned char, unsigned char, unsigned char, UART_BPS_RATE)' c:/users/utente/.platformio/packages/toolchain-xtensa-esp32s2@8.4.0+2021r2-patch3/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: .pio/build/abiot-gateway-arduinoesp32/src/lora/CommunicationAbiot.cpp.o: in function CommunicationAbiot::initModemTX()’:
C:\Users\Utente\Documents\PlatformIO\Projects\abiot\abiot-gateway/src/lora/CommunicationAbiot.cpp:321: undefined reference to LoRa_E220::LoRa_E220(SoftwareSerial*, unsigned char, unsigned char, unsigned char, UART_BPS_RATE)' c:/users/utente/.platformio/packages/toolchain-xtensa-esp32s2@8.4.0+2021r2-patch3/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: .pio/build/abiot-gateway-arduinoesp32/src/lora/CommunicationAbiot.cpp.o: in function CommunicationAbiot::initModemRX()’:
C:\Users\Utente\Documents\PlatformIO\Projects\abiot\abiot-gateway/src/lora/CommunicationAbiot.cpp:343: undefined reference to `LoRa_E220::LoRa_E220(SoftwareSerial*, unsigned char, unsigned char, unsigned char, UART_BPS_RATE)’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\abiot-gateway-arduinoesp32\firmware.elf] Error 1
============================================================================================================== [FAILED] Took 363.63 seconds ==============================================================================================================
Il processo del terminale “C:\Users\Utente.platformio\penv\Scripts\platformio.exe ‘run’” è stato terminato. Codice di uscita: 1.

Terminale verrà riutilizzato dalle attività, premere un tasto qualsiasi per chiuderlo.

Is the library that supplise this object / class still in the dependency graph?

I seem to see it

Dependency Graph
|-- PubSubClient @ 2.8.0
|-- TinyGSM @ 0.11.5
|-- EspSoftwareSerial @ 6.16.1
|-- RTClib @ 1.14.2
|   |-- Wire @ 2.0.0
|-- Regexp @ 0.1.0
|-- ArduinoJson @ 6.19.4
|-- Ethernet @ 2.0.0
|   |-- SPI @ 2.0.0
|-- SSLClient @ 1.6.11
|-- AsyncElegantOTA @ 2.2.7
|   |-- AsyncTCP-esphome @ 1.2.2
|   |-- ESPAsyncWebServer-esphome @ 2.1.0
|   |   |-- AsyncTCP-esphome @ 1.2.2
|   |   |-- FS @ 2.0.0
|   |   |-- WiFi @ 2.0.0
|   |   |-- ArduinoJson @ 6.19.4
|   |-- FS @ 2.0.0
|   |-- Update @ 2.0.0
|   |-- WiFi @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- AsyncTCP-esphome @ 1.2.2
|   |-- FS @ 2.0.0
|   |-- WiFi @ 2.0.0
|   |-- ArduinoJson @ 6.19.4
|-- EByte LoRa E220 library @ 1.0.3
|   |-- EspSoftwareSerial @ 6.16.1
|-- WiFi @ 2.0.0
|-- SPI @ 2.0.0
|-- AsyncTCP-esphome @ 1.2.2
|-- WiFiClientSecure @ 2.0.0
|   |-- WiFi @ 2.0.0

The library only enables the software serial constructors if you activate a macro.

Use

build_flags = -DACTIVATE_SOFTWARE_SERIAL -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG

in the platformio.ini.

I used

[env:esp32-s2-saola-1]
platform = espressif32
board = esp32-s2-saola-1
framework = arduino
lib_deps =
   plerup/EspSoftwareSerial@^6.13.2
   xreef/EByte LoRa E220 library@^1.0.3
build_flags = -DACTIVATE_SOFTWARE_SERIAL

to v erify this.

On the other hand I could argue that since the ESP32 can create a hardware serial on any pins anyway, you should use those constructors

with e.g. the Serial1 object that you still have on the SoC. Hardware-based serial should be better than software-based serial, unless you really need that hardware serial for something else.

Unfortunately I use the two serial ports already present to communicate with SIMCOM GSM and with Ethernet Shield.

So how can I solve my problem using serial software?

I was using this construction

where 4 means IO4 pin etc.

Just uncomment this and adapt pins. (Needs -DACTIVATE_SOFTWARE_SERIAL)

Uhm :neutral_face:

c:/users/utente/.platformio/packages/toolchain-xtensa-esp32s2@8.4.0+2021r2-patch3/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: .pio/build/abiot-gateway-arduinoesp32/src/lora/CommunicationAbiot.cpp.o:(.literal._ZN18CommunicationAbiot11initModemTXEv+0x14): undefined reference to `LoRa_E220::LoRa_E220(SoftwareSerial*, unsigned char, unsigned char, unsigned char, UART_BPS_RATE)'
c:/users/utente/.platformio/packages/toolchain-xtensa-esp32s2@8.4.0+2021r2-patch3/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: .pio/build/abiot-gateway-arduinoesp32/src/lora/CommunicationAbiot.cpp.o: in function `CommunicationAbiot::initModemTX()':
C:\Users\Utente\Documents\PlatformIO\Projects\abiot\abiot-gateway/src/lora/CommunicationAbiot.cpp:321: undefined reference to `LoRa_E220::LoRa_E220(SoftwareSerial*, unsigned char, unsigned char, unsigned char, UART_BPS_RATE)'
c:/users/utente/.platformio/packages/toolchain-xtensa-esp32s2@8.4.0+2021r2-patch3/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: .pio/build/abiot-gateway-arduinoesp32/src/lora/CommunicationAbiot.cpp.o: in function `CommunicationAbiot::initModemRX()':
C:\Users\Utente\Documents\PlatformIO\Projects\abiot\abiot-gateway/src/lora/CommunicationAbiot.cpp:343: undefined reference to `LoRa_E220::LoRa_E220(SoftwareSerial*, unsigned char, unsigned char, unsigned char, UART_BPS_RATE)'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\abiot-gateway-arduinoesp32\firmware.elf] Error 1

My Platformio.io:

[env:abiot-gateway-arduinoesp32]
#platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2idf/platform-espressif32-2.0.2.zip
platform: espressif32
framework = arduino
board = esp32-s2-saola-1
lib_deps = 
	knolleary/PubSubClient@^2.8
	vshymanskyy/TinyGSM@^0.11.4
	plerup/EspSoftwareSerial@^6.13.2
	adafruit/RTClib@^1.14.1
	nickgammon/Regexp@^0.1.0
	bblanchon/ArduinoJson@^6.18.5
	arduino-libraries/Ethernet@^2.0.0
	openslab-osu/SSLClient@^1.6.11
	ayushsharma82/AsyncElegantOTA@^2.2.6
	ottowinter/ESPAsyncWebServer-esphome@^2.1.0
	# EByte-LoRa
	xreef/EByte LoRa E220 library@^1.0.3
upload_port = COM11
monitor_port = COM11
build_flags = -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
-DACTIVATE_SOFTWARE_SERIAL -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG

Can you show your current full platformio.ini?

What code is at /src/lora/CommunicationAbiot.cpp:321?

image

This appears double? The need to be either on the same line or separated by newlines with at least two spaces at the front.

Can you use

[env:abiot-gateway-arduinoesp32]
#platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2idf/platform-espressif32-2.0.2.zip
platform: espressif32
framework = arduino
board = esp32-s2-saola-1
lib_deps = 
	knolleary/PubSubClient@^2.8
	vshymanskyy/TinyGSM@^0.11.4
	plerup/EspSoftwareSerial@^6.13.2
	adafruit/RTClib@^1.14.1
	nickgammon/Regexp@^0.1.0
	bblanchon/ArduinoJson@^6.18.5
	arduino-libraries/Ethernet@^2.0.0
	openslab-osu/SSLClient@^1.6.11
	ayushsharma82/AsyncElegantOTA@^2.2.6
	ottowinter/ESPAsyncWebServer-esphome@^2.1.0
	# EByte-LoRa
	xreef/EByte LoRa E220 library@^1.0.3
upload_port = COM11
monitor_port = COM11
build_flags =
   -DACTIVATE_SOFTWARE_SERIAL
   -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG

and recheck?

Good man!

Linking .pio\build\abiot-gateway-arduinoesp32\firmware.elf
Retrieving maximum program size .pio\build\abiot-gateway-arduinoesp32\firmware.elf
Checking size .pio\build\abiot-gateway-arduinoesp32\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  15.0% (used 49260 bytes from 327680 bytes)
Flash: [=======   ]  66.6% (used 873498 bytes from 1310720 bytes)
Building .pio\build\abiot-gateway-arduinoesp32\firmware.bin
esptool.py v3.3
Creating esp32s2 image...
Merged 2 ELF sections
Successfully created esp32s2 image.

Thanks a lot!

1 Like