From 168cb62ba5d2b754aaafc086932699d20e39b135 Mon Sep 17 00:00:00 2001 From: cladmi Date: Sun, 23 Sep 2018 16:49:17 +0200 Subject: [PATCH 1/5] makefiles/info-global.inc.mk: Reset CPU/CPU_MODEL value when reading deps Part of moving CPU/CPU_MODEL definition to Makefile.features to have it available before Makefile.include. --- makefiles/info-global.inc.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/makefiles/info-global.inc.mk b/makefiles/info-global.inc.mk index d95cae4ff1..9e49a74a11 100644 --- a/makefiles/info-global.inc.mk +++ b/makefiles/info-global.inc.mk @@ -14,8 +14,15 @@ define board_missing_features DISABLE_MODULE := $(DISABLE_MODULE_GLOBAL) FEATURES_REQUIRED := $(FEATURES_REQUIRED_GLOBAL) FEATURES_OPTIONAL := $(FEATURES_OPTIONAL_GLOBAL) + + # Remove board specific variables set by Makefile.features/Makefile.dep FEATURES_PROVIDED := + # Undefine variables that must not be defined when starting. + # Some are sometime set as `?=` + undefine CPU + undefine CPU_MODEL + include $(RIOTBASE)/Makefile.features include $(RIOTBASE)/Makefile.dep From 3125d6f979c75f0327d05d887c02b6a7d7073568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Thu, 2 May 2019 17:01:20 +0200 Subject: [PATCH 2/5] Makefile.features: add doc on CPU/CPU_MODEL definition in board Describe the ongoing migration. Part of moving CPU/CPU_MODEL definition to Makefile.features to have it available before Makefile.include. --- Makefile.features | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile.features b/Makefile.features index 52965f154b..b26495ab38 100644 --- a/Makefile.features +++ b/Makefile.features @@ -1,4 +1,13 @@ # Process FEATURES variables +# +# The board/board common are responsible for defining the CPU and CPU_MODEL +# variables in their Makefile.features. +# This makes them available when setting features based on CPU_MODEL in the cpu +# Makefile.features and also during dependency resolution. + +# Transition: +# Moving 'CPU/CPU_MODEL' to Makefile.features is an ongoing work and may not +# reflect the state of all boards for the moment. include $(RIOTBOARD)/$(BOARD)/Makefile.features From 5c0ba89e81c76ace5de9028fab5f2de670c4eb33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Thu, 2 May 2019 18:15:45 +0200 Subject: [PATCH 3/5] makefiles/vars.inc.mk: update doc on CPU/CPU_MODEL definition Part of moving CPU/CPU_MODEL definition to Makefile.features to have it available before Makefile.include. --- makefiles/vars.inc.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makefiles/vars.inc.mk b/makefiles/vars.inc.mk index b46d5f70b5..204db66733 100644 --- a/makefiles/vars.inc.mk +++ b/makefiles/vars.inc.mk @@ -8,8 +8,8 @@ export QUIET # The parameter to use whether to show verbose make export APPLICATION # The application, set in the Makefile which is run by the user. export APPLICATION_MODULE # The application module name. export BOARD # The board to compile the application for. -export CPU # The CPU, set by the board's Makefile.include. -export CPU_MODEL # The specific identifier of the used CPU, used for some CPU implementations to differentiate between different memory layouts +export CPU # The CPU, set by the board's Makefile.features. +export CPU_MODEL # The specific identifier of the used CPU, used for some CPU implementations to differentiate between different memory layouts. Set by the board's Makefile.features. export MCU # The MCU, set by the board's Makefile.include, or defaulted to the same value as CPU. export INCLUDES # The extra include paths, set by the various Makefile.include files. export CXXINCLUDES # The extra include paths for c++, set by the various Makefile.include files. From 376b09b8755d96b5ea7e26c8d3b257dbc3830e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Thu, 2 May 2019 11:49:20 +0200 Subject: [PATCH 4/5] Makefile.features: include CPU/Makefile.features when CPU is defined Prepare for when boards define `CPU` in `BOARD/Makefile.features`. Include '$(RIOTCPU)/$(CPU)/Makefile.features' directly when it is defined. This will allow removing the file inclusion from the `BOARD/Makefile.features`. The board must then not include it directly. Transitional change to allow migrating part by parts. Part of moving CPU/CPU_MODEL definition to Makefile.features to have it available before Makefile.include. --- Makefile.features | 5 +++++ Makefile.include | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.features b/Makefile.features index b26495ab38..2c744e96a4 100644 --- a/Makefile.features +++ b/Makefile.features @@ -11,6 +11,11 @@ include $(RIOTBOARD)/$(BOARD)/Makefile.features +# Transitional conditional include until all boards define 'CPU' +ifneq (,$(CPU)) + include $(RIOTCPU)/$(CPU)/Makefile.features +endif + # Resolve FEATURES_ variables # Their value will only be complete after resolving dependencies diff --git a/Makefile.include b/Makefile.include index 62f9b39895..4011cb0d8a 100644 --- a/Makefile.include +++ b/Makefile.include @@ -275,7 +275,7 @@ include $(RIOTCPU)/$(CPU)/Makefile.include # The check is only done after 'include $(RIOTBOARD)/$(BOARD)/Makefile.include' # because we need to have the 'CPU' variable defined ifeq (,$(filter $(RIOTCPU)/$(CPU)/Makefile.features,$(MAKEFILE_LIST))) - $(error $$(RIOTCPU)/$$(CPU)/Makefile.features must have been included by the board / board common Makefile.features) + $(error $$(RIOTCPU)/$$(CPU)/Makefile.features must have been included by the board / board common Makefile.features or Makefile.features) endif # Assume GCC/GNU as supported toolchain if CPU's Makefile.include doesn't From fecc9c178d2300cd4bdca445be79c6faa40b4460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Tue, 11 Jun 2019 14:16:10 +0200 Subject: [PATCH 5/5] Makefile.dep: include CPU/Makefile.dep when CPU is defined Prepare for when boards define `CPU` in `BOARD/Makefile.features`. Include '$(RIOTCPU)/$(CPU)/Makefile.features' directly when it is defined. This will allow removing the file inclusion from the `BOARD/Makefile.dep`. The board must then not include it directly. Transitional change to allow migrating part by parts. Part of moving CPU/CPU_MODEL definition to Makefile.features to have it available before Makefile.include. This can currently trigger including two times the cpu/CPU/Makefile.dep but allows a by board complete migration. --- Makefile.dep | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile.dep b/Makefile.dep index 900e87685e..0de7d7ec19 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -5,6 +5,13 @@ OLD_USEPKG := $(sort $(USEPKG)) # include board dependencies -include $(RIOTBOARD)/$(BOARD)/Makefile.dep +# Transitional conditional include until all boards define 'CPU' in +# Makefile.features +ifneq (,$(CPU)) + # include cpu dependencies + -include $(RIOTCPU)/$(CPU)/Makefile.dep +endif + # include external modules dependencies # processed before RIOT ones to be evaluated before the 'default' rules. -include $(EXTERNAL_MODULE_DIRS:%=%/Makefile.dep)