Skip to content

Commit e1137a3

Browse files
gmarullmbolivar-ampere
authored andcommitted
cmake: modules: dts: use devicetree stub file
By providing a devicetree stub file, we make sure some internal macros required by devicetree.h are generated in devicetree_generated.h. This makes sure that systems without devicetree can continue working without extra ifdeffery. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
1 parent a4e9aed commit e1137a3

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

boards/common/stub.dts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (c) 2023 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/* empty stub file provided for systems not using devicetree */
7+
8+
/dts-v1/;
9+
10+
#include <skeleton.dtsi>
11+
12+
/ {
13+
14+
};

cmake/modules/dts.cmake

+2-8
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ set(DTS_CMAKE ${PROJECT_BINARY_DIR}/dts.cmake)
125125
# modules.
126126
set(VENDOR_PREFIXES dts/bindings/vendor-prefixes.txt)
127127

128-
#
129-
# Halt execution early if there is no devicetree.
130-
#
131-
132128
# TODO: What to do about non-posix platforms where NOT CONFIG_HAS_DTS (xtensa)?
133129
# Drop support for NOT CONFIG_HAS_DTS perhaps?
134130
set_ifndef(DTS_SOURCE ${BOARD_DIR}/${BOARD}.dts)
@@ -138,10 +134,8 @@ if(EXISTS ${DTS_SOURCE})
138134
list(APPEND DTS_SOURCE ${BOARD_DIR}/${BOARD}_${BOARD_REVISION_STRING}.overlay)
139135
endif()
140136
else()
141-
# If we don't have a devicetree after all, there's not much to do.
142-
set(header_template ${ZEPHYR_BASE}/misc/generated/generated_header.template)
143-
zephyr_file_copy(${header_template} ${DEVICETREE_GENERATED_H} ONLY_IF_DIFFERENT)
144-
return()
137+
# If we don't have a devicetree, provide an empty stub
138+
set(DTS_SOURCE ${ZEPHYR_BASE}/boards/common/stub.dts)
145139
endif()
146140

147141
#

misc/generated/generated_header.template

-1
This file was deleted.

0 commit comments

Comments
 (0)