No longer used with new dual core target & JTAG instructions.
This check only triggers if the stack overflow writes within 4 bytes of the end of the stack, rather than
overshooting further, so it is worth combining this approach with one of the other stack overflow check methods.
- When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no OCD is attached, esp-idf
+ When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no JTAG OCD is attached, esp-idf
will panic on an unhandled debug exception.
config FREERTOS_INTERRUPT_BACKTRACE
endchoice
-config FREERTOS_BREAK_ON_SCHEDULER_START_JTAG
- bool "Stop program on scheduler start when JTAG/OCD is detected"
- depends on ESP32_DEBUG_OCDAWARE
- default n
- help
- If JTAG/OCD is connected, stop execution when the scheduler is started and the first
- task is executed.
-
config FREERTOS_IDLE_TASK_STACKSIZE
int "Idle Task stack size"
range 768 32768
#include "sdkconfig.h"
#include "esp_attr.h"
-#define portFIRST_TASK_HOOK CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG
-
-
typedef struct {
uint32_t owner;
uint32_t count;
}
#endif
-#if CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG
-void vPortFirstTaskHook(TaskFunction_t function) {
- esp_set_breakpoint_if_jtag(function);
-}
-#endif
-
void vPortSetStackWatchpoint( void* pxStackStart ) {
//Set watchpoint 1 to watch the last 32 bytes of the stack.
//Unfortunately, the Xtensa watchpoints can't set a watchpoint on a random [base - base+n] region because
esp32 apptrace start file://trace.log 0 2048 -1 1 0
- There is an option to configure target to halt after reset on start of scheduler. To do so, go to menuconfig and enable option *Stop program on scheduler start when JTAG/OCD is detected* under *Component config > FreeRTOS*.
+ To configure tracing immediately after reset use the openocd ``reset halt`` command.
.. _app_trace-logging-to-host:
Support options for OpenOCD at compile time
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-The ESP-IDF code has various support options for OpenOCD set at compile time: it can stop execution when the first thread is started and break the system if a panic or unhandled exception is thrown. First option is disabled and second enabled by default and both can be changed using the esp-idf configuration menu. Please see the :ref:`make menuconfig <get-started-configure>` menu for more details.
+ESP-IDF has some support options for OpenOCD debugging which can be set at compile time:
+* :ref:`CONFIG_ESP32_DEBUG_OCDAWARE` is enabled by default. If a panic or unhandled exception is thrown and a JTAG debugger is connected (ie openocd is running), ESP-IDF will break into the debugger.
+* :ref:`CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK` (disabled by default) sets watchpoint index 1 (the second of two) at the end of any task stack. This is the most accurate way to debug task stack overflows. Click the link for more details.
+
+Please see the :ref:`make menuconfig <get-started-configure>` menu for more details on setting compile-time options.
.. _jtag-debugging-tip-freertos-support: