Skip to content

Commit cd0f508

Browse files
jtguggedaljhn-nordic
authored andcommitted
tests: nrf_modem_lib: Add test for modem trace flash backend
Add tests for the modem trace flash backend. Signed-off-by: Jan Tore Guggedal <[email protected]>
1 parent 3ba6726 commit cd0f508

File tree

5 files changed

+564
-0
lines changed

5 files changed

+564
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(flash)
11+
12+
target_include_directories(app PRIVATE src)
13+
14+
# Add test sources
15+
target_sources(app PRIVATE src/main.c)
16+
17+
# Provide compile-time definitions for configs expected by the backend
18+
target_compile_definitions(app PRIVATE
19+
CONFIG_NRF_MODEM_LIB_TRACE_FLASH_SECTORS=16
20+
CONFIG_NRF_MODEM_LIB_TRACE_BACKEND_FLASH_BUF_SIZE=1024
21+
CONFIG_NRF_MODEM_LIB_TRACE_BACKEND_FLASH_PARTITION_SIZE=0x10000
22+
)
23+
24+
# Generate runner for the test
25+
test_runner_generate(src/main.c)
26+
27+
# Add the actual flash backend implementation
28+
target_sources(app PRIVATE
29+
${ZEPHYR_NRF_MODULE_DIR}/lib/nrf_modem_lib/trace_backends/flash/flash.c)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
&flash0 {
8+
partitions {
9+
compatible = "fixed-partitions";
10+
#address-cells = <1>;
11+
#size-cells = <1>;
12+
13+
/* Keep boot and slot0 so chosen code-partition remains valid */
14+
/delete-node/ slot1_partition;
15+
/delete-node/ scratch_partition;
16+
/delete-node/ storage_partition;
17+
18+
/* modem_trace partition - matches flash backend without partition manager */
19+
modem_trace: partition@75000 {
20+
label = "modem_trace";
21+
reg = <0x00075000 0x00010000>; /* 64KB */
22+
};
23+
};
24+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
CONFIG_UNITY=y
8+
CONFIG_ASSERT=y
9+
10+
# Enable real flash simulator and subsystems
11+
CONFIG_FLASH=y
12+
CONFIG_FLASH_MAP=y
13+
CONFIG_FLASH_SIMULATOR=y
14+
CONFIG_FLASH_SIMULATOR_UNALIGNED_READ=y
15+
CONFIG_FLASH_SIMULATOR_EXPLICIT_ERASE=y
16+
CONFIG_FCB=y
17+
CONFIG_FCB_ALLOW_FIXED_ENDMARKER=y

0 commit comments

Comments
 (0)