Skip to content

Commit 1f6978a

Browse files
modules: hal_nordic: move symbol definition from CMake to header
Since nrfx-based MDK now offers option to provide header with configuration symbols used within MDK, move all global definitions from CMake script to header. Changed script to properly include nrfx directory. Using include_next to use same header name as Zephyr based mdk_config. Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
1 parent fbf9b7d commit 1f6978a

4 files changed

Lines changed: 110 additions & 32 deletions

File tree

modules/hal_nordic/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ if(NOT DEFINED NRFX_DIR)
66
set(NRFX_DIR ${ZEPHYR_CURRENT_MODULE_DIR}/nrfx/ CACHE PATH "nrfx Directory")
77
endif()
88

9-
zephyr_include_directories_ifdef(CONFIG_HAS_NRFX .)
9+
zephyr_include_directories_ifdef(CONFIG_HAS_NRFX nrfx)
1010
add_subdirectory(${ZEPHYR_BASE}/modules/hal_nordic ${CMAKE_CURRENT_BINARY_DIR}/modules/hal_nordic)
1111
add_subdirectory_ifdef(CONFIG_HAS_NRFX nrfx)

modules/hal_nordic/nrfx/CMakeLists.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,6 @@ set(SOC_DIR ${NRFX_DIR}/bsp/stable)
77
set(MDK_DIR ${SOC_DIR}/mdk)
88
set(helpers_dir ${NRFX_DIR}/helpers)
99

