configs/: Change CONFIG_BOARD_RESET_ON_CRASH to CONFIG_BOARD_RESET_ON_ASSERT, arch/: Implement call to board_reset() if in all implementations of up_assert() when CONFIG_BOARD_RESET_ON_ASSERT=y.

This commit is contained in:
Xiang Xiao 2018-08-22 16:20:50 -06:00 committed by Gregory Nutt
parent d52561fbef
commit a465b6f0d4
19 changed files with 217 additions and 12 deletions

View File

@ -68,6 +68,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -293,6 +297,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (; ; )
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -303,6 +310,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -66,6 +66,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -347,6 +351,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (; ; )
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -357,6 +364,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -69,6 +69,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -377,6 +381,9 @@ static void _up_assert(int errorcode)
(void)spin_trylock(&g_cpu_irqlock);
#endif
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
/* FLASH LEDs a 2Hz */
@ -389,6 +396,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -69,6 +69,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -376,6 +380,9 @@ static void _up_assert(int errorcode)
(void)spin_trylock(&g_cpu_irqlock);
#endif
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -386,6 +393,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -66,6 +66,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -348,6 +352,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (; ; )
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -358,6 +365,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -66,6 +66,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -88,6 +92,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (; ; )
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -98,6 +105,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -66,6 +66,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -276,6 +280,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (;;)
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -286,6 +293,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -65,6 +65,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -87,6 +91,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (; ; )
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -97,6 +104,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -66,6 +66,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -88,6 +92,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (; ; )
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -98,6 +105,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -65,6 +65,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -352,6 +356,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (; ; )
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -362,6 +369,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -67,6 +67,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -89,6 +93,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (;;)
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -99,6 +106,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -66,6 +66,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -88,6 +92,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (; ; )
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -98,6 +105,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -66,6 +66,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -237,6 +241,9 @@ static void _up_assert(int errorcode)
(void)up_irq_save();
for (;;)
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -247,6 +254,9 @@ static void _up_assert(int errorcode)
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -64,6 +64,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -129,6 +133,9 @@ static void xtensa_assert(int errorcode)
(void)up_irq_save();
for (; ; )
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -141,6 +148,9 @@ static void xtensa_assert(int errorcode)
{
/* Assertions in other contexts only cause the thread to exit */
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -67,6 +67,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -88,6 +92,9 @@ static void _up_assert(int errorcode) /* noreturn_function */
(void)up_irq_save();
for (;;)
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -98,6 +105,9 @@ static void _up_assert(int errorcode) /* noreturn_function */
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -66,6 +66,10 @@
# undef CONFIG_ARCH_USBDUMP
#endif
#ifndef CONFIG_BOARD_RESET_ON_ASSERT
# define CONFIG_BOARD_RESET_ON_ASSERT 0
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
@ -87,6 +91,9 @@ static void _up_assert(int errorcode) /* noreturn_function */
(void)up_irq_save();
for (;;)
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 1
board_reset(0);
#endif
#ifdef CONFIG_ARCH_LEDS
board_autoled_on(LED_PANIC);
up_mdelay(250);
@ -97,6 +104,9 @@ static void _up_assert(int errorcode) /* noreturn_function */
}
else
{
#if CONFIG_BOARD_RESET_ON_ASSERT >= 2
board_reset(0);
#endif
exit(errorcode);
}
}

View File

@ -2330,14 +2330,6 @@ config BOARD_CRASHDUMP
"machine state" in a place where on the next reset can write it
to more sophisticated storage in a sane operating environment.
config BOARD_RESET_ON_CRASH
bool "Enable Board Reset after the crashdump is saved"
default n
depends on BOARD_CRASHDUMP
---help---
If selected the board_crashdump should reset the machine after
saveing the state of the machine
config BOARD_ENTROPY_POOL
bool "Enable Board level storing of entropy pool structure"
default n
@ -2386,6 +2378,17 @@ config BOARDCTL_RESET
Architecture specific logic must provide the board_reset()
interface.
config BOARD_RESET_ON_ASSERT
int "Enable Board Reset after assert"
default 0
depends on BOARDCTL_RESET
---help---
== 0 up_assert never reset the machine
>= 1 up_assert from interrupt handler or IDLE thread will reset the
machine
>= 2 up_assert from user or kernel thread will reset the machine.
The default behavior is just to kill the asserting thread.
config BOARDCTL_UNIQUEID
bool "Return board unique ID"
default n

View File

@ -545,10 +545,6 @@ void board_crashdump(uintptr_t currentsp, FAR void *tcb,
up_lowputc('!');
}
#if defined(CONFIG_BOARD_RESET_ON_CRASH)
up_systemreset();
#endif
}
#endif /* CONFIG_STM32F7_SAVE_CRASHDUMP */

View File

@ -0,0 +1,46 @@
CONFIG_APPS_LOADABLE=y
CONFIG_ARCH="sim"
CONFIG_ARCH_BOARD="sim"
CONFIG_ARCH_BOARD_SIM=y
CONFIG_ARCH_SIM=y
CONFIG_BINFMT_EXEPATH=y
CONFIG_BOARDCTL_APP_SYMTAB=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BUILTIN=y
CONFIG_CLOCK_MONOTONIC=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ELF=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXAMPLES_HELLO_STACKSIZE=8192
CONFIG_EXECFUNCS_HAVE_SYMTAB=y
CONFIG_FS_HOSTFS=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_FILEPATH=y
CONFIG_INIT_MOUNT_DATA="fs=../apps/exe/system"
CONFIG_INIT_MOUNT_FLAGS=0x1
CONFIG_INIT_MOUNT_FSTYPE="hostfs"
CONFIG_INIT_MOUNT_TARGET="/system"
CONFIG_LIBC_EXECFUNCS=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_LINELEN=128
CONFIG_NSH_READLINE=y
CONFIG_PATH_INITIAL="/system/bin"
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_ONEXIT=y
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SIM_M32=y
CONFIG_SIM_WALLTIME=y
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2008
CONFIG_SYSTEM_NSH=y
CONFIG_TIME_EXTENDED=y
CONFIG_USERMAIN_STACKSIZE=4096
CONFIG_USER_INITPATH="/system/bin/nsh"