Commit 27f4e7fe authored by Daniel Leung's avatar Daniel Leung Committed by Anas Nashif
Browse files

xtensa: only use BREAK if explicitly enabled



Introduce CONFIG_XTENSA_BREAK_ON_UNRECOVERABLE_EXCEPTIONS to
use BREAK instruction for unrecoverable exceptions. This
definitely requires debugger to be attached to the hardware
or simulator to catch that.

Also move the infinite loop to NOT result in an infinite
interrupt storm as the debug interrupt will be triggered over
and over again. Same for the simcall exit as it does not
need to be called repetitively.

Signed-off-by: default avatarDaniel Leung <daniel.leung@intel.com>
parent bc3e77b3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -103,6 +103,13 @@ config XTENSA_NUM_SPIN_RELAX_NOPS
	  Specify the number of NOPs in Xtensa specific
	  arch_spin_relax().

config XTENSA_BREAK_ON_UNRECOVERABLE_EXCEPTIONS
	bool "Use BREAK instruction on unrecoverable exceptions"
	help
	  Use BREAK instruction when unrecoverable exceptions are
	  encountered. This requires a debugger attached to catch
	  the BREAK.

menu "Xtensa HiFi Options"

config XTENSA_CPU_HAS_HIFI
+8 −7
Original line number Diff line number Diff line
@@ -503,8 +503,13 @@ _DoubleExceptionVector:
	j _Level1Vector
#else

#if defined(CONFIG_SIMULATOR_XTENSA) || defined(XT_SIMULATOR)
1:
#if XCHAL_HAVE_DEBUG && defined(CONFIG_XTENSA_BREAK_ON_UNRECOVERABLE_EXCEPTIONS)
	/* Signals an unhandled double exception, and unrecoverable exceptions.
	 * Definitely needs debugger to be attached to the hardware or simulator
	 * to catch this.
	 */
	break	1, 4
#elif defined(CONFIG_SIMULATOR_XTENSA) || defined(XT_SIMULATOR)
/* Tell simulator to stop executing here, instead of trying to do
 * an infinite loop (see below). Greatly help with using tracing in
 * simulator so that traces will not have infinite iterations of
@@ -513,12 +518,8 @@ _DoubleExceptionVector:
	movi a3, 1
	movi a2, SYS_exit
	simcall
#elif XCHAL_HAVE_DEBUG
/* Signals an unhandled double exception */
1:	break	1, 4
#else
1:
#endif
1:
	j	1b
#endif /* CONFIG_XTENSA_MMU */