forked from nuttx/nuttx-update
coredump: add architecture-specific registers dump, including NVIC and MPU
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
parent
39690a994f
commit
7e5fb8450f
13 changed files with 167 additions and 3 deletions
|
@ -1288,6 +1288,13 @@ config ARM_MPU_EARLY_RESET
|
|||
|
||||
Note: This can be used without MPU Support enabled.
|
||||
|
||||
config ARM_COREDUMP_REGION
|
||||
bool "Add coredump region"
|
||||
depends on COREDUMP
|
||||
default n
|
||||
---help---
|
||||
Add coredump region includes nvic and mpu for cortex-M.
|
||||
|
||||
config ARCH_HAVE_LOWVECTORS
|
||||
bool
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ set(SRCS
|
|||
arm_trigger_irq.c
|
||||
arm_vectors.c)
|
||||
|
||||
if(CONFIG_DEBUG_FEATURES)
|
||||
if((DEFINED CONFIG_DEBUG_FEATURES AND CONFIG_DEBUG_FEATURES)
|
||||
OR (DEFINED CONFIG_ARM_COREDUMP_REGION AND CONFIG_ARM_COREDUMP_REGION))
|
||||
list(APPEND SRCS arm_dumpnvic.c)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c arm_svcall.c
|
|||
CMN_CSRCS += arm_systemreset.c arm_tcbinfo.c arm_vectors.c
|
||||
CMN_CSRCS += arm_trigger_irq.c
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_FEATURES),y)
|
||||
ifneq ($(filter y,$(CONFIG_DEBUG_FEATURES)$(CONFIG_ARM_COREDUMP_REGION)),)
|
||||
CMN_CSRCS += arm_dumpnvic.c
|
||||
endif
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/coredump.h>
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
|
@ -87,3 +87,22 @@ void arm_dumpnvic(const char *msg)
|
|||
}
|
||||
|
||||
#endif /* CONFIG_DEBUG_FEATURES */
|
||||
|
||||
#ifdef CONFIG_ARM_COREDUMP_REGION
|
||||
|
||||
/****************************************************************************
|
||||
* Function: arm_coredump_add_region
|
||||
*
|
||||
* Description:
|
||||
* Dump all NVIC registers during a core dump.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void arm_coredump_add_region(void)
|
||||
{
|
||||
coredump_add_memory_region((uint32_t *)ARMV6M_NVIC1_BASE,
|
||||
ARMV6M_NVIC_IPR7 + 4 - ARMV6M_NVIC1_BASE,
|
||||
PF_REGISTER);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARM_COREDUMP_REGION */
|
||||
|
|
|
@ -66,4 +66,8 @@ if(CONFIG_ARM_MPU OR CONFIG_ARM_MPU_EARLY_RESET)
|
|||
list(APPEND SRCS arm_mpu.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARM_COREDUMP_REGION)
|
||||
list(APPEND SRCS arm_dumpnvic.c)
|
||||
endif()
|
||||
|
||||
target_sources(arch PRIVATE ${SRCS})
|
||||
|
|
|
@ -55,3 +55,7 @@ endif
|
|||
ifneq ($(filter y,$(CONFIG_ARM_MPU) $(CONFIG_ARM_MPU_EARLY_RESET)),)
|
||||
CMN_CSRCS += arm_mpu.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARM_COREDUMP_REGION),y)
|
||||
CMN_CSRCS += arm_dumpnvic.c
|
||||
endif
|
||||
|
|
56
arch/arm/src/armv7-m/arm_dumpnvic.c
Normal file
56
arch/arm/src/armv7-m/arm_dumpnvic.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/armv7-m/arm_dumpnvic.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/coredump.h>
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "arm_internal.h"
|
||||
#include "nvic.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARM_COREDUMP_REGION
|
||||
|
||||
/****************************************************************************
|
||||
* Function: arm_coredump_add_region
|
||||
*
|
||||
* Description:
|
||||
* Dump all NVIC registers during a core dump.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void arm_coredump_add_region(void)
|
||||
{
|
||||
coredump_add_memory_region((uint32_t *)ARMV7M_NVIC_BASE,
|
||||
NVIC_CID3 + 4 - ARMV7M_NVIC_BASE,
|
||||
PF_REGISTER);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARM_COREDUMP_REGION */
|
|
@ -71,4 +71,8 @@ if(CONFIG_ARCH_TRUSTZONE_SECURE)
|
|||
list(APPEND SRCS arm_gen_nonsecfault.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARM_COREDUMP_REGION)
|
||||
list(APPEND SRCS arm_dumpnvic.c)
|
||||
endif()
|
||||
|
||||
target_sources(arch PRIVATE ${SRCS})
|
||||
|
|
|
@ -60,3 +60,7 @@ endif
|
|||
ifeq ($(CONFIG_ARCH_TRUSTZONE_SECURE),y)
|
||||
CMN_CSRCS += arm_gen_nonsecfault.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARM_COREDUMP_REGION),y)
|
||||
CMN_CSRCS += arm_dumpnvic.c
|
||||
endif
|
||||
|
|
56
arch/arm/src/armv8-m/arm_dumpnvic.c
Normal file
56
arch/arm/src/armv8-m/arm_dumpnvic.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/armv8-m/arm_dumpnvic.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/coredump.h>
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "arm_internal.h"
|
||||
#include "nvic.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARM_COREDUMP_REGION
|
||||
|
||||
/****************************************************************************
|
||||
* Function: arm_coredump_add_region
|
||||
*
|
||||
* Description:
|
||||
* Dump all NVIC registers during a core dump.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void arm_coredump_add_region(void)
|
||||
{
|
||||
coredump_add_memory_region((uint32_t *)ARMV8M_NVIC_BASE,
|
||||
NVIC_CID3 + 4 - ARMV8M_NVIC_BASE,
|
||||
PF_REGISTER);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARM_COREDUMP_REGION */
|
|
@ -150,6 +150,10 @@ void up_initialize(void)
|
|||
arm_usbinitialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARM_COREDUMP_REGION
|
||||
arm_coredump_add_region();
|
||||
#endif
|
||||
|
||||
/* Initialize the L2 cache if present and selected */
|
||||
|
||||
arm_l2ccinitialize();
|
||||
|
|
|
@ -525,6 +525,10 @@ int arm_gen_nonsecurefault(int irq, uint32_t *regs);
|
|||
void arm_stack_check_init(void) noinstrument_function;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARM_COREDUMP_REGION
|
||||
void arm_coredump_add_region(void);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include <nuttx/streams.h>
|
||||
#include <nuttx/memoryregion.h>
|
||||
#include <nuttx/elf.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
|
Loading…
Reference in a new issue