1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

Merge pull request #17376 from leandrolanzieri/pr/makefiles/add_board_cpu_config_variables

makefiles/kconfig: add board & CPU config variables
This commit is contained in:
Kevin "Tristate Tom" Weiss 2021-12-13 13:26:40 +01:00 committed by GitHub
commit ed94dd7085
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 78 additions and 43 deletions

View File

@ -12,7 +12,7 @@ FEATURES_PROVIDED += highlevel_stdio
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -17,5 +17,5 @@ FEATURES_PROVIDED += periph_usbdev
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/adafruit-itsybitsy-m4.config
KCONFIG_BOARD_CONFIG += $(BOARDDIR)/adafruit-itsybitsy-m4.config
endif

View File

@ -12,7 +12,7 @@ FEATURES_PROVIDED += highlevel_stdio
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -12,7 +12,7 @@ FEATURES_PROVIDED += highlevel_stdio
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -19,5 +19,5 @@ FEATURES_PROVIDED += highlevel_stdio
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/bastwan.config
KCONFIG_BOARD_CONFIG += $(BOARDDIR)/bastwan.config
endif

View File

@ -13,4 +13,4 @@ FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += riotboot
# iotlab boards provide a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/common/iotlab/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/iotlab/clock.config

View File

@ -15,7 +15,7 @@ FEATURES_PROVIDED += highlevel_stdio
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -14,4 +14,4 @@ FEATURES_PROVIDED += periph_usbdev
FEATURES_PROVIDED += highlevel_stdio
# weact-f4x1cx boards provide a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/common/weact-f4x1cx/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/weact-f4x1cx/clock.config

View File

@ -7,4 +7,4 @@ FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
# f4vi1 provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/f4vi1/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/f4vi1/clock.config

View File

@ -12,7 +12,7 @@ FEATURES_PROVIDED += highlevel_stdio
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -12,4 +12,4 @@ FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
# msbiot provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/msbiot/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/msbiot/clock.config

View File

@ -22,5 +22,5 @@ FEATURES_PROVIDED += periph_uart
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/mulle.config
KCONFIG_BOARD_CONFIG += $(BOARDDIR)/mulle.config
endif

View File

@ -11,7 +11,7 @@ FEATURES_PROVIDED += highlevel_stdio
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -15,7 +15,7 @@ FEATURES_PROVIDED += highlevel_stdio
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/common/nrf52/nrf52_bootloader.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -9,7 +9,7 @@ FEATURES_PROVIDED += vdd_lc_filter_reg1
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/pinetime.config
KCONFIG_BOARD_CONFIG += $(BOARDDIR)/pinetime.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -11,4 +11,4 @@ FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev
# pyboard provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/pyboard/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/pyboard/clock.config

View File

@ -8,7 +8,7 @@ FEATURES_PROVIDED += vdd_lc_filter_reg1
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/ruuvitag.config
KCONFIG_BOARD_CONFIG += $(BOARDDIR)/ruuvitag.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -12,4 +12,4 @@ FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev
# stm32f723e-disco provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/stm32f723e-disco/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/stm32f723e-disco/clock.config

View File

@ -13,4 +13,4 @@ FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev
# stm32f746g-disco provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/stm32f746g-disco/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/stm32f746g-disco/clock.config

View File

@ -9,4 +9,4 @@ FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev
# stm32f769i-disco provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/stm32f769i-disco/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/stm32f769i-disco/clock.config

View File

@ -8,7 +8,7 @@ FEATURES_PROVIDED += vdd_lc_filter_reg1
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/thingy52.config
KCONFIG_BOARD_CONFIG += $(BOARDDIR)/thingy52.config
endif
include $(RIOTBOARD)/common/nrf52/Makefile.features

View File

@ -11,4 +11,4 @@ FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
# ublox-c030-u201 provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/ublox-c030-u201/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/ublox-c030-u201/clock.config

View File

@ -3,4 +3,4 @@ CPU_MODEL = stm32f401cc
include $(RIOTBOARD)/common/weact-f4x1cx/Makefile.features
# weact-f401cc provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/weact-f401cc/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/weact-f401cc/clock.config

View File

@ -3,4 +3,4 @@ CPU_MODEL = stm32f401ce
include $(RIOTBOARD)/common/weact-f4x1cx/Makefile.features
# weact-f401ce provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/weact-f401ce/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/weact-f401ce/clock.config

View File

@ -3,4 +3,4 @@ CPU_MODEL = stm32f411ce
include $(RIOTBOARD)/common/weact-f4x1cx/Makefile.features
# weact-f411ce provides a custom default Kconfig clock configuration
KCONFIG_ADD_CONFIG += $(RIOTBOARD)/weact-f411ce/clock.config
KCONFIG_BOARD_CONFIG += $(RIOTBOARD)/weact-f411ce/clock.config

View File

@ -18,5 +18,5 @@ FEATURES_PROVIDED += riotboot
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/yarm.config
KCONFIG_BOARD_CONFIG += $(BOARDDIR)/yarm.config
endif

View File

@ -17,5 +17,5 @@ FEATURES_PROVIDED += periph_timer periph_timer_periodic
# Add atxmega configurations. This configuration enables modules that are only available when
# using Kconfig module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/atxmega/atxmega.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/atxmega/atxmega.config
endif

View File

