How to add lib_apptrace.a to project (ESP32)

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