10-
zephyr_compile_definitions_ifdef(CONFIG_NRF_PLATFORM_LUMOS LUMOS_XXAA)
11-
zephyr_compile_definitions_ifdef(CONFIG_NRF_PLATFORM_HALTIUM HALTIUM_XXAA)
12-
13-
# Add definitions for products which are yet to be upstreamed.
14-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LC10A NRF54LC10A_XXAA)
15-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LC10A_CPUAPP NRF_APPLICATION)
16-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LC10A_CPUFLPR NRF_FLPR)
17-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LS05A NRF54LS05A_XXAA)
18-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LS05A_CPUAPP NRF_APPLICATION)
19-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LS05A_DEVELOP_IN_NRF54LS05B DEVELOP_IN_NRF54LS05B)
20-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LS05B NRF54LS05B_XXAA)
21-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LS05B_CPUAPP NRF_APPLICATION)
22-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LV10A NRF54LV10A_XXAA)
23-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LV10A_CPUAPP NRF_APPLICATION)
24-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LV10A_CPUFLPR NRF_FLPR)
25-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9251 NRF9220_XXAA)
26-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9251_CPUAPP NRF_APPLICATION)
27-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9251_CPUPPR NRF_PPR)
28-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF9251_CPUFLPR NRF_FLPR)
29-
3010
mdk_svd_ifdef(CONFIG_SOC_NRF54LC10A_CPUAPP nrf54lc10a_application.svd)
3111
mdk_svd_ifdef(CONFIG_SOC_NRF54LC10A_CPUFLPR nrf54lc10a_flpr.svd)
3212
mdk_svd_ifdef(CONFIG_SOC_NRF54LS05A_CPUAPP nrf54ls05a_application.svd)
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
* Copyright (c) 2026, Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
#ifndef MDK_CONFIG_NRF_H__
8+
#define MDK_CONFIG_NRF_H__
9+
10+
/*
11+
* This is an extension of Zephyr-based mdk_config.h header, which
12+
* relates to products which are yet to be upstreamed.
13+
*/
14+
15+
#include_next <mdk_config.h>
16+
17+
/*
18+
* These are mappings of Kconfig options describing build target
19+
* to the corresponding symbols used inside of nrfx-based MDK.
20+
*/
21+
22+
#ifdef CONFIG_SOC_NRF54LC10A_CPUAPP
23+
#ifndef NRF54LC10A_XXAA
24+
#define NRF54LC10A_XXAA 1
25+
#endif
26+
#ifndef NRF_APPLICATION
27+
#define NRF_APPLICATION 1
28+
#endif
29+
#endif
30+
31+
#ifdef CONFIG_SOC_NRF54LC10A_CPUFLPR
32+
#ifndef NRF54LC10A_XXAA
33+
#define NRF54LC10A_XXAA 1
34+
#endif
35+
#ifndef NRF_FLPR
36+
#define NRF_FLPR 1
37+
#endif
38+
#endif
39+
40+
#ifdef CONFIG_SOC_NRF54LS05A_CPUAPP
41+
#ifndef NRF54LS05A_XXAA
42+
#define NRF54LS05A_XXAA 1
43+
#endif
44+
#ifndef NRF_APPLICATION
45+
#define NRF_APPLICATION 1
46+
#endif
47+
#endif
48+
49+
#ifdef CONFIG_SOC_NRF54LS05A_DEVELOP_IN_NRF54LS05B
50+
#ifndef DEVELOP_IN_NRF54LS05B
51+
#define DEVELOP_IN_NRF54LS05B 1
52+
#endif
53+
#endif
54+
55+
#ifdef CONFIG_SOC_NRF54LS05B_CPUAPP
56+
#ifndef NRF54LS05B_XXAA
57+
#define NRF54LS05B_XXAA 1
58+
#endif
59+
#ifndef NRF_APPLICATION
60+
#define NRF_APPLICATION 1
61+
#endif
62+
#endif
63+
64+
#ifdef CONFIG_SOC_NRF54LV10A_CPUAPP
65+
#ifndef NRF54LV10A_XXAA
66+
#define NRF54LV10A_XXAA 1
67+
#endif
68+
#ifndef NRF_APPLICATION
69+
#define NRF_APPLICATION 1
70+
#endif
71+
#endif
72+
73+
#ifdef CONFIG_SOC_NRF54LV10A_CPUFLPR
74+
#ifndef NRF54LV10A_XXAA
75+
#define NRF54LV10A_XXAA 1
76+
#endif
77+
#ifndef NRF_FLPR
78+
#define NRF_FLPR 1
79+
#endif
80+
#endif
81+
82+
#ifdef CONFIG_SOC_NRF9251_CPUAPP
83+
#ifndef NRF9220_XXAA
84+
#define NRF9220_XXAA 1
85+
#endif
86+
#ifndef NRF_APPLICATION
87+
#define NRF_APPLICATION 1
88+
#endif
89+
#endif
90+
91+
#ifdef CONFIG_SOC_NRF9251_CPUPPR
92+
#ifndef NRF9220_XXAA
93+
#define NRF9220_XXAA 1
94+
#endif
95+
#ifndef NRF_PPR
96+
#define NRF_PPR 1
97+
#endif
98+
#endif
99+
100+
#ifdef CONFIG_SOC_NRF9251_CPUFLPR
101+
#ifndef NRF9220_XXAA
102+
#define NRF9220_XXAA 1
103+
#endif
104+
#ifndef NRF_FLPR
105+
#define NRF_FLPR 1
106+
#endif
107+
#endif
108+
109+
#endif /* MDK_CONFIG_NRF_H__ */

soc/nordic/nrf54l/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,3 @@ endif()
1717

1818
zephyr_include_directories(${ZEPHYR_BASE}/soc/nordic/nrf54l)
1919
add_subdirectory(${ZEPHYR_BASE}/soc/nordic/common ${CMAKE_BINARY_DIR}/common)
20-
21-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LS05B NRF54LS05B_XXAA)
22-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LS05B_CPUAPP NRF_APPLICATION)
23-
24-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LC10A NRF54LC10A_XXAA)
25-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LC10A_CPUAPP NRF_APPLICATION)
26-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LC10A_CPUFLPR NRF_FLPR)
27-
28-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LV10A NRF54LV10A_XXAA)
29-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LV10A_CPUAPP NRF_APPLICATION)
30-
zephyr_compile_definitions_ifdef(CONFIG_SOC_NRF54LV10A_CPUFLPR NRF_FLPR)

0 commit comments

Comments
 (0)