espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.51k stars 7.26k forks source link

FREERTOS_WATCHPOINT_END_OF_STACK severely slow down the ISR response on C3 and C6 with debugger attached. (IDFGH-12539) #13544

Open andylinpersonal opened 6 months ago

andylinpersonal commented 6 months ago

Answers checklist.

IDF version.

release/v5.1 and release/v5.2

Espressif SoC revision.

ESP32-C3 (QFN32) (revision v0.3) and ESP32-C6 revision 0.0

Operating System used.

Linux

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

None

Development Kit.

C3: Custom board, C6: ESP32-C6-DevkitC-N8

Power Supply used.

USB

What is the expected behavior?

System should not be clogged even with the debug probe attached and enabled on it.

What is the actual behavior?

When the system is busy (simulated by two busy printing tasks) and compiled with FREERTOS_WATCHPOINT_END_OF_STACK=y, system will become very slow and the serving of ISRs are severely deferred (use systick as demo). BTW, this issue also affect the interrupt-intensive tasks. I have been successfully reproduced on the I2C and I2S over GDMA.

Steps to reproduce.

  1. Enable FREERTOS_WATCHPOINT_END_OF_STACK=y in the sdkconfig.defaults.
  2. Apply the snippets to the systick handler.
  3. Build and flash
  4. Run openocd -f 'board/$CHIP-builtin.cfg' and open the console of openocd by telnet localhost 4444.
  5. Run idf.py monitor -p $PORT --no-reset.
  6. Reset the target in the openocd console reset.
  7. See the console output with and without FREERTOS_WATCHPOINT_END_OF_STACK.
    1. Systick has been severely delayed for about 407x. It's an incredible ratio.

Debug Logs.

C6 with debugger attached


