From 4d8c0218204f6000d1e9fcc2f35affda024bb22b Mon Sep 17 00:00:00 2001 From: Vincenzo Frascino Date: Tue, 22 Nov 2016 16:38:46 +0000 Subject: [PATCH] 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 --- arch/arm/core/cortex_m/nmi.c | 4 +++- include/arch/arm/cortex_m/nmi.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/core/cortex_m/nmi.c b/arch/arm/core/cortex_m/nmi.c index 76eb13b9161..8a7b644f438 100644 --- a/arch/arm/core/cortex_m/nmi.c +++ b/arch/arm/core/cortex_m/nmi.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -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 66e5521dc7d..230dd6cd0b1 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 */