Skip to content

Commit dbdbe9b

Browse files
Andy GrossAnas Nashif
authored andcommitted
Makefile: Add dts config include file
This patch adds a dts config include file that is sourced during builds. The config file contents are key value pairs derived from the DTS board descriptions. Jira: ZEP-2119 Change-Id: I4d50e795ba776645b56f0b83410cbb5b0a8fd4fa Signed-off-by: Andy Gross <[email protected]>
1 parent 8cc329b commit dbdbe9b

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

Makefile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,17 @@ ifeq ($(dot-config),1)
577577
# oldconfig if changes are detected.
578578
-include include/config/auto.conf.cmd
579579

580+
# Read in DTS derived configuration, if it exists
581+
#
582+
# We check to see if the ARCH is correctly sourced before doing the -include
583+
# The reason for this is due to implicit rules kicking in to create this file.
584+
# If this occurs before the above auto.conf is sourced correctly, the build
585+
# will iterate over the dts conf file 2-3 times before settling down to the
586+
# correct output.
587+
ifneq ($(ARCH),)
588+
-include include/generated/generated_dts_board.conf
589+
endif
590+
580591
# To avoid any implicit rule to kick in, define an empty command
581592
$(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
582593

@@ -962,19 +973,34 @@ define filechk_generated_dts_board.h
962973
fi; \
963974
)
964975
endef
976+
define filechk_generated_dts_board.conf
977+
(echo "# WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!"; \
978+
$(ZEPHYR_BASE)/scripts/extract_dts_includes.py \
979+
-d dts/$(ARCH)/$(BOARD_NAME).dts_compiled \
980+
-y $(ZEPHYR_BASE)/dts/$(ARCH)/yaml -k; \
981+
)
982+
endef
965983
else
966984
define filechk_generated_dts_board.h
967985
(echo "/* WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY! */";)
968986
endef
987+
define filechk_generated_dts_board.conf
988+
(echo "# WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!";)
989+
endef
969990
endif
970991

971-
972992
include/generated/generated_dts_board.h: include/config/auto.conf FORCE
973993
ifeq ($(CONFIG_HAS_DTS),y)
974994
$(Q)$(MAKE) $(build)=dts/$(ARCH)
975995
endif
976996
$(call filechk,generated_dts_board.h)
977997

998+
include/generated/generated_dts_board.conf: include/config/auto.conf FORCE
999+
ifeq ($(CONFIG_HAS_DTS),y)
1000+
$(Q)$(MAKE) $(build)=dts/$(ARCH)
1001+
endif
1002+
$(call filechk,generated_dts_board.conf)
1003+
9781004
dts: include/generated/generated_dts_board.h
9791005

9801006
# The actual objects are generated when descending,
@@ -1091,7 +1117,8 @@ depend dep:
10911117
# Directories & files removed with 'make clean'
10921118
CLEAN_DIRS += $(MODVERDIR)
10931119

1094-
CLEAN_FILES += include/generated/generated_dts_board.h \
1120+
CLEAN_FILES += include/generated/generated_dts_board.conf \
1121+
include/generated/generated_dts_board.h \
10951122
.old_version .tmp_System.map .tmp_version \
10961123
.tmp_* System.map *.lnk *.map *.elf *.lst \
10971124
*.bin *.hex *.stat *.strip staticIdt.o linker.cmd \

0 commit comments

Comments
 (0)