aarch64: error: Introduce CONFIG_EXCEPTION_DEBUG

Introduce CONFIG_EXCEPTION_DEBUG to discard exception debug strings and
code when not needed.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
Carlo Caione 2020-11-10 11:45:46 +01:00 committed by Anas Nashif
commit 666974015e
2 changed files with 16 additions and 0 deletions

View file

@ -89,6 +89,15 @@ config ARM_MMU
help
Memory Management Unit support.
config EXCEPTION_DEBUG
bool "Unhandled exception debugging information"
default y
depends on LOG
help
Print human-readable information about exception vectors, cause codes,
and parameters, at a cost of code/data size for the human-readable
strings.
if ARM_MMU
config MAX_XLAT_TABLES

View file

@ -17,6 +17,7 @@
LOG_MODULE_DECLARE(os);
#ifdef CONFIG_EXCEPTION_DEBUG
static void dump_esr(uint64_t esr, bool *dump_far)
{
const char *err;
@ -168,6 +169,7 @@ static void esf_dump(const z_arch_esf_t *esf)
LOG_ERR("x18: 0x%016llx x30: 0x%016llx",
esf->basic.regs[0], esf->basic.regs[1]);
}
#endif /* CONFIG_EXCEPTION_DEBUG */
static bool is_recoverable(z_arch_esf_t *esf, uint64_t esr, uint64_t far,
uint64_t elr)
@ -204,6 +206,7 @@ void z_arm64_fatal_error(unsigned int reason, z_arch_esf_t *esf)
}
if (GET_EL(el) != MODE_EL0) {
#ifdef CONFIG_EXCEPTION_DEBUG
bool dump_far = false;
LOG_ERR("ELR_ELn: 0x%016llx", elr);
@ -212,15 +215,19 @@ void z_arm64_fatal_error(unsigned int reason, z_arch_esf_t *esf)
if (dump_far)
LOG_ERR("FAR_ELn: 0x%016llx", far);
#endif /* CONFIG_EXCEPTION_DEBUG */
if (is_recoverable(esf, esr, far, elr))
return;
}
}
#ifdef CONFIG_EXCEPTION_DEBUG
if (esf != NULL) {
esf_dump(esf);
}
#endif /* CONFIG_EXCEPTION_DEBUG */
z_fatal_error(reason, esf);
CODE_UNREACHABLE;