ESP-ROM:esp32c6-20220919
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x18 (JTAG_CPU),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x20000830
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0x19b0
load:0x4086c410,len:0xd54
load:0x4086e610,len:0x2e38
entry 0x4086c41a
22       boot            I: ESP-IDF v5.2-dev-5051-g9010d945e1-dirty 2nd stage bootloader
23       boot            I: compile time Apr  5 2024 01:55:30
26       boot            I: chip revision: v0.0
31       boot.esp32c6    I: SPI Speed      : 80MHz
37       boot.esp32c6    I: SPI Mode       : DIO
42       boot.esp32c6    I: SPI Flash Size : 2MB
47       boot            I: Enabling RNG early entropy source...
54       boot            I: Partition Table:
59       boot            I: ## Label            Usage          Type ST Offset   Length
67       boot            I:  0 nvs              WiFi data        01 02 00009000 00006000
76       boot            I:  1 phy_init         RF data          01 01 0000f000 00001000
85       boot            I:  2 factory          factory app      00 00 00010000 00100000
94       boot            I: End of partition table
99       esp_image       I: segment 0: paddr=00010020 vaddr=42010020 size=08660h ( 34400) map
116      esp_image       I: segment 1: paddr=00018688 vaddr=40800000 size=07990h ( 31120) load
125      esp_image       I: segment 2: paddr=00020020 vaddr=42000020 size=0c5f0h ( 50672) map
138      esp_image       I: segment 3: paddr=0002c618 vaddr=40807990 size=0215ch (  8540) load
141      esp_image       I: segment 4: paddr=0002e77c vaddr=40809af0 size=011d4h (  4564) load
149      boot            I: Loaded app from partition at offset 0x10000
153      boot            I: Disabling RNG early entropy source...
360   ř˙˙˙˙Ÿƒ€ŒÁŐ}ÍхÉс€€€€€€$é€TšĽ˝É•„ÁÁmlÁ´5(369      clk             W: esp_perip_clk_init() has not been implemented yet
369      cpu_start       I: Pro cpu start user code
371      cpu_start       I: cpu freq: 160000000 Hz
376      cpu_start       I: Application information:
382      cpu_start       I: Project name:     tester
388      cpu_start       I: App version:      1
393      cpu_start       I: Compile time:     Apr  5 2024 01:55:15
400      cpu_start       I: ELF file SHA256:  a693f6e35...
406      cpu_start       I: ESP-IDF:          v5.2-dev-5051-g9010d945e1-dirty
414      cpu_start       I: Min chip rev:     v0.0
419      cpu_start       I: Max chip rev:     v0.99 
425      cpu_start       I: Chip rev:         v0.0
430      heap_init       I: Initializing. RAM available for dynamic allocation:
438      heap_init       I: At 4080EE90 len 0006D780 (437 KiB): RAM
445      heap_init       I: At 4087C610 len 00002F54 (11 KiB): RAM
452      heap_init       I: At 50000000 len 00003FE8 (15 KiB): RTCRAM
460      spi_flash       I: detected chip: generic
465      spi_flash       I: flash io: dio
469      spi_flash       W: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
483      sleep           I: Configure to isolate all GPIO pins in sleep state
491      sleep           I: Enable automatic switching of GPIO sleep configuration
499      coexist         I: coex firmware version: d96c1e51f
500      coexist         I: coexist rom version 5b8dcfa
724      main_task       I: Started on CPU0
724      main_task       I: Calling app_main()
724      main            I: 0 interrupts recorded
724      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
725      main            I: 1 interrupts recorded
725      main_task       I: Returned from app_main()
726      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
726      main            I: 2 interrupts recorded
727      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
727      main            I: 3 interrupts recorded
728      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
728      main            I: 4 interrupts recorded
729      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
729      main            I: 5 interrupts recorded
730      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
730      main            I: 6 interrupts recorded
731      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
731      main            I: 7 interrupts recorded
732      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
732      main            I: 8 interrupts recorded
733      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
733      main            I: 9 interrupts recorded
734      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
734      main            I: 10 interrupts recorded
735      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
735      main            I: 11 interrupts recorded
736      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
736      main            I: 12 interrupts recorded
737      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
737      main            I: 13 interrupts recorded
738      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
738      main            I: 14 interrupts recorded
739      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
739      main            I: 15 interrupts recorded
740      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
740      main            I: 16 interrupts recorded
741      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
741      main            I: 17 interrupts recorded
742      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
742      main            I: 18 interrupts recorded
743      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
743      main            I: 19 interrupts recorded
744      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
744      main            I: 20 interrupts recorded
745      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
745      main            I: 21 interrupts recorded
746      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
746      main            I: 22 interrupts recorded
747      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
747      main            I: 23 interrupts recorded
748      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
748      main            I: 24 interrupts recorded
749      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
749      main            I: 25 interrupts recorded
750      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
750      main            I: 26 interrupts recorded
751      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
751      main            I: 27 interrupts recorded
752      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
752      main            I: 28 interrupts recorded
753      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
753      main            I: 29 interrupts recorded
754      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
754      main            I: 30 interrupts recorded
755      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
755      main            I: 31 interrupts recorded
756      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
756      main            I: 32 interrupts in 0xFFFFFFFFFEFFDA07 ticks (16000000 MHz)
757      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
757      main            I: 32 interrupts in 0x00000000095B2A0B ticks (16000000 MHz)
758      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
758      main            I: 32 interrupts in 0x00000000095B2A0B ticks (16000000 MHz)
759      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
759      main            I: 32 interrupts in 0x00000000095B2A0B ticks (16000000 MHz)
760      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
760      main            I: 32 interrupts in 0x00000000095B2A0B ticks (16000000 MHz)

C6 without debugger

1365     main            I: print lots of things print loESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x15 (USB_UART_HPSYS),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40020890
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0x19b0
load:0x4086c410,len:0xd54
load:0x4086e610,len:0x2e38
entry 0x4086c41a
23       boot            I: ESP-IDF v5.2-dev-5051-g9010d945e1-dirty 2nd stage bootloader
23       boot            I: compile time Apr  5 2024 01:55:30
27       boot            I: chip revision: v0.0
32       boot.esp32c6    I: SPI Speed      : 80MHz
37       boot.esp32c6    I: SPI Mode       : DIO
42       boot.esp32c6    I: SPI Flash Size : 2MB
48       boot            I: Enabling RNG early entropy source...
55       boot            I: Partition Table:
59       boot            I: ## Label            Usage          Type ST Offset   Length
68       boot            I:  0 nvs              WiFi data        01 02 00009000 00006000
77       boot            I:  1 phy_init         RF data          01 01 0000f000 00001000
85       boot            I:  2 factory          factory app      00 00 00010000 00100000
94       boot            I: End of partition table
100      esp_image       I: segment 0: paddr=00010020 vaddr=42010020 size=08660h ( 34400) map
116      esp_image       I: segment 1: paddr=00018688 vaddr=40800000 size=07990h ( 31120) load
126      esp_image       I: segment 2: paddr=00020020 vaddr=42000020 size=0c5f0h ( 50672) map
138      esp_image       I: segment 3: paddr=0002c618 vaddr=40807990 size=0215ch (  8540) load
141      esp_image       I: segment 4: paddr=0002e77c vaddr=40809af0 size=011d4h (  4564) load
149      boot            I: Loaded app from partition at offset 0x10000
153      boot            I: Disabling RNG early entropy source...
160      cpu_start       I: Unicore app
173      clk             W: esp_perip_clk_init() has not been implemented yet
174      cpu_start       I: Pro cpu start user code
178      cpu_start       I: cpu freq: 160000000 Hz
183      cpu_start       I: Application information:
189      cpu_start       I: Project name:     tester
195      cpu_start       I: App version:      1
200      cpu_start       I: Compile time:     Apr  5 2024 01:55:15
207      cpu_start       I: ELF file SHA256:  a693f6e35...
213      cpu_start       I: ESP-IDF:          v5.2-dev-5051-g9010d945e1-dirty
221      cpu_start       I: Min chip rev:     v0.0
226      cpu_start       I: Max chip rev:     v0.99 
232      cpu_start       I: Chip rev:         v0.0
237      heap_init       I: Initializing. RAM available for dynamic allocation:
245      heap_init       I: At 4080EE90 len 0006D780 (437 KiB): RAM
252      heap_init       I: At 4087C610 len 00002F54 (11 KiB): RAM
259      heap_init       I: At 50000000 len 00003FE8 (15 KiB): RTCRAM
267      spi_flash       I: detected chip: generic
272      spi_flash       I: flash io: dio
276      spi_flash       W: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
290      sleep           I: Configure to isolate all GPIO pins in sleep state
298      sleep           I: Enable automatic switching of GPIO sleep configuration
306      coexist         I: coex firmware version: d96c1e51f
307      coexist         I: coexist rom version 5b8dcfa
307      main_task       I: Started on CPU0
307      main_task       I: Calling app_main()
307      main            I: 0 interrupts recorded
307      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
308      main            I: 1 interrupts recorded
308      main_task       I: Returned from app_main()
309      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
309      main            I: 2 interrupts recorded
310      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
310      main            I: 3 interrupts recorded
311      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
311      main            I: 4 interrupts recorded
312      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
312      main            I: 5 interrupts recorded
313      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
313      main            I: 6 interrupts recorded
314      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
314      main            I: 7 interrupts recorded
315      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
315      main            I: 8 interrupts recorded
316      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
316      main            I: 9 interrupts recorded
317      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
317      main            I: 10 interrupts recorded
318      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
318      main            I: 11 interrupts recorded
319      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
319      main            I: 12 interrupts recorded
320      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
320      main            I: 13 interrupts recorded
321      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
321      main            I: 14 interrupts recorded
322      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
322      main            I: 15 interrupts recorded
323      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
323      main            I: 16 interrupts recorded
324      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
324      main            I: 17 interrupts recorded
325      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
325      main            I: 18 interrupts recorded
326      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
326      main            I: 19 interrupts recorded
327      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
327      main            I: 20 interrupts recorded
328      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
328      main            I: 21 interrupts recorded
329      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
329      main            I: 22 interrupts recorded
330      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
330      main            I: 23 interrupts recorded
331      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
331      main            I: 24 interrupts recorded
332      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
332      main            I: 25 interrupts recorded
333      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
333      main            I: 26 interrupts recorded
334      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
334      main            I: 27 interrupts recorded
335      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
335      main            I: 28 interrupts recorded
336      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
336      main            I: 29 interrupts recorded
337      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
337      main            I: 30 interrupts recorded
338      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
338      main            I: 31 interrupts recorded
339      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
339      main            I: 32 interrupts in 0xFFFFFFFFFFB493F8 ticks (16000000 MHz)
340      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
340      main            I: 32 interrupts in 0x000000000007D000 ticks (16000000 MHz)
341      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 
341      main            I: 32 interrupts in 0x000000000007D000 ticks (16000000 MHz)
342      main            I: print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things print lots of things 

More Information.

main.c

#include <freertos/FreeRTOS.h>
#include <esp_log.h>

volatile bool start_measure = false;
#if CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK == 1
const uint32_t max_intr_counter = 32;
#else
const uint32_t max_intr_counter = 16384;
#endif
volatile uint64_t systick_start = 0;
volatile uint64_t systick_end = 0;
volatile uint32_t intr_counter = 0;

static const char TAG[] = "main";
static StackType_t s_main_stack[4096];
static StaticTask_t s_main_tcb;
static StackType_t s_test_stack[4096];
static StaticTask_t s_test_tcb;

static void main_task(void *) {
  start_measure = true;
  while (1) {
    if (intr_counter == max_intr_counter) {
      uint64_t delta = systick_end - systick_start;
      ESP_LOGI(TAG, "%u interrupts in 0x%08X%08X ticks (%u MHz)",
               (unsigned)intr_counter, (unsigned)(delta >> 32), (unsigned)delta,
               16000000);
    } else {
      ESP_LOGI(TAG, "%u interrupts recorded", (unsigned)intr_counter);
    }
    vTaskDelay(1);
  }
}

static void test_task(void *arg) {
  while (true) {
    ESP_LOGI(TAG, "print lots of things "
                  "print lots of things "
                  "print lots of things "
                  "print lots of things "
                  "print lots of things "
                  "print lots of things "
                  "print lots of things ");
    vTaskDelay(1);
  }
}

void app_main(void) {
  xTaskCreateStaticPinnedToCore(&main_task, "main", sizeof(s_main_stack), NULL,
                                5, &s_main_stack[0], &s_main_tcb, 0);
  xTaskCreateStaticPinnedToCore(&test_task, "0", sizeof(s_test_stack), NULL,
                                5, &s_test_stack[0], &s_test_tcb, 0);
}

Snippets to be added to the systick handler or global interrupt handler: (Choose one of the two and see the console output)

components/freertos/port_systick.c

extern volatile bool start_measurement;
extern const uint32_t max_intr_counter;
extern volatile uint64_t systick_start;
extern volatile uint64_t systick_end;
extern volatile uint32_t intr_counter;

void SysTickIsrHandler(void *arg) {
    if (start_measurement) {
        systimer_hal_context_t tmrhal = {.dev = &SYSTIMER};
        if (intr_counter == 0) {
            if (systimer_ll_is_counter_value_valid(&SYSTIMER, SYSTIMER_COUNTER_ESPTIMER)) {
                systick_start = systimer_hal_get_counter_value(&tmrhal, SYSTIMER_COUNTER_ESPTIMER);
                intr_counter++;
            }
        } else if (intr_counter < max_intr_counter) {
            intr_counter++;
        } else {
            start_measurement = false;
            systick_end = systimer_hal_get_counter_value(&tmrhal, SYSTIMER_COUNTER_ESPTIMER);
        }
    }
    // omit
}

components/riscv/interrupt.c

extern volatile bool start_measurement;
extern const uint32_t max_intr_counter;
extern volatile uint64_t systick_start;
extern volatile uint64_t systick_end;
extern volatile uint32_t intr_counter;

void _global_interrupt_handler(intptr_t sp, int mcause) {
    if (start_measurement) {
        systimer_hal_context_t tmrhal = {.dev = &SYSTIMER};
        if (intr_counter == 0) {
            if (systimer_ll_is_counter_value_valid(&SYSTIMER, SYSTIMER_COUNTER_ESPTIMER)) {
                systick_start = systimer_hal_get_counter_value(&tmrhal, SYSTIMER_COUNTER_ESPTIMER);
                intr_counter++;
            }
        } else if (intr_counter < max_intr_counter) {
            intr_counter++;
        } else {
            start_measurement = false;
            systick_end = systimer_hal_get_counter_value(&tmrhal, SYSTIMER_COUNTER_ESPTIMER);
        }
    }
    // omit
}

sdkconfig.defaults

CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
CONFIG_FREERTOS_HZ=1000
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y # Toggle this one
KonstantinKondrashov commented 6 months ago

Hi @andylinpersonal! I have tried to reproduce it but still no luck. I am getting 1ms for both w and w/o FREERTOS_WATCHPOINT_END_OF_STACK + w and w/o the debug probe attached. I used the C6 chip with your example. Does it happen on the master as well?

Your result: 0x7D000 = 512000 ticks,
512000 / 32 (max_intr_counter = 32) / 16 (systimer division) = 1000us. Which is equal to the used CONFIG_FREERTOS_HZ=1000.

(It seems this is without FREERTOS_WATCHPOINT_END_OF_STACK) 0x00000000095B2A0B = 156969483 ticks 156969483 / 16384 (max_intr_counter = 16384) / 16 (systimer division) = 598us. Which is even less than 1ms. Could you explain this case? Is it for 16384 or not?

KonstantinKondrashov commented 6 months ago

@andylinpersonal It seems I have reproduced this case. I slightly changed your example. This example works well when CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=n or debug is not attached. The issue occurs when CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y and the debug is attached. I am getting the 32 Systick interrupts not within 32ms as expected (1 tick is 1ms, CONFIG_FREERTOS_HZ=1000) but within 10sec. Which is 312 times longer. I will check why it works like that.

andylinpersonal commented 6 months ago

BTW, attaching the OpenOCD to running ESP32-C3s and ESP32-C6s will trigger infinite unhandled debug exceptions occasionally, which cannot be eliminated without a full power cycle. It's strange. 😅