freertos: introduce CONFIG_FREERTOS_INTERRUPT_BACKTRACE

The code in xtensa_vectors.S did not handle XT_DEBUG_BACKTRACE
consistently: #if was used in one case, and #ifdef in another. This makes
the checks consistent, and also introduces a Kconfig option to enable
backtrace.
This commit is contained in:
Ivan Grokhotkov 2017-08-21 22:32:08 +08:00
parent 3161854efb
commit 99a4b6b2db
2 changed files with 16 additions and 2 deletions

View file

@ -94,6 +94,18 @@ config FREERTOS_WATCHPOINT_END_OF_STACK
When this watchpoint is hit, gdb will stop with a SIGTRAP message. When no OCD is attached, esp-idf
will panic on an unhandled debug exception.
config FREERTOS_INTERRUPT_BACKTRACE
bool "Enable backtrace from interrupt to task context"
default y
help
If this option is enabled, interrupt stack frame will be modified to
point to the code of the interrupted task as its return address.
This helps the debugger (or the panic handler) show a backtrace from
the interrupt to the task which was interrupted. This also works for
nested interrupts: higer level interrupt stack can be traced back to the
lower level interrupt.
This option adds 4 instructions to the interrupt dispatching code.
config FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
int "Number of thread local storage pointers"
range 1 256

View file

@ -104,7 +104,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.extern pxCurrentTCB
/* Enable stack backtrace across exception/interrupt - see below */
#define XT_DEBUG_BACKTRACE 0
#ifdef CONFIG_FREERTOS_INTERRUPT_BACKTRACE
#define XT_DEBUG_BACKTRACE 1
#endif
/*
@ -195,7 +197,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
It does take a few more instructions, so undef XT_DEBUG_BACKTRACE
if you want to save the cycles.
*/
#if XT_DEBUG_BACKTRACE
#ifdef XT_DEBUG_BACKTRACE
#ifndef __XTENSA_CALL0_ABI__
rsr a0, EPC_1 + \level - 1 /* return address */
movi a4, 0xC0000000 /* constant with top 2 bits set (call size) */