@ -19,5 +19,5 @@ include $(RIOTCPU)/cortexm_common/Makefile.features
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/cc2538/cc2538.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/cc2538/cc2538.config
endif

View File

@ -43,5 +43,5 @@ FEATURES_PROVIDED += no_idle_thread
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/cortexm_common/cortexm_common.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/cortexm_common/cortexm_common.config
endif

View File

@ -38,5 +38,5 @@ include $(RIOTCPU)/cortexm_common/Makefile.features
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1,$(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/efm32/efm32.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/efm32/efm32.config
endif

View File

@ -37,5 +37,5 @@ include $(RIOTCPU)/cortexm_common/Makefile.features
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/kinetis/kinetis.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/kinetis/kinetis.config
endif

View File

@ -12,5 +12,5 @@ include $(RIOTCPU)/cortexm_common/Makefile.features
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/lpc1768/lpc1768.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/lpc1768/lpc1768.config
endif

View File

@ -11,5 +11,5 @@ include $(RIOTCPU)/arm7_common/Makefile.features
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/lpc23xx/lpc23xx.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/lpc23xx/lpc23xx.config
endif

View File

@ -32,5 +32,5 @@ endif
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/native/native.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/native/native.config
endif

View File

@ -31,5 +31,5 @@ include $(RIOTCPU)/cortexm_common/Makefile.features
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/sam0_common/sam0_common.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/sam0_common/sam0_common.config
endif

View File

@ -58,11 +58,11 @@ ifneq (,$(filter $(CPU_MODEL),$(STM32_WITH_MPU)))
FEATURES_PROVIDED += cortexm_mpu
endif
# Add stm32 configs after including cortexm_common so stm32 takes precendence
include $(RIOTCPU)/cortexm_common/Makefile.features
# Add stm32 configs after including cortexm_common so stm32 takes precedence
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(RIOTCPU)/stm32/stm32.config
KCONFIG_CPU_CONFIG += $(RIOTCPU)/stm32/stm32.config
endif
include $(RIOTCPU)/cortexm_common/Makefile.features

View File

@ -63,7 +63,10 @@ files. Two files will be sources of configuration during the generation of the
final header file: `app.config` and `user.config`, which should be placed
inside the application's folder. `app.config` sets default configuration
values for the particular application, the user can override them by setting
them in `user.config`.
them in `user.config`. Additionally, further `.config` files can be added to
the variable `KCONFIG_ADD_CONFIG`, which will be applied _after_ default CPU and
board configurations, `app.config` and `user.config`. This means that they will
have priority.
Let's say that the `SOCK_UTIL_SCHEME_MAXLEN` symbol in `sock_util` module needs
to be configured. The `user.config` file could look like:
@ -458,6 +461,34 @@ config BOARD_SAMR21_XPRO
select HAS_RIOTBOOT
```
### Default configurations
Boards, common board directories, CPUs and common CPU directories may need to
override default configuration values. Visible configuration symbols are
configurable by the user and show on the menuconfig interface. `.config` files
are used to set their values. To allow multiple sources of `.config` files,
there are two Makefile variables developers should use: `KCONFIG_CPU_CONFIG` for
sources added by the CPU or common CPU directories, and `KCONFIG_BOARD_CONFIG`
for sources added by the board or common board directories. This ensures the
correct priority of the configurations.
Currently the `Makefile.features` infrastructure is used to populate the
configuration sources. As the order in which `.config` files are merged matters,
configuration sources should be ordered from more generic to more specific.
Because board's `Makefile.features` is included before CPU's `Makefile.features`
it is important to utilize two different lists of configuration sources. For
instance, if `cpu/cortexm_common` adds its configuration, `cpu/stm32` should add
its configuration after it, and `boards/stm32f769i-disco` after it.
```Makefile
include $(RIOTCPU)/cortexm_common/Makefile.features
# Add stm32 configs after including cortexm_common so stm32 takes precedence
ifeq (1, $(TEST_KCONFIG))
KCONFIG_CPU_CONFIG += $(RIOTCPU)/stm32/stm32.config
endif
```
## Summary of reserved Kconfig prefixes
The following symbol prefixes have been assigned particular semantics and are
reserved for the cases described below:

View File

@ -61,13 +61,17 @@ KCONFIG_OUT_DEP = $(KCONFIG_OUT_CONFIG).d
# Add configurations to merge, in ascendent priority (i.e. a file overrides the
# previous ones).
#
# KCONFIG_ADD_CONFIG holds a list of .config files that are merged for the
# initial configuration. This allows to split configurations in common files
# and share them among boards or cpus.
# KCONFIG_CPU_CONFIG, KCONFIG_BOARD_CONFIG and KCONFIG_ADD_CONFIG hold a lists
# of .config files that are merged for the initial configuration. This allows
# to split configurations in common files and share them among boards or cpus.
# Files are merged from more generic to more specific.
# This file will contain application default configurations used for Kconfig Test
MERGE_SOURCES += $(KCONFIG_CPU_CONFIG)
MERGE_SOURCES += $(KCONFIG_BOARD_CONFIG)
MERGE_SOURCES += $(KCONFIG_ADD_CONFIG)
MERGE_SOURCES += $(wildcard $(KCONFIG_APP_CONFIG))
MERGE_SOURCES += $(wildcard $(KCONFIG_USER_CONFIG))
MERGE_SOURCES += $(KCONFIG_GENERATED_ENV_CONFIG)
# Create directory to place generated files