diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9ca8c41713..39eb6ec0b5 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -744,27 +744,31 @@ config ARCH_ROMPGTABLE default n depends on ARCH_USE_MMU ---help--- - Support a fixed memory mapping use a (read-only) page table in ROM/FLASH. + Support a fixed memory mapping use a (read-only) page table in + ROM/FLASH. config ARCH_HAVE_HARDFAULT_DEBUG bool default n -config DEBUG_HARDFAULT - bool "Verbose Hard-Fault Debug" +config DEBUG_HARDFAULT_ALERT + bool "Hard-Fault Alert Debug" default n - depends on ARCH_HAVE_HARDFAULT_DEBUG && DEBUG_FEATURES + depends on ARCH_HAVE_HARDFAULT_DEBUG && DEBUG_ALERT ---help--- - Enables verbose debug output when a hard fault is occurs. This verbose - output is sometimes helpful when debugging difficult hard fault problems, - but may be more than you typically want to see. + Enables debug alert output to the SYSLOG when a hard fault + occurs. This output is sometimes helpful when debugging difficult + hard fault problems. config DEBUG_HARDFAULT_INFO bool "Hard-Fault Informational Output" default n - depends on ARCH_HAVE_HARDFAULT_DEBUG && DEBUG_FEATURES && DEBUG_INFO + depends on ARCH_HAVE_HARDFAULT_DEBUG && DEBUG_INFO ---help--- - Enable hard fault informational output to SYSLOG. + Enables informational alert output to the SYSLOG when a hard fault + occurs. This output is sometimes helpful when debugging difficult + hard fault problems but may be more than you want to see in some + cases. config ARCH_HAVE_MEMFAULT_DEBUG bool diff --git a/arch/arm/src/armv6-m/up_hardfault.c b/arch/arm/src/armv6-m/up_hardfault.c index 4f0c7b4f78..ac0d1e4c4f 100644 --- a/arch/arm/src/armv6-m/up_hardfault.c +++ b/arch/arm/src/armv6-m/up_hardfault.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv6-m/up_hardfault.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -54,7 +54,7 @@ * Pre-processor Definitions ****************************************************************************/ -#ifdef CONFIG_DEBUG_HARDFAULT +#ifdef CONFIG_DEBUG_HARDFAULT_ALERT # define hfalert(format, ...) _alert(format, ##__VA_ARGS__) #else # define hfalert(x...) @@ -125,21 +125,21 @@ int up_hardfault(int irq, FAR void *context, FAR void *arg) } } -#if defined(CONFIG_DEBUG_HARDFAULT) +#if defined(CONFIG_DEBUG_HARDFAULT_ALERT) /* Dump some hard fault info */ hfalert("\nHard Fault:\n"); hfalert(" IRQ: %d regs: %p\n", irq, regs); hfalert(" PRIMASK: %08x IPSR: %08x\n", - getprimask(), getipsr()); + getprimask(), getipsr()); hfalert(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], - regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); + regs[REG_R0], regs[REG_R1], regs[REG_R2], regs[REG_R3], + regs[REG_R4], regs[REG_R5], regs[REG_R6], regs[REG_R7]); hfalert(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", - regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], - regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); + regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], + regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); hfalert(" xPSR: %08x PRIMASK: %08x (saved)\n", - CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK]); + CURRENT_REGS[REG_XPSR], CURRENT_REGS[REG_PRIMASK]); #endif (void)up_irq_save(); diff --git a/arch/arm/src/armv7-m/up_hardfault.c b/arch/arm/src/armv7-m/up_hardfault.c index 1f13c30b58..719bfdc78d 100644 --- a/arch/arm/src/armv7-m/up_hardfault.c +++ b/arch/arm/src/armv7-m/up_hardfault.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_hardfault.c * - * Copyright (C) 2009, 2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -59,7 +59,7 @@ * interfere with context switching! */ -#ifdef CONFIG_DEBUG_HARDFAULT +#ifdef CONFIG_DEBUG_HARDFAULT_ALERT # define hfalert(format, ...) _alert(format, ##__VA_ARGS__) #else # define hfalert(x...) @@ -71,7 +71,6 @@ # define hfinfo(x...) #endif - #define INSN_SVC0 0xdf00 /* insn: svc 0 */ /**************************************************************************** @@ -89,7 +88,7 @@ int up_hardfault(int irq, FAR void *context, FAR void *arg) { -#if defined(CONFIG_DEBUG_HARDFAULT) || !defined(CONFIG_ARMV7M_USEBASEPRI) +#if defined(CONFIG_DEBUG_HARDFAULT_ALERT) || !defined(CONFIG_ARMV7M_USEBASEPRI) uint32_t *regs = (uint32_t *)context; #endif