Page 1 of 1

How to add lib_apptrace.a to project (ESP32)

Posted: Fri Sep 29, 2023 5:20 am
by vahidajalluian
I am using vscode, Platformio and arduino platform for programming. Now what I am looking for is how can I use Application tracing library to output the logs to Jtag.
Here is the code

Code: Select all

#include <Arduino.h>
#include "esp_log.h"
#include "esp_app_trace.h"
void setup() {
esp_apptrace_init();
}
void loop() {
}
when I compile in vscode, the error log would be:

Code: Select all

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
Your ASAP help is appreciated
Also please visit this one
https://community.platformio.org/t/how- ... 32/35816/6

Re: How to add lib_apptrace.a to project (ESP32)

Posted: Sat Sep 30, 2023 8:05 pm
by lbernstone
The pre-compiled libraries for arduino do not include apptrace. You would need to compile your own with the CONFIG_APPTRACE_ENABLE option enabled using lib-builder.
https://docs.espressif.com/projects/ard ... onent.html
https://github.com/espressif/esp32-ardu ... lease/v4.4