diff options
author | Vincenzo Frascino <vincenzo.frascino@linaro.org> | 2016-11-22 16:38:46 +0000 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2016-11-22 19:34:52 -0500 |
commit | 7336b2a97893d59576eebf290f60bd8ceb33ec8e (patch) | |
tree | 54a4919774ba68822d2b128dd6c1da0ede842a29 | |
parent | 42cf1ab80231933228f9852dfad932def462d044 (diff) |
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>
-rw-r--r-- | arch/arm/core/cortex_m/nmi.c | 4 | ||||
-rw-r--r-- | include/arch/arm/cortex_m/nmi.h | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/arch/arm/core/cortex_m/nmi.c b/arch/arm/core/cortex_m/nmi.c index 76eb13b91..8a7b644f4 100644 --- a/arch/arm/core/cortex_m/nmi.c +++ b/arch/arm/core/cortex_m/nmi.c @@ -26,6 +26,7 @@ #include <nanokernel.h> #include <arch/cpu.h> #include <misc/printk.h> +#include <misc/reboot.h> #include <toolchain.h> #include <sections.h> @@ -51,7 +52,8 @@ static _NmiHandler_t handler = _SysNmiOnReset; static void _DefaultHandler(void) { printk("NMI received! Rebooting...\n"); - _ScbSystemReset(); + /* In ARM implementation sys_reboot ignores the parameter */ + sys_reboot(0); } /** diff --git a/include/arch/arm/cortex_m/nmi.h b/include/arch/arm/cortex_m/nmi.h index 66e5521dc..230dd6cd0 100644 --- a/include/arch/arm/cortex_m/nmi.h +++ b/include/arch/arm/cortex_m/nmi.h @@ -23,11 +23,13 @@ #ifndef __CORTEX_M_NMI_H #define __CORTEX_M_NMI_H +#ifndef _ASMLANGUAGE #ifdef CONFIG_RUNTIME_NMI extern void _NmiInit(void); #define NMI_INIT() _NmiInit() #else #define NMI_INIT() #endif +#endif #endif /* __CORTEX_M_NMI_H */ |