From e449728b7d3514005f4d29b7a561591dbb9dda51 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 1 Dec 2020 23:28:59 +0100 Subject: [PATCH] hal: fix planted break instruction for Xtensa targets On Xtensa, "break 0, 0" encodes a software breakpoint which is placed into the program by the debug monitor. Planted breakpoints (added in the code to trap into debugger) should be encoded as "break 1, 15". See table "Breakpoint Instruction Operand Conventions" in the ISA Reference manual. --- components/hal/esp32/include/hal/cpu_ll.h | 2 +- components/hal/esp32s2/include/hal/cpu_ll.h | 2 +- components/hal/esp32s3/include/hal/cpu_ll.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/hal/esp32/include/hal/cpu_ll.h b/components/hal/esp32/include/hal/cpu_ll.h index 7a83ddbc43..49d2e3947d 100644 --- a/components/hal/esp32/include/hal/cpu_ll.h +++ b/components/hal/esp32/include/hal/cpu_ll.h @@ -170,7 +170,7 @@ static inline bool cpu_ll_is_debugger_attached(void) static inline void cpu_ll_break(void) { - __asm__ ("break 0,0"); + __asm__ ("break 1,15"); } static inline void cpu_ll_set_vecbase(const void* vecbase) diff --git a/components/hal/esp32s2/include/hal/cpu_ll.h b/components/hal/esp32s2/include/hal/cpu_ll.h index c70955eba2..ded1ca3ab4 100644 --- a/components/hal/esp32s2/include/hal/cpu_ll.h +++ b/components/hal/esp32s2/include/hal/cpu_ll.h @@ -165,7 +165,7 @@ static inline bool cpu_ll_is_debugger_attached(void) static inline void cpu_ll_break(void) { - __asm__ ("break 0,0"); + __asm__ ("break 1,15"); } static inline void cpu_ll_set_vecbase(const void* vecbase) diff --git a/components/hal/esp32s3/include/hal/cpu_ll.h b/components/hal/esp32s3/include/hal/cpu_ll.h index ea50870f93..cbcb8aa874 100644 --- a/components/hal/esp32s3/include/hal/cpu_ll.h +++ b/components/hal/esp32s3/include/hal/cpu_ll.h @@ -169,7 +169,7 @@ static inline bool cpu_ll_is_debugger_attached(void) static inline void cpu_ll_break(void) { - __asm__ ("break 0,0"); + __asm__ ("break 1,15"); } static inline void cpu_ll_set_vecbase(const void *vecbase)