Linking error on ESP32 S3 board

Hi,

I am trying to compile the gateway for the Bee S3 board (ESP32 S3) with a custom build configuration in PlatformIO. However, the compilation fails during linking because of multiple definitions of a public variable in Espressif Framework and OpenMQTTGateway:

/home/gitpod/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld: .pio/build/bee-openhab/libFrameworkArduino.a(USBCDC.cpp.o):/home/gitpod/.platformio/packages/framework-arduinoespressif32/cores/esp32/USBCDC.cpp:25: multiple definition of devices; .pio/build/bee-openhab/src/main.ino.cpp.o:/workspace/OpenMQTTGateway/main/ZgatewayBT.ino:70: first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/bee-openhab/firmware.elf] Error 1

I can avoid this error by defines vector<BLEdevice*> devices; as external in ZgatewayBT.ino. However, after deploying the firmware to the board, the board gets stuck in a boot loop, most presumably because the USBC code also uses a variable that’s called devices.

Has anybody of you ran into similar issues and knows how to resolve this?

Best,
Florian

Hello,

Could you share your custom environment?

As this s3 environment is building we may have to investigate the differences with yours:

Hi,

Thanks for getting back. It’s basically the same environment. Main difference is the board. Instead of the esp32-s3-devkitc-1, I am using a bee_s3.

Any help is much appreciated.

[env:bee-openhab]
platform = ${com.esp32_platform}
board = bee_s3
board_build.partitions = min_spiffs.csv
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.wifimanager32}
  ${libraries.ble}
  ${libraries.decoder}
  ${libraries.adafruit_neopixel}
build_flags =
  ${com-esp.build_flags}
  '-DZgatewayBT="BT"'
  '-DANEOPIX_IND_DATA_GPIO=48'
  '-DANEOPIX_IND_NUM_LEDS=1'
  '-DRGB_INDICATORS=true'
  '-DNO_INT_TEMP_READING=true' ; Internal temperature reading not building on ESP32 C3 or S3
  '-DOpenHABDiscovery=true'
  '-DGateway_Name="OMG_ESP32_BLE_OH"'
custom_description = BLE gateway with OpenHAB discovery 

Hello,

Try maybe to build and upload with esp32-s3-devkitc-1

Hi,

Already tried that. Unfortunately, the board gets stuck in a boot loop with the esp32-s3-devkitc-1 configuration.

Best,
Florian

Hi Florian, I tried compiling your environment and can confirm the linking error. As a quick hack I tried to rename “devices” in ZgatewayBT.ino . It compiled but I do not have the means of testing it. You can find the new .ino file in tryZgatewayBT.ino.zip, just a trial.

Thanks @mrickma,

I tried the firmware. It compiles. However, it still gets stuck in a reboot loop after deployment. I, unfortunately, can’t read the serial port because as soon as the system detects the board on the COM4 port, the board reboots.

Any further ideas on how to find out what could be wrong?

Best,
Florian

I question whether GPIO48 is the RGB led pin on your Bee S3 board. So as a next step I would take the led out from the build environment.

[env:bee-openhab]
platform = ${com.esp32_platform}
board = bee_s3
board_build.partitions = min_spiffs.csv
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.wifimanager32}
  ${libraries.ble}
  ${libraries.decoder}
;  ${libraries.adafruit_neopixel}
build_flags =
  ${com-esp.build_flags}
  '-DZgatewayBT="BT"'
;  '-DANEOPIX_IND_DATA_GPIO=48'
;  '-DANEOPIX_IND_NUM_LEDS=1'
;  '-DRGB_INDICATORS=true'
  '-DNO_INT_TEMP_READING=true' ; Internal temperature reading not building on ESP32 C3 or S3
  '-DOpenHABDiscovery=true'
  '-DGateway_Name="OMG_ESP32_BLE_OH"'
custom_description = BLE gateway with OpenHAB discovery 

I hope it helps.

Thanks,

I can confirm that the LED is on GPIO48. I tested this with a Hello World already that ships with the board. Regardless, will disable it and try to rebuild.

Best,
Florian