Skip to content

Commit 9dd2e5e

Browse files
committed
cpu/nrf5x_common: pull and use vendor headers from git
1 parent ce69265 commit 9dd2e5e

File tree

5 files changed

+298
-0
lines changed

5 files changed

+298
-0
lines changed

cpu/nrf5x_common/Makefile.include

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,25 @@ RAM_START_ADDR ?= 0x20000000
66
LINKER_SCRIPT ?= cortexm.ld
77

88
INCLUDES += -I$(RIOTCPU)/nrf5x_common/include
9+
10+
NRF5XFAM_INCLUDE_DIR = $(BUILD_DIR)/nrf5x_nrfx_mdk/$(CPU_FAM)
11+
ifneq (,$(filter nrf53%,$(CPU_MODEL)))
12+
# The nRF5340 needs some special consideration due to the splitting between
13+
# application and network core.
14+
ifeq (nrf5340_app,$(CPU_MODEL))
15+
NRF5XFAM_INCLUDE_FILE = $(NRF5XFAM_INCLUDE_DIR)/vendor/nrf5340_application.h
16+
else ifeq (nrf5340_net,$(CPU_MODEL))
17+
NRF5XFAM_INCLUDE_FILE = $(NRF5XFAM_INCLUDE_DIR)/vendor/nrf5340_network.h
18+
endif
19+
else
20+
NRF5XFAM_INCLUDE_FILE = $(NRF5XFAM_INCLUDE_DIR)/vendor/$(CPU_FAM).h
21+
endif
22+
INCLUDES += -I$(NRF5XFAM_INCLUDE_DIR)
23+
24+
# Fetch all nRF52 vendor headers using the package mechanism. This rule is called all
25+
# the time to ensure it's correctly updated when versions in the packages are
26+
# updated.
27+
$(NRF5XFAM_INCLUDE_FILE): FORCE $(CLEAN)
28+
$(Q)+$(MAKE) -f $(RIOTBASE)/cpu/nrf5x_common/Makefile.nrfx
29+
30+
BUILDDEPS += $(NRF5XFAM_INCLUDE_FILE)

