arch: arm: move nmi to common location

The nmi_on_reset.S functions are used by all ARM platforms.  It
makes no sense to repeat the same code for all platforms.  Moving
the code from each SOC implementation to arch/arm/core.

The same treatment for the NMI_INIT() macro.  Moving it from a per
SOC implementation to the include/arch/arm/cortex_m/nmi.h.

Change-Id: I574d8880a44046cc7b9e1b635e80d6e83657b8c1
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
This commit is contained in:
Dan Kalowsky 2016-03-08 13:13:02 -08:00 committed by Gerrit Code Review
commit 983ec93bd4
11 changed files with 23 additions and 84 deletions

View file

@ -4,7 +4,7 @@ ccflags-y +=-I$(srctree)/arch/$(ARCH)/platforms/$(SOC_NAME)
asflags-y = $(ccflags-y)
obj-y = vector_table.o reset.o \
prep_c.o scs.o scb.o nmi.o \
nmi_on_reset.o prep_c.o scs.o scb.o nmi.o \
exc_manage.o exc_wrapper.o
obj-$(CONFIG_ERRNO) += errno.o

View file

@ -1 +1 @@
obj-y += soc.o nmi_on_reset.o
obj-y += soc.o

View file

@ -28,12 +28,7 @@
#include <init.h>
#include <soc.h>
#ifdef CONFIG_RUNTIME_NMI
extern void _NmiInit(void);
#define NMI_INIT() _NmiInit()
#else
#define NMI_INIT()
#endif
#include <arch/cpu.h>
/**
* @brief Setup various clock on SoC.

View file

@ -1,4 +1,3 @@
obj-y += soc_config.o
obj-y += soc.o
obj-y += nmi_on_reset.o
obj-y += wdog.o

View file

@ -34,6 +34,8 @@
#include <drivers/k6x_pmc.h>
#include <sections.h>
#include <arch/cpu.h>
/* board's setting for PLL multipler (PRDIV0) */
#define FRDM_K64F_PLL_DIV_20 (20 - 1)
@ -41,13 +43,6 @@
/* board's setting for PLL multipler (VDIV0) */
#define FRDM_K64F_PLL_MULT_48 (48 - 24)
#ifdef CONFIG_RUNTIME_NMI
extern void _NmiInit(void);
#define NMI_INIT() _NmiInit()
#else
#define NMI_INIT()
#endif
/*
* K64F Flash configuration fields
* These 16 bytes, which must be loaded to address 0x400, include default

View file

@ -1,4 +1,3 @@
obj-y += soc_config.o
obj-y += soc.o
obj-y += nmi_on_reset.o
obj-y += scp.o

View file

@ -1,39 +0,0 @@
/*
* Copyright (c) 2013-2014 Wind River Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief Default basic NMI handler before the kernel is up
*
* Provide a default handler for NMI before the system is up. The default action
* is to hard hang, sleeping.
*
* This might be preferable than rebooting to help debugging, or because
* rebooting might trigger the exact same problem over and over.
*/
#define _ASMLANGUAGE
#include <toolchain.h>
#include <sections.h>
_ASM_FILE_PROLOGUE
GTEXT(_SysNmiOnReset)
SECTION_FUNC(TEXT, _SysNmiOnReset)
wfi
b _SysNmiOnReset

View file

@ -27,12 +27,7 @@
#include <init.h>
#include <soc.h>
#ifdef CONFIG_RUNTIME_NMI
extern void _NmiInit(void);
#define NMI_INIT() _NmiInit()
#else
#define NMI_INIT()
#endif
#include <arch/cpu.h>
/**
*

View file

@ -51,6 +51,7 @@ extern "C" {
#include <arch/arm/cortex_m/asm_inline.h>
#include <arch/arm/cortex_m/addr_types.h>
#include <arch/arm/cortex_m/sys_io.h>
#include <arch/arm/cortex_m/nmi.h>
#endif
#define STACK_ALIGN 4

View file

@ -1,5 +1,11 @@
/**
* @file
*
* @brief NMI routines for ARM Cortex M series
*/
/*
* Copyright (c) 2013-2014 Wind River Systems, Inc.
* Copyright (c) 2015 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -14,26 +20,14 @@
* limitations under the License.
*/
/**
* @file
* @brief Default basic NMI handler before the kernel is up
*
* Provide a default handler for NMI before the system is up. The default action
* is to hard hang, sleeping.
*
* This might be preferable than rebooting to help debugging, or because
* rebooting might trigger the exact same problem over and over.
*/
#ifndef __CORTEX_M_NMI_H
#define __CORTEX_M_NMI_H
#define _ASMLANGUAGE
#ifdef CONFIG_RUNTIME_NMI
extern void _NmiInit(void);
#define NMI_INIT() _NmiInit()
#else
#define NMI_INIT()
#endif
#include <toolchain.h>
#include <sections.h>
_ASM_FILE_PROLOGUE
GTEXT(_SysNmiOnReset)
SECTION_FUNC(TEXT, _SysNmiOnReset)
wfi
b _SysNmiOnReset
#endif /* __CORTEX_M_NMI_H */