diff --git a/boards/Kconfig b/boards/Kconfig index 2e9e73988b1..a982aa8e799 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -4722,6 +4722,12 @@ config BOARD_COREDUMP_BLKDEV ---help--- Enable save coredump to block device when crash. +config BOARD_COREDUMP_MTDDEV + bool "Enable Core Dump to mtd device" + depends on COREDUMP + ---help--- + Enable save coredump to mtd device when crash. + config BOARD_CRASHDUMP_NONE bool "No Board level crash dump" @@ -4729,9 +4735,9 @@ endchoice # BOARD crashdump method config BOARD_COREDUMP_DEVPATH string "Save Core Dump data with device PATH" - depends on BOARD_COREDUMP_BLKDEV + depends on BOARD_COREDUMP_BLKDEV || BOARD_COREDUMP_MTDDEV ---help--- - Save coredump file into block device path. + Save coredump file into block/mtd device path. config BOARD_COREDUMP_FULL bool "Core Dump all thread registers and stacks" diff --git a/sched/misc/coredump.c b/sched/misc/coredump.c index 265680d5bad..9d00b080a33 100644 --- a/sched/misc/coredump.c +++ b/sched/misc/coredump.c @@ -47,7 +47,8 @@ # define ELF_PAGESIZE 1024 #endif -#ifdef CONFIG_BOARD_COREDUMP_BLKDEV +#if defined(CONFIG_BOARD_COREDUMP_BLKDEV) || \ + defined(CONFIG_BOARD_COREDUMP_MTDDEV) # define CONFIG_BOARD_COREDUMP_DEV #endif @@ -92,6 +93,8 @@ static struct lib_hexdumpstream_s g_hexstream; #ifdef CONFIG_BOARD_COREDUMP_BLKDEV static struct lib_blkoutstream_s g_devstream; +#elif defined(CONFIG_BOARD_COREDUMP_MTDDEV) +static struct lib_mtdoutstream_s g_devstream; #endif #ifdef CONFIG_BOARD_MEMORY_RANGE @@ -867,6 +870,12 @@ int coredump_initialize(void) #ifdef CONFIG_BOARD_COREDUMP_BLKDEV ret = lib_blkoutstream_open(&g_devstream, CONFIG_BOARD_COREDUMP_DEVPATH); +#elif defined(CONFIG_BOARD_COREDUMP_MTDDEV) + ret = lib_mtdoutstream_open(&g_devstream, + CONFIG_BOARD_COREDUMP_DEVPATH); +#endif + +#ifdef CONFIG_BOARD_COREDUMP_DEV if (ret < 0) { _alert("%s Coredump device not found %d\n",