cpu/nrf5x_common/Makefile.nrfx

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
PKG_NAME=nrf5x_nrfx_mdk
2+
PKG_URL=https://github.com/NordicSemiconductor/nrfx
3+
# Release 3.14.0
4+
PKG_VERSION=11f57e578c7feea13f21c79ea0efab2630ac68c7
5+
PKG_LICENSE=BSD-3-Clause
6+
7+
# CPU Family specific vendor header files
8+
ifeq (nrf51, $(CPU_FAM))
9+
PKG_SPARSE_PATHS = mdk/nrf51.h
10+
PKG_SPARSE_PATHS += mdk/nrf51_bitfields.h
11+
PKG_SPARSE_PATHS += mdk/nrf51822_peripherals.h
12+
13+
else ifeq (nrf52, $(CPU_FAM))
14+
PKG_SPARSE_PATHS = mdk/nrf52.h
15+
PKG_SPARSE_PATHS += mdk/nrf52_bitfields.h
16+
17+
PKG_SPARSE_PATHS += mdk/nrf52810.h
18+
PKG_SPARSE_PATHS += mdk/nrf52810_bitfields.h
19+
PKG_SPARSE_PATHS += mdk/nrf52810_name_change.h
20+
PKG_SPARSE_PATHS += mdk/nrf52810_peripherals.h
21+
22+
PKG_SPARSE_PATHS += mdk/nrf52811.h
23+
PKG_SPARSE_PATHS += mdk/nrf52811_bitfields.h
24+
PKG_SPARSE_PATHS += mdk/nrf52811_name_change.h
25+
PKG_SPARSE_PATHS += mdk/nrf52811_peripherals.h
26+
27+
PKG_SPARSE_PATHS += mdk/nrf52832_peripherals.h
28+
29+
PKG_SPARSE_PATHS += mdk/nrf52833.h
30+
PKG_SPARSE_PATHS += mdk/nrf52833_bitfields.h
31+
PKG_SPARSE_PATHS += mdk/nrf52833_name_change.h
32+
PKG_SPARSE_PATHS += mdk/nrf52833_peripherals.h
33+
34+
PKG_SPARSE_PATHS += mdk/nrf52840.h
35+
PKG_SPARSE_PATHS += mdk/nrf52840_bitfields.h
36+
PKG_SPARSE_PATHS += mdk/nrf52840_name_change.h
37+
PKG_SPARSE_PATHS += mdk/nrf52840_peripherals.h
38+
39+
else ifneq (nrf53%, $(CPU_FAM))
40+
PKG_SPARSE_PATHS += mdk/nrf5340_application.h
41+
PKG_SPARSE_PATHS += mdk/nrf5340_application_bitfields.h
42+
PKG_SPARSE_PATHS += mdk/nrf5340_application_name_change.h
43+
PKG_SPARSE_PATHS += mdk/nrf5340_application_peripherals.h
44+
PKG_SPARSE_PATHS += mdk/nrf5340_network.h
45+
PKG_SPARSE_PATHS += mdk/nrf5340_network_bitfields.h
46+
PKG_SPARSE_PATHS += mdk/nrf5340_network_name_change.h
47+
PKG_SPARSE_PATHS += mdk/nrf5340_network_peripherals.h
48+
49+
endif
50+
51+
PKG_SOURCE_DIR = $(BUILD_DIR)/nrf5x_nrfx_mdk/$(CPU_FAM)
52+
PKG_PATCH_DIR = $(RIOTCPU)/nrf5x_common/include/vendor/patches/$(CPU_FAM)
53+
54+
include $(RIOTBASE)/pkg/pkg.mk
55+
56+
# The sparse checkout keeps the path, but we need to have the header in a
57+
# subfolder called "vendor".
58+
all:
59+
@mkdir -p $(PKG_SOURCE_DIR)/vendor
60+
@cp $(PKG_SOURCE_DIR)/mdk/* $(PKG_SOURCE_DIR)/vendor
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From 978c5e4e60bbe2819de69b779e064ffb85b3a7df Mon Sep 17 00:00:00 2001
2+
From: crasbe <[email protected]>
3+
Date: Thu, 16 Oct 2025 17:11:53 +0200
4+
Subject: [PATCH 1/1] RIOT specific changes
5+
6+
---
7+
mdk/nrf51.h | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/mdk/nrf51.h b/mdk/nrf51.h
11+
index 561bffc..7b72b10 100644
12+
--- a/mdk/nrf51.h
13+
+++ b/mdk/nrf51.h
14+
@@ -124,7 +124,7 @@ typedef enum {
15+
/** @} */ /* End of group Configuration_of_CMSIS */
16+
17+
#include "core_cm0.h" /*!< ARM Cortex-M0 processor and core peripherals */
18+
-#include "system_nrf51.h" /*!< nrf51 System */
19+
+/* #include "system_nrf51.h" */ /*!< nrf51 System */
20+
21+
#ifndef __IM /*!< Fallback for older CMSIS versions */
22+
#define __IM __I
23+
--
24+
2.43.0
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
From 96c6236beca93c4e59c67fae3f760cd5e675fe05 Mon Sep 17 00:00:00 2001
2+
From: crasbe <[email protected]>
3+
Date: Thu, 16 Oct 2025 17:13:00 +0200
4+
Subject: [PATCH 2/2] RIOT specific changes
5+
6+
---
7+
mdk/nrf52.h | 2 +-
8+
mdk/nrf52805.h | 2 +-
9+
mdk/nrf52810.h | 3 ++-
10+
mdk/nrf52811.h | 2 +-
11+
mdk/nrf52820.h | 2 +-
12+
mdk/nrf52832_peripherals.h | 8 ++++----
13+
mdk/nrf52833.h | 2 +-
14+
mdk/nrf52840.h | 3 ++-
15+
8 files changed, 13 insertions(+), 11 deletions(-)
16+
17+
diff --git a/mdk/nrf52.h b/mdk/nrf52.h
18+
index 8f0ee64..6de6308 100644
19+
--- a/mdk/nrf52.h
20+
+++ b/mdk/nrf52.h
21+
@@ -142,7 +142,7 @@ typedef enum {
22+
/** @} */ /* End of group Configuration_of_CMSIS */
23+
24+
#include "core_cm4.h" /*!< ARM Cortex-M4 processor and core peripherals */
25+
-#include "system_nrf52.h" /*!< nrf52 System */
26+
+/*#include "system_nrf52.h"*/ /*!< nrf52 System */
27+
28+
#ifndef __IM /*!< Fallback for older CMSIS versions */
29+
#define __IM __I
30+
diff --git a/mdk/nrf52805.h b/mdk/nrf52805.h
31+
index 6de19ae..c9c7ae9 100644
32+
--- a/mdk/nrf52805.h
33+
+++ b/mdk/nrf52805.h
34+
@@ -129,7 +129,7 @@ typedef enum {
35+
/** @} */ /* End of group Configuration_of_CMSIS */
36+
37+
#include "core_cm4.h" /*!< ARM Cortex-M4 processor and core peripherals */
38+
-#include "system_nrf52805.h" /*!< nrf52805 System */
39+
+/*#include "system_nrf52805.h"*/ /*!< nrf52805 System */
40+
41+
#ifndef __IM /*!< Fallback for older CMSIS versions */
42+
#define __IM __I
43+
diff --git a/mdk/nrf52810.h b/mdk/nrf52810.h
44+
index ccdb0da..c3e053b 100644
45+
--- a/mdk/nrf52810.h
46+
+++ b/mdk/nrf52810.h
47+
@@ -57,6 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.\n
48+
extern "C" {
49+
#endif
50+
51+
+#include "vendor/nrf52810_name_change.h"
52+
53+
/** @addtogroup Configuration_of_CMSIS
54+
* @{
55+
@@ -132,7 +133,7 @@ typedef enum {
56+
/** @} */ /* End of group Configuration_of_CMSIS */
57+
58+
#include "core_cm4.h" /*!< ARM Cortex-M4 processor and core peripherals */
59+
-#include "system_nrf52810.h" /*!< nrf52810 System */
60+
+/*#include "system_nrf52810.h"*/ /*!< nrf52810 System */
61+
62+
#ifndef __IM /*!< Fallback for older CMSIS versions */
63+
#define __IM __I
64+
diff --git a/mdk/nrf52811.h b/mdk/nrf52811.h
65+
index cbc77d0..3eb547b 100644
66+
--- a/mdk/nrf52811.h
67+
+++ b/mdk/nrf52811.h
68+
@@ -132,7 +132,7 @@ typedef enum {
69+
/** @} */ /* End of group Configuration_of_CMSIS */
70+
71+
#include "core_cm4.h" /*!< ARM Cortex-M4 processor and core peripherals */
72+
-#include "system_nrf52811.h" /*!< nrf52811 System */
73+
+/*#include "system_nrf52811.h"*/ /*!< nrf52811 System */
74+
75+
#ifndef __IM /*!< Fallback for older CMSIS versions */
76+
#define __IM __I
77+
diff --git a/mdk/nrf52820.h b/mdk/nrf52820.h
78+
index 99d8ec6..b1e7b77 100644
79+
--- a/mdk/nrf52820.h
80+
+++ b/mdk/nrf52820.h
81+
@@ -131,7 +131,7 @@ typedef enum {
82+
/** @} */ /* End of group Configuration_of_CMSIS */
83+
84+
#include "core_cm4.h" /*!< ARM Cortex-M4 processor and core peripherals */
85+
-#include "system_nrf52820.h" /*!< nrf52820 System */
86+
+/*#include "system_nrf52820.h"*/ /*!< nrf52820 System */
87+
88+
#ifndef __IM /*!< Fallback for older CMSIS versions */
89+
#define __IM __I
90+
diff --git a/mdk/nrf52832_peripherals.h b/mdk/nrf52832_peripherals.h
91+
index 814b468..4d5d386 100644
92+
--- a/mdk/nrf52832_peripherals.h
93+
+++ b/mdk/nrf52832_peripherals.h
94+
@@ -45,9 +45,9 @@ POSSIBILITY OF SUCH DAMAGE.
95+
#define POWER_COUNT 1
96+
97+
#define POWER_FEATURE_RAM_REGISTERS_PRESENT
98+
-#if defined(NRF52832_XXAA)
99+
+#if defined(CPU_MODEL_NRF52832XXAA)
100+
#define POWER_FEATURE_RAM_REGISTERS_COUNT 8
101+
-#elif defined(NRF52832_XXAB)
102+
+#elif defined(CPU_MODEL_NRF52832XXAB)
103+
#define POWER_FEATURE_RAM_REGISTERS_COUNT 4
104+
#endif
105+
106+
@@ -86,9 +86,9 @@ POSSIBILITY OF SUCH DAMAGE.
107+
108+
#define BPROT_REGIONS_SIZE 4096
109+
110+
-#if defined(NRF52832_XXAA)
111+
+#if defined(CPU_MODEL_NRF52832XXAA)
112+
#define BPROT_REGIONS_NUM 128
113+
-#elif defined(NRF52832_XXAB)
114+
+#elif defined(CPU_MODEL_NRF52832XXAB)
115+
#define BPROT_REGIONS_NUM 64
116+
#endif
117+
118+
diff --git a/mdk/nrf52833.h b/mdk/nrf52833.h
119+
index b43f551..f2b74eb 100644
120+
--- a/mdk/nrf52833.h
121+
+++ b/mdk/nrf52833.h
122+
@@ -146,7 +146,7 @@ typedef enum {
123+
/** @} */ /* End of group Configuration_of_CMSIS */
124+
125+
#include "core_cm4.h" /*!< ARM Cortex-M4 processor and core peripherals */
126+
-#include "system_nrf52833.h" /*!< nrf52833 System */
127+
+/*#include "system_nrf52833.h"*/ /*!< nrf52833 System */
128+
129+
#ifndef __IM /*!< Fallback for older CMSIS versions */
130+
#define __IM __I
131+
diff --git a/mdk/nrf52840.h b/mdk/nrf52840.h
132+
index 778cc7d..b6a6929 100644
133+
--- a/mdk/nrf52840.h
134+
+++ b/mdk/nrf52840.h
135+
@@ -57,6 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.
136+
extern "C" {
137+
#endif
138+
139+
+#include "vendor/nrf52840_name_change.h"
140+
141+
/** @addtogroup Configuration_of_CMSIS
142+
* @{
143+
@@ -149,7 +150,7 @@ typedef enum {
144+
/** @} */ /* End of group Configuration_of_CMSIS */
145+
146+
#include "core_cm4.h" /*!< ARM Cortex-M4 processor and core peripherals */
147+
-#include "system_nrf52840.h" /*!< nrf52840 System */
148+
+/*#include "system_nrf52840.h"*/ /*!< nrf52840 System */
149+
150+
#ifndef __IM /*!< Fallback for older CMSIS versions */
151+
#define __IM __I
152+
--
153+
2.43.0
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From c62b29228bb99f4ff5dd38fae16bba76b59724f5 Mon Sep 17 00:00:00 2001
2+
From: crasbe <[email protected]>
3+
Date: Fri, 17 Oct 2025 20:15:02 +0200
4+
Subject: [PATCH 3/3] RIOT specific changes
5+
6+
---
7+
mdk/nrf5340_application.h | 2 +-
8+
mdk/nrf5340_network.h | 2 +-
9+
2 files changed, 2 insertions(+), 2 deletions(-)
10+
11+
diff --git a/mdk/nrf5340_application.h b/mdk/nrf5340_application.h
12+
index 479cb15..88ba29c 100644
13+
--- a/mdk/nrf5340_application.h
14+
+++ b/mdk/nrf5340_application.h
15+
@@ -149,7 +149,7 @@ typedef enum {
16+
/** @} */ /* End of group Configuration_of_CMSIS */
17+
18+
#include "core_cm33.h" /*!< ARM Cortex-M33 processor and core peripherals */
19+
-#include "system_nrf5340_application.h" /*!< nrf5340_application System */
20+
+/* #include "system_nrf5340_application.h" */ /*!< nrf5340_application System */
21+
22+
#ifndef __IM /*!< Fallback for older CMSIS versions */
23+
#define __IM __I
24+
diff --git a/mdk/nrf5340_network.h b/mdk/nrf5340_network.h
25+
index a8b784f..0120c74 100644
26+
--- a/mdk/nrf5340_network.h
27+
+++ b/mdk/nrf5340_network.h
28+
@@ -128,7 +128,7 @@ typedef enum {
29+
/** @} */ /* End of group Configuration_of_CMSIS */
30+
31+
#include "core_cm33.h" /*!< ARM Cortex-M33 processor and core peripherals */
32+
-#include "system_nrf5340_network.h" /*!< nrf5340_network System */
33+
+/* #include "system_nrf5340_network.h" */ /*!< nrf5340_network System */
34+
35+
#ifndef __IM /*!< Fallback for older CMSIS versions */
36+
#define __IM __I
37+
--
38+
2.43.0
39+

0 commit comments

Comments
 (0)