How should a library be added to the Platformio project (Arduino-based) for ESP32?
I definitely mean to add the application tracing library, a “.a” file found in the installation folder.
Is there anything that should be added to the platformio.ini file? If yes How?
This question is the following question of
No Response?
Pitty for Arduino…
-lapp_trace
is already given in the PlatformIO builder script, so the library should be linked in. If it does compile and link properly but the functionality is not working, it’s a topic for https://github.com/espressif/arduino-esp32/issues, not PlatformIO.
@maxgerhardt OK, but there is no sample code available on how to use the application tracing in Arduino with this library to forward tracing messages to Jtag. What “.h” library also should be added?
Arduino builds on ESP-IDF. Just use the same header and functions as you did in the ESP-IDF project. esp_app_trace.h is equally available.
So I tried to add this library, but it seems the linker cant find it in the scope. I use vscode with platformio and arduino framework. Anything I should add?
For more information this is the code
#include <Arduino.h>
#include "esp_log.h"
#include "esp_app_trace.h"
void setup() {
esp_apptrace_init();
}
void loop() {
}
and this is the error log
Linking .pio\build\esp32doit-devkit-v1\firmware.elf
c:/users/vahid/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\vahid\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\lib\libapp_trace.a(app_trace.c.obj):(.literal.esp_apptrace_init+0x10): undefined reference to `esp_apptrace_jtag_hw_get'
c:/users/vahid/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\vahid\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\lib\libapp_trace.a(app_trace.c.obj):(.literal.esp_apptrace_init+0x14): undefined reference to `esp_apptrace_uart_hw_get'
c:/users/vahid/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\vahid\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\lib\libapp_trace.a(app_trace.c.obj): in function `esp_apptrace_init':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/app_trace/app_trace.c:37: undefined reference to `esp_apptrace_jtag_hw_get'
c:/users/vahid/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/app_trace/app_trace.c:43: undefined reference to `esp_apptrace_uart_hw_get'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32doit-devkit-v1\firmware.elf] Error 1
So it seems it is not only Arduinos problem, but also Platformio that does not support full jtag debugging
I am going to switch to esp-idf. Shame.