Compilation fails when using esp_apptrace_init() - JTAG

n47h4n
Posts: 11
Joined: Sun Mar 05, 2023 10:59 am

Compilation fails when using esp_apptrace_init() - JTAG

Postby n47h4n » Sun Apr 02, 2023 8:00 am

Hello everyone.
I'm trying to build a small program for testing JTAG 2-ways communication.
I have the error:

Code: Select all

/Users/nb/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /Users/nb/.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'
/Users/nb/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /Users/nb/.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'
[...]
collect2: error: ld returned 1 exit status
*** [.pio/build/esp-wrover-kit/firmware.elf] Error 1
This error disappears if I remove the line containing a call to esp_apptrace_init()
I'm working under platformIO in CLI mode.

I'm lost...

Here's the small code:

Code: Select all

#include <Arduino.h>
#include "esp_app_trace.h"

esp_err_t res;

void setup() {
  Serial.begin(115200);
  /* Init communication JTAG */
  res = esp_apptrace_init();     <====== line that cause the error
  if (res != ESP_OK) {
      log_e("Failed to init JTAG communication");
  }
}

void loop() {
  /* Send to PC */
  char buf_to_pc[] = "Hello World!";
  res = esp_apptrace_write(ESP_APPTRACE_DEST_JTAG, buf_to_pc, strlen(buf_to_pc), ESP_APPTRACE_TMO_INFINITE);
  if (res != ESP_OK) {
      log_e("Failed to write data to host!");
  }
  res = esp_apptrace_flush(ESP_APPTRACE_DEST_JTAG, ESP_APPTRACE_TMO_INFINITE);
  if (res != ESP_OK) {
      log_e("Failed to flush data to host!");
  }

  /* Receive from PC */
  char buf[32];
  char down_buf[32];
  size_t sz = sizeof(buf);
  
  /* config down buffer */
  esp_apptrace_down_buffer_config((uint8_t*) down_buf, sizeof(down_buf));
  /* check for incoming data and read them if any */
  res = esp_apptrace_read(ESP_APPTRACE_DEST_JTAG, buf, &sz, 0/*do not wait*/);
  if (res != ESP_OK) {
      log_e("Failed to read data from host!");
  }
  if (sz > 0) {
      /* we have data, process them */
  }
}
And here's the platformio.ini file:

Code: Select all

[env:esp-wrover-kit]
platform = espressif32
board = esp-wrover-kit
framework = arduino
upload_speed = 921600
monitor_speed = 115200
build_type = debug
debug_tool = esp-prog
build_flags = -DBOARD_HAS_PSRAM
              -mfix-esp32-psram-cache-issue
              -DCORE_DEBUG_LEVEL=4
Is this an espressif issue or a platformIO one?

Any help would be greatly appreciated.
Thanks in advance.
Nathan.

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: Compilation fails when using esp_apptrace_init() - JTAG

Postby lbernstone » Sun Apr 02, 2023 9:29 pm

The arduino libraries are not compiled with jtag apptracing active. You will either need to build your own arduino libraries with lib-builder, or build from scratch in platform.io using `framework = espidf, arduino` and a customized sdkconfig

n47h4n
Posts: 11
Joined: Sun Mar 05, 2023 10:59 am

Re: Compilation fails when using esp_apptrace_init() - JTAG

Postby n47h4n » Fri Apr 07, 2023 6:40 pm

Thanks for your reply @lbernstone

I don't understand what you mean by "a customized sdkconfig".
Is there a doc somewhere?

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: Compilation fails when using esp_apptrace_init() - JTAG

Postby lbernstone » Fri Apr 07, 2023 10:06 pm

Maybe some documentation somewhere on platformio website.
https://github.com/platformio/platform- ... uino-blink

Who is online

Users browsing this forum: Google [Bot] and 50 guests