coredump: fix issue that nvic region overlapped by board memory region

Firstly call arm_coredump_add_region in up_initialize to add nvic region, then call
coredump_set_memory_region to add board mem region, at this moment, an overlap occurs.

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
wanggang26 2024-09-20 19:02:37 +08:00 committed by Xiang Xiao
parent ba18502b93
commit f6b9a8f577
2 changed files with 22 additions and 19 deletions

View file

@ -59,16 +59,6 @@ struct coredump_info_s
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: coredump_set_memory_region
*
* Description:
* Set do coredump memory region.
*
****************************************************************************/
int coredump_set_memory_region(FAR const struct memory_region_s *region);
/****************************************************************************
* Name: coredump_add_memory_region
*

View file

@ -765,19 +765,23 @@ static void coredump_dump_dev(pid_t pid)
#endif
/****************************************************************************
* Name: coredump_set_memory_region
* Name: coredump_initialize_memory_region
*
* Description:
* Set do coredump memory region.
* initialize the memory region with board memory range specified in config
*
****************************************************************************/
int coredump_set_memory_region(FAR const struct memory_region_s *region)
static int coredump_initialize_memory_region(void)
{
/* Not free g_regions, because allow call this fun when crash */
#ifdef CONFIG_BOARD_MEMORY_RANGE
if (g_regions == NULL)
{
g_regions = g_memory_region;
}
#endif
g_regions = region;
return 0;
return OK;
}
/****************************************************************************
@ -793,6 +797,13 @@ int coredump_add_memory_region(FAR const void *ptr, size_t size,
{
FAR struct memory_region_s *region;
size_t count = 1; /* 1 for end flag */
int ret;
ret = coredump_initialize_memory_region();
if (ret < 0)
{
return ret;
}
if (g_regions != NULL)
{
@ -881,9 +892,11 @@ int coredump_initialize(void)
{
int ret = 0;
#ifdef CONFIG_BOARD_MEMORY_RANGE
g_regions = g_memory_region;
#endif
ret = coredump_initialize_memory_region();
if (ret < 0)
{
return ret;
}
#ifdef CONFIG_BOARD_COREDUMP_BLKDEV
ret = lib_blkoutstream_open(&g_devstream,