Visual Micro
Visual Micro >> Hardware Debugging (GDB, GDB WiFi, GDB Stub) >> EDP-IDF Compiling + OpenOCD GDB JTAG Debugging?

Message started by goj immypi on Sep 27th, 2021 at 2:49am

Title: EDP-IDF Compiling + OpenOCD GDB JTAG Debugging?
Post by goj immypi on Sep 27th, 2021 at 2:49am
I noticed in another post that:

> We have something that we think will open things up nicely for IDF and others.

> Hopefully we have time to complete the implementation during the coming couple of months

However, I've not been able to find any details on the current status.

I'm currently trying to use Visual Micro to use a Segger J-Link to single-step JTAG debug an Espressif ESP32 ESP-IDF project as mentioned on twitter.

I've struggled quite a bit. Not only needing to manually edit my json file to look like this:

Code (]{
  // GDB Project:  "$(ProjectName)"
  // Microsoft MI:
  // Visualizations:
  // User Guide:
  // Tips: To access resolved Arduino 3rd party hardware spec. properties, use $(variables) with the same name as the mi json prpperties
  //       To access Visual Studio macros and environment variables or hard code
  // This file is for advanced use. Please use the pre-configured built-in hardware debuggers where possible.

  "serverLaunchTimeout": 5000,
  "filterStdout": false,
  "filterStderr": true,
  "targetArchitecture": "arm",
  "stopAtEntry": false,
  "externalConsole": false,
  "MIMode": "gdb",
  //"environment": [):

  //"customLaunchSetupCommands": [],
  "MIDebuggerServerAddress": "localhost:3333",
  "cwd": "C:\\workspace\\wolfssl-esp32\\wolfssl_ssh_server\\build",

  "MIDebuggerPath": "C:\\Users\\gojimmypi\\.espressif\\tools\\xtensa-esp32-elf\\esp-2021r1-8.4.0\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gdb.exe",
  "MIDebuggerArgs": "build/wolfssl_ssh_server.elf -x gdbinit",

  "debugServerPath": "C:\\Users\\gojimmypi\\.espressif\\tools\\openocd-esp32\\v0.10.0-esp32-20210401\\openocd-esp32\\bin\\openocd.exe",
  "debugServerArgs": "-f interface/jlink.cfg -c adapter_khz 1000 -f target/esp32.cfg",
  //  "setupCommands": [],
  "program": "C:\\workspace\\wolfssl-esp32\\wolfssl_ssh_server\\build\\wolfssl_ssh_server.elf",
  "logging": {
    "moduleLoad": false,
    "trace": false,
    "engineLogging": false,
    "programOutput": false,
    "exceptions": false,
    "traceResponse": false


... but I've also had to edit the project properties "Extra c flags" as well as "extra cpp flags" to include other system libraries that Visual Micro does not find, but should be searched for in the esp-idf\components directory.

btw - it was really quite annoying to find the the include file settings in the normal project properties location kept getting overwritten (with Arduino paths nonetheless) at build time.  ;) Thanks to this post for an alternative solution.

Even after getting the application to at least compile, I still ended up with a ton of linker errors like this:

[code]ld.exe: main\server.c.o:(.literal.PwMapNew+0x0): undefined reference to wc_InitSha256
ld.exe: main\server.c.o:(.literal.PwMapNew+0x4): undefined reference to wc_Sha256Update
ld.exe: main\server.c.o:(.literal.PwMapNew+0x8): undefined reference to wc_Sha256Final

And this is all before even trying to get the OpenOCD/GDB JTAG debugger going.

I should note that the code as-is otherwise compiles just fine from a WSL prompt using make in the IDF environment. I have the the project on github.

Any tips on using the ESP-IDF from within Visual Studio instead of the Arduino libraries?

I'm using Visual Studio 2019 Enterprise 16.10.3 and Visual Micro 2021.917.0. I believe all my project settings can be found in the __vm directory

Visual Micro » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2021. All Rights Reserved.