Merged in masayuki2009/nuttx.nuttx/debug_memfault (pull request #693)

arch/arm: Add CONFIG_DEBUG_MEMFAULT to Kconfig

Also, fix src/armv7-m/up_memfault.c

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
Masayuki Ishikawa 2018-07-24 11:42:54 +00:00 committed by GregoryN
parent 1c31036e94
commit 3b15cae493
2 changed files with 15 additions and 4 deletions

View File

@ -735,6 +735,15 @@ config DEBUG_HARDFAULT
output is sometimes helpful when debugging difficult hard fault problems,
but may be more than you typically want to see.
config DEBUG_MEMFAULT
bool "Verbose Mem-Fault Debug"
default n
depends on DEBUG_FEATURES && ARCH_USE_MPU
---help---
Enables verbose debug output when a mem fault is occurs. This verbose
output is sometimes helpful when debugging difficult mem fault problems,
but may be more than you typically want to see.
if ARCH_CORTEXM0
source arch/arm/src/armv6-m/Kconfig
endif

View File

@ -52,9 +52,7 @@
* Pre-processor Definitions
****************************************************************************/
#undef DEBUG_MEMFAULTS /* Define to debug memory management faults */
#ifdef DEBUG_MEMFAULTS
#ifdef CONFIG_DEBUG_MEMFAULT
# define mferr(format, ...) _alert(format, ##__VA_ARGS__)
# define mfinfo(format, ...) _alert(format, ##__VA_ARGS__)
#else
@ -79,11 +77,15 @@
int up_memfault(int irq, FAR void *context, FAR void *arg)
{
#if defined(CONFIG_DEBUG_MEMFAULT)
uint32_t *regs = (uint32_t *)context;
#endif
/* Dump some memory management fault info */
(void)up_irq_save();
_alert("PANIC!!! Memory Management Fault:\n");
mfinfo(" IRQ: %d context: %p\n", irq, regs);
mfinfo(" IRQ: %d context: %p\n", irq, context);
_alert(" CFAULTS: %08x MMFAR: %08x\n",
getreg32(NVIC_CFAULTS), getreg32(NVIC_MEMMANAGE_ADDR));
mfinfo(" BASEPRI: %08x PRIMASK: %08x IPSR: %08x CONTROL: %08x\n",