FreeRTOS maximum used priority is unreasonably big, not proceeding

Unable to debug an ESP32-WROVER-E module over JTAG. After upload, the target is not halted at setup() and debug console displays the following when attempting to pause execution:

Breakpoint 1 at 0x40103330: file src/main.cpp, line 8.
PlatformIO: Initialization completed
PlatformIO: Resume the execution to `debug_init_break = break setup`
PlatformIO: More configuration options -> https://bit.ly/pio-debug
Note: automatically using hardware breakpoints for read-only addresses.
Info : [esp32.cpu0] Target halted, PC=0x400093C8, debug_reason=00000000
[esp32.cpu0] Target halted, PC=0x400093C8, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Set GDB target to 'esp32.cpu0'
Info : [esp32.cpu1] Target halted, PC=0x400076E0, debug_reason=00000000
[esp32.cpu1] Target halted, PC=0x400076E0, debug_reason=00000000
Error: FreeRTOS maximum used priority is unreasonably big, not proceeding: 127

Program
 received signal SIGINT, Interrupt.
0x400093c8 in ?? ()

Another forum suggested passing the linker flag

-Wl,--undefined=uxTopUsedPriority

but this had no effect.

IIRC the FreeRTOS max priority is set in using the menuconfig utility of the ESP32. Did you try to run it and see what that value is?

Alternatively, can you find the freertos config file in the .pio/build/… and see that value there?

As for uxTopUsedPriority, in an STM32 project I had to add an explicit reference that is not optimized out for the debugger to work. You can tell gcc to generate a map file and make sure that this symbol has a non zero value.

Thanks for the suggestions!
Doesn’t look like I can use menuconfig (forgot to mention I’m using VSCode and Arduino framework), but borrowing the code snippet from your STM project has cleared up the RTOS error.

Unfortunately it still does not pause execution correctly, now it’s an endless stream of:

Error: Unexpected OCD_ID = 00000000
Unexpected OCD_ID = 00000000
Error: Unexpected OCD_ID = 00000000
Unexpected OCD_ID = 00000000
Error: Unexpected OCD_ID = 00000000
Unexpected OCD_ID = 00000000
Error: Unexpected OCD_ID = 00000000
Unexpected OCD_ID = 00000000
Info : [esp32.cpu0] Debug controller was reset.
Info : [esp32.cpu0] Core was reset.
[esp32.cpu0] Debug controller was reset.
[esp32.cpu0] Core was reset.

Any thoughts? Feels like a totally new issue and so maybe deserves a separate topic/post.