arm: Fix CONFIG_RUNTIME_NMI behavior

Zephyr kernel is unable to compile when CONFIG_RUNTIME_NMI is enabled in
defconfig on ARM's architectures.

This patch addresses the following issues:
* In nmi.c _DefaultHandler() is referencing a function
(_ScbSystemReset()) not defined in Zephyr. This has now been replaced
with sys_arch_reboot.
* nmi.h is included in ASM files and due to the usage of "extern" the
compilation ends with an error. Added the directive _ASMLANGUAGE to
prevent the problem.

Jira: ZEP-1319
Change-Id: I7623ca97523cde04e4c6db40dc332d93ca801928
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
This commit is contained in:
Vincenzo Frascino 2016-11-22 16:38:46 +00:00 committed by Anas Nashif
commit 4d8c021820
2 changed files with 5 additions and 1 deletions

View file

@ -26,6 +26,7 @@
#include <nanokernel.h> #include <nanokernel.h>
#include <arch/cpu.h> #include <arch/cpu.h>
#include <misc/printk.h> #include <misc/printk.h>
#include <misc/reboot.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
@ -51,7 +52,8 @@ static _NmiHandler_t handler = _SysNmiOnReset;
static void _DefaultHandler(void) static void _DefaultHandler(void)
{ {
printk("NMI received! Rebooting...\n"); printk("NMI received! Rebooting...\n");
_ScbSystemReset(); /* In ARM implementation sys_reboot ignores the parameter */
sys_reboot(0);
} }
/** /**

View file

@ -23,11 +23,13 @@
#ifndef __CORTEX_M_NMI_H #ifndef __CORTEX_M_NMI_H
#define __CORTEX_M_NMI_H #define __CORTEX_M_NMI_H
#ifndef _ASMLANGUAGE
#ifdef CONFIG_RUNTIME_NMI #ifdef CONFIG_RUNTIME_NMI
extern void _NmiInit(void); extern void _NmiInit(void);
#define NMI_INIT() _NmiInit() #define NMI_INIT() _NmiInit()
#else #else
#define NMI_INIT() #define NMI_INIT()
#endif #endif
#endif
#endif /* __CORTEX_M_NMI_H */ #endif /* __CORTEX_M_NMI_H */