Hi, I am trying to use PlatformIO to compile Heltec WiFi_LoRa_32_V3 but always stopped by the compile error as below about “ESP32_LoRaWAN.cpp.o:(.literal._ZN12LoRaWanClass5sleepE12eDeviceClassh+0x0): undefined reference to `Radio’”
It seems I didn’t well compile the radio for SX1262, any idea to fix this?
My PlatformIO.ini (overwrote from ESP32 dev module + Arduin0) -
and put them in the project tree (under the lib directory) to make platformio build them as static librairies (which it actually makes) and use them when linking (which it also make as the library name appears in ld command in verbose mode).
Oh I see. Sneaky. They are doing some licencsing stuff in this library, based on the symbol names in this library. So this may not be compatible with an unmodified Arduino-ESP32 core at all if they flash additional data or have mods in other places.
Sad, that should have been taken core of by enabling radio.c to compile its contents using the WIFI_LoRa_32_V3 define. Are you sure your C++ file is accessing this C object correctly? Do you #include <radio.h> to get the extern "C" etc definitions of this struct?
Did you clean recompile the project? (Project Tasks → Clean → then Build)
This is driving me nuts !
I only took the Heltec example unmodified and can compile it without any error with arduino-ide.
I’m trying to port to platformio environment because I prefer to use this but it’s a real pain.
Adding #include <radio.h> (actually #include <radio/radio.h> because it’s part of LoraWan102 lib doesn’t help).
And every time I CleanAll to be sure…
Retrieving maximum program size .pio/build/heltec_wifi_lora_32_V3/firmware.elf
Checking size .pio/build/heltec_wifi_lora_32_V3/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 14.0% (used 45824 bytes from 327680 bytes)
Flash: [== ] 21.5% (used 717065 bytes from 3342336 bytes)
Creating esp32s3 image...
Merged 3 ELF sections
Successfully created esp32s3 image.
============================================ [SUCCESS] Took 8.12 seconds ============================================
I felt the #define WIFI_LoRa_32_V3 true in the pins_arduino.h was wrong so I deleted that line in C:\Users\<user>\.platformio\packages\framework-arduinoespressif32\variants\heltec_wifi_lora_32_V3\pins_arduino.h and added it via build_flags. No further mods to the core package files needed.
I somewhat messed up with my .platformio directory (not so a surprise considering the number of tests/tries I made). So I’ve deleted all the .platformio/packages/framework-arduinoespressif32* directories to force platformio to download it again cleanly
But now, with your help, finally it works !!!
Thank you very much for your help. Now I can concentrate on my real project !
When I have this “heltecautomation/ESP32_LoRaWAN@^2.1.1” in the ini, the compile was well done, but after upload the image to v3 board, it keeps rebooting, it is killing me now, can you explict how you make this ?
in any case, from the heltec core you’ll need to copy tools\sdk\esp32\lib\libheltec.a to e.g. a new folder in your project, say precompiled_libs in the root of the project, then add
to the build_flags to link in precompiled_libs/libheltec.a.