Skip to content

Commit 871665f

Browse files
Damian-Nordicrlubos
authored andcommitted
debug: coredump: add internal flash backend based on nrfx
Add Zephyr core dump backend that saves a core dump to the internal flash or RRAM partition named "coredump_partition". This backend is an alternative to BACKEND_FLASH_PARTITION provided by Zephyr but it bypasses Zephyr flash device layer and uses nrfx directly, which offers the following benefits: 1. Bypasses synchronization primitives used by Zephyr flash or RRAM drivers. Currently, Zephyr flash drivers cannot be used to write to flash from a fault handler because of this. 2. Works with Partition Manager. 3. Minimizes the dependencies needed to successfully write a core dump, which is important as the core dump often needs to be written when the system is in the corrupted state. Only flash and RRAM are supported for now (no MRAM support). Signed-off-by: Damian Krolik <[email protected]>
1 parent f30b5ca commit 871665f

File tree

7 files changed

+390
-1
lines changed

7 files changed

+390
-1
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@
776776
/subsys/bootloader/ @nrfconnect/ncs-pluto
777777
/subsys/caf/ @nrfconnect/ncs-si-muffin @nrfconnect/ncs-si-bluebagel
778778
/subsys/debug/ @nordic-krch
779+
/subsys/debug/coredump/ @nrfconnect/ncs-protocols-serialization
779780
/subsys/dfu/ @nrfconnect/ncs-pluto
780781
/subsys/dfu/dfu_multi_image/ @Damian-Nordic
781782
/subsys/dm/ @nrfconnect/ncs-si-muffin

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ Common Application Framework
396396
Debug libraries
397397
---------------
398398

399-
|no_changes_yet_note|
399+
* Added an experimental :ref:`Zephyr Core Dump <zephyr:coredump>` backend that writes a core dump to an internal flash or RRAM partition.
400+
To enable this backend, set the :kconfig:option:`CONFIG_DEBUG_COREDUMP_BACKEND_OTHER` and :kconfig:option:`CONFIG_DEBUG_COREDUMP_BACKEND_NRF_FLASH_PARTITION` Kconfig options.
400401

401402
DFU libraries
402403
-------------

subsys/debug/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7+
add_subdirectory(coredump)
78
add_subdirectory_ifdef(CONFIG_CPU_LOAD cpu_load)
89
add_subdirectory_ifdef(CONFIG_ETB_TRACE etb_trace)
910
add_subdirectory_ifdef(CONFIG_PPI_TRACE ppi_trace)

subsys/debug/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
menu "Debug"
88

9+
rsource "coredump/Kconfig"
910
rsource "cpu_load/Kconfig"
1011
rsource "etb_trace/Kconfig"
1112
rsource "ppi_trace/Kconfig"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
zephyr_sources_ifdef(CONFIG_DEBUG_COREDUMP_BACKEND_NRF_FLASH_PARTITION coredump_backend_nrf_flash_partition.c)

subsys/debug/coredump/Kconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config DEBUG_COREDUMP_BACKEND_NRF_FLASH_PARTITION
8+
bool "Core dump backend using nRF internal flash/RRAM partition [EXPERIMENTAL]"
9+
depends on DEBUG_COREDUMP_BACKEND_OTHER
10+
depends on DT_HAS_NORDIC_NRF51_FLASH_CONTROLLER_ENABLED || \
11+
DT_HAS_NORDIC_NRF52_FLASH_CONTROLLER_ENABLED || \
12+
DT_HAS_NORDIC_NRF53_FLASH_CONTROLLER_ENABLED || \
13+
DT_HAS_NORDIC_NRF91_FLASH_CONTROLLER_ENABLED || \
14+
DT_HAS_NORDIC_RRAM_CONTROLLER_ENABLED
15+
depends on !BUILD_WITH_TFM
16+
select FLASH_MAP
17+
select EXPERIMENTAL
18+
help
19+
Enables the Zephyr core dump backend that saves a core dump to the
20+
flash or RRAM partition named "coredump_partition". This backend is
21+
similar to the one enabled with DEBUG_COREDUMP_BACKEND_FLASH_PARTITION
22+
option except that it bypasses the Zephyr flash device layer and uses
23+
nrfx library directly. This minimizes the dependencies needed to write
24+
the core dump and bypasses synchronization primitives incorporated
25+
into the Zephyr flash drivers.

0 commit comments

Comments
 (0)