Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions include/nuttx/coredump.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,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
*
Expand Down
31 changes: 22 additions & 9 deletions sched/misc/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,19 +752,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;
}

/****************************************************************************
Expand All @@ -780,6 +784,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)
{
Expand Down Expand Up @@ -868,9 +879,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,
Expand Down
Loading