Debug on ESP32-MINI-1 with JTAG and ESP-PROG does not work

Hello everyone,

I am trying to debug the ESD-IDF Blink example on an ESP32-DevKitM-1, Espressif dev board mounting an ESP32-MINI-1 module (which is based on ESP32-U4WDH, an Xtensa® 32-bit LX6 CPU which is a single core processor). I am using platfromIO extension installed in VS Code.

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/user-guide-devkitm-1.html

At the beginning I have been stuck on make jtag working and after reading several topics, I recognized a similar case about an ESP32 Solo (another single core processor module). So by using esp32dev platform with a modified version of the esp-wroom-32.cfg file in which I added the instruction ESP32_ONLYCPU 1 I finally managed to upload the code to the board using JTAG. I verified that my led which I configured on GPIO5 was blinking with the delay I set. JTAG is connected through ESP-PROG on GPIO 12,13,14,15.

So I decided to create a new set of file in order to test eventually modification without touching the original ones. I started from the esp32-solo-1.cfg and i created esp32-mini-1-GMR.cfg (GMR is just about my name) in board, target, and starting from esp32dev.json I created esp32-mini-1-GMR.json in which I changed “maximum_ram_size”: to 532480 (to be 520k as per ESP32-MINI-1 specs).

No success…

I mean the debug starts but it totally ignore my breakpoints and enter a panic.c file and stay there…

I am starting thinking I am not doing anything wrong and that maybe it’s just my ESP32-MINI-1 module is not totally supported for debug.

May I provide further info to you in order to receive useful suggestions?

Here you are my platformio.ini

[env]
platform = espressif32
framework = espidf
;monitor_speed = 115200
build_flags =
	; https://docs.espressif.com/projects/esp-idf/en/latest/get-started/get-started-wrover-kit.html#rgb-led
	-D CONFIG_BLINK_GPIO=2
upload_protocol = esp-prog
debug_tool = esp-prog
debug_init_break = tbreak app_main

[env:esp32-mini-1-GMR]
board = esp32-mini-1-GMR

and here my other custom file:

board/esp32-mini-1-GMR.cfg

source [find target/esp32-mini-1-GMR.cfg]

target/esp32-mini-1-GMR.cfg

set ESP32_FLASH_VOLTAGE 3.3
set ESP32_ONLYCPU 1

# Source the ESP32 configuration file
source [find target/esp32_GMR.cfg]

esp32_GMR.cfg
just copied and renamed: no changes

esp32-mini-1-GMR.json

{
  "build": {
    "arduino":{
      "ldscript": "esp32_out.ld"
    },
    "core": "esp32",
    "extra_flags": "-DARDUINO_ESP32_DEV",
    "f_cpu": "240000000L",
    "f_flash": "40000000L",
    "flash_mode": "dio",
    "mcu": "esp32",
    "variant": "esp32"
  },
  "connectivity": [
    "wifi",
    "bluetooth",
    "ethernet",
    "can"
  ],
  "debug": {
    "openocd_board": "esp32-mini-1-GMR.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "Espressif ESP32 Dev Module",
  "upload": {
    "flash_size": "4MB",
    "maximum_ram_size": 532480,
    "maximum_size": 4194304,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://en.wikipedia.org/wiki/ESP32",
  "vendor": "Espressif"
}

and here is my blink.c code

/* Blink Example

   This example code is in the Public Domain (or CC0 licensed, at your option.)

   Unless required by applicable law or agreed to in writing, this
   software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "sdkconfig.h"

/* Can use project configuration menu (idf.py menuconfig) to choose the GPIO to blink,
   or you can edit the following line and set a number here.
*/
#define BLINK_GPIO CONFIG_BLINK_GPIO
#define LED 5
int delay_time = 1000;
void app_main()
{
    /* Configure the IOMUX register for pad BLINK_GPIO (some pads are
       muxed to GPIO on reset already, but some default to other
       functions and need to be switched to GPIO. Consult the
       Technical Reference for a list of pads and their default
       functions.)
    */
    gpio_pad_select_gpio(LED);
    /* Set the GPIO as a push/pull output */
    gpio_set_direction(LED, GPIO_MODE_OUTPUT);
    while(1) {
        /* Blink off (output low) */
	printf("Turning off the LED\n");
        gpio_set_level(LED, 0);
        vTaskDelay(delay_time / portTICK_PERIOD_MS);
        /* Blink on (output high) */
	printf("Turning on the LED\n");
        gpio_set_level(LED, 1);
        vTaskDelay(delay_time / portTICK_PERIOD_MS);
    }
}

Anybody can help me to solve my case?

Thanks in advance

Giulio