mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 22:43:50 +01:00
Merge pull request #21327 from crasbe/pr/boards_common_new
Buildsystem: Introduce Global Makefiles for `boards` Directory
This commit is contained in:
commit
3399b642c3
@ -17,9 +17,10 @@ endif
|
||||
# processed before RIOT ones to be evaluated before the 'default' rules.
|
||||
-include $(EXTERNAL_MODULE_PATHS:%=%Makefile.dep)
|
||||
|
||||
# pull dependencies from sys and drivers
|
||||
# pull dependencies from sys, drivers and (common) boards
|
||||
include $(RIOTBASE)/sys/Makefile.dep
|
||||
include $(RIOTBASE)/drivers/Makefile.dep
|
||||
include $(RIOTBASE)/boards/Makefile.dep
|
||||
|
||||
# pull Makefile.dep of each driver modules if they exist
|
||||
-include $(sort $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep))
|
||||
|
||||
@ -11,6 +11,9 @@
|
||||
|
||||
include $(BOARDDIR)/Makefile.features
|
||||
|
||||
# include global Makefile.features for `boards` modules
|
||||
include $(RIOTBOARD)/Makefile.features
|
||||
|
||||
# Sanity check
|
||||
ifeq (,$(CPU))
|
||||
$(error $(BOARD): CPU must be defined by board / board_common Makefile.features)
|
||||
|
||||
@ -448,6 +448,9 @@ include $(BOARDDIR)/Makefile.include
|
||||
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
|
||||
include $(RIOTCPU)/$(CPU)/Makefile.include
|
||||
|
||||
# include global Makefile.include for `boards` modules
|
||||
include $(RIOTBASE)/boards/Makefile.include
|
||||
|
||||
# Include common serial logic to define TERMPROG, TERMFLAGS variables based on
|
||||
# the content of RIOT_TERMINAL
|
||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||
@ -568,11 +571,9 @@ BASELIBS += $(APPDEPS)
|
||||
# add extra include paths for packages in $(USEMODULE)
|
||||
USEMODULE_INCLUDES =
|
||||
|
||||
# include global Makefile.include for `sys` modules
|
||||
include $(RIOTBASE)/sys/Makefile.include
|
||||
|
||||
# add default board_init()
|
||||
DIRS += $(RIOTBASE)/boards/common/init
|
||||
|
||||
# include Makefile.includes of each driver modules if they exist
|
||||
-include $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.include)
|
||||
|
||||
|
||||
10
boards/Makefile
Normal file
10
boards/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
# add default board_init()
|
||||
DIRS += $(RIOTBOARD)/common/init
|
||||
|
||||
|
||||
# SORT THIS ALPHABETICALLY BY COMMON BOARD NAME!
|
||||
ifneq (,$(filter boards_common_adafruit-nrf52-bootloader,$(USEMODULE)))
|
||||
DIRS += $(RIOTBOARD)/common/adafruit-nrf52-bootloader
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
4
boards/Makefile.dep
Normal file
4
boards/Makefile.dep
Normal file
@ -0,0 +1,4 @@
|
||||
# SORT THIS ALPHABETICALLY BY COMMON BOARD NAME!
|
||||
ifneq (,$(filter boards_common_adafruit-nrf52-bootloader,$(USEMODULE)))
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.dep
|
||||
endif
|
||||
1
boards/Makefile.features
Normal file
1
boards/Makefile.features
Normal file
@ -0,0 +1 @@
|
||||
# SORT THIS ALPHABETICALLY BY COMMON BOARD NAME!
|
||||
4
boards/Makefile.include
Normal file
4
boards/Makefile.include
Normal file
@ -0,0 +1,4 @@
|
||||
# SORT THIS ALPHABETICALLY BY COMMON BOARD NAME!
|
||||
ifneq (,$(filter boards_common_adafruit-nrf52-bootloader,$(USEMODULE)))
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.include
|
||||
endif
|
||||
@ -1,4 +1 @@
|
||||
include $(RIOTBOARD)/common/nrf52/bootloader_nrfutil.dep.mk
|
||||
|
||||
# make sure the bootloader module is used for reset to work
|
||||
USEMODULE += boards_common_adafruit-nrf52-bootloader
|
||||
|
||||
@ -1,8 +1,3 @@
|
||||
MODULE = board
|
||||
|
||||
ifneq (,$(filter boards_common_adafruit-nrf52-bootloader,$(USEMODULE)))
|
||||
# add the adafruit-nrf52-bootloader directory to the build
|
||||
DIRS += $(RIOTBOARD)/common/adafruit-nrf52-bootloader
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
||||
@ -9,8 +9,7 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += ws281x
|
||||
endif
|
||||
|
||||
# include common Adafruit nRF52 Bootloader dependencies
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.dep
|
||||
USEMODULE += boards_common_adafruit-nrf52-bootloader
|
||||
|
||||
# include common nrf52 dependencies
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
||||
|
||||
@ -1,4 +1 @@
|
||||
UF2_SOFTDEV ?= SD611
|
||||
|
||||
# Include the common definitions for the Adafruit nRF52 Bootloader
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.include
|
||||
|
||||
@ -1,8 +1,3 @@
|
||||
MODULE = board
|
||||
|
||||
ifneq (,$(filter boards_common_adafruit-nrf52-bootloader,$(USEMODULE)))
|
||||
# add the adafruit-nrf52-bootloader directory to the build
|
||||
DIRS += $(RIOTBOARD)/common/adafruit-nrf52-bootloader
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
||||
@ -4,8 +4,7 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += ws281x
|
||||
endif
|
||||
|
||||
# include common Adafruit nRF52 Bootloader dependencies
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.dep
|
||||
USEMODULE += boards_common_adafruit-nrf52-bootloader
|
||||
|
||||
# include common nrf52 dependencies
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
||||
|
||||
@ -1,4 +1 @@
|
||||
UF2_SOFTDEV ?= SD611
|
||||
|
||||
# Include the common definitions for the Adafruit nRF52 Bootloader
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.include
|
||||
|
||||
@ -1,8 +1,3 @@
|
||||
MODULE = board
|
||||
|
||||
ifneq (,$(filter boards_common_adafruit-nrf52-bootloader,$(USEMODULE)))
|
||||
# add the adafruit-nrf52-bootloader directory to the build
|
||||
DIRS += $(RIOTBOARD)/common/adafruit-nrf52-bootloader
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
||||
@ -12,8 +12,7 @@ ifneq (,$(filter vfs_default,$(USEMODULE)))
|
||||
USEMODULE += mtd
|
||||
endif
|
||||
|
||||
# include common Adafruit nRF52 Bootloader dependencies
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.dep
|
||||
USEMODULE += boards_common_adafruit-nrf52-bootloader
|
||||
|
||||
# include common nrf52 dependencies
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
||||
|
||||
@ -1,4 +1 @@
|
||||
UF2_SOFTDEV ?= SD730
|
||||
|
||||
# Include the common definitions for the Adafruit nRF52 Bootloader
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.include
|
||||
|
||||
@ -315,6 +315,27 @@ static const timer_conf_t timer_config[] = {
|
||||
/** @} */
|
||||
```
|
||||
|
||||
## New Style Common Code {#new-style-common-code}
|
||||
|
||||
The common board definitions of RIOT are currently being reworked to make the
|
||||
usage of common code easier and less error prone. For example, if you want
|
||||
to use the common code for the Adafruit nRF52 Bootloader that is used
|
||||
by many of the nRF52 based boards from Adafruit, you simply have to add the
|
||||
following line to the `Makefile.dep` of your board. Everything else
|
||||
will be automatically included by the build system.
|
||||
|
||||
```mk
|
||||
USEMODULE += boards_common_adafruit-nrf52-bootloader
|
||||
```
|
||||
|
||||
Not all common code is migrated to the new style yet, so if you are unsure
|
||||
whether it is or not, you can check if the `boards/Makefile` already
|
||||
includes a reference to the common code you want to use. If you are still
|
||||
unsure, you can still use the @ref old-style-common-code or ask the
|
||||
community.
|
||||
|
||||
## Old Style Common Code {#old-style-common-code}
|
||||
|
||||
If you want to use common makefiles, include them at the end of the specific
|
||||
`Makefile`, e.g. for a `Makefile.features`:
|
||||
|
||||
@ -330,6 +351,20 @@ FEATURES_PROVIDED += periph_uart
|
||||
include $(RIOTBOARD)/common/foo_common/Makefile.features
|
||||
```
|
||||
|
||||
If the common code includes source files, it might be necessary
|
||||
to explicitly include the directory in your `Makefile` so the Make system
|
||||
finds all the necessary files:
|
||||
|
||||
```mk
|
||||
MODULE = board
|
||||
|
||||
DIRS += $(RIOTBOARD)/common/myCommonFolder
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
```
|
||||
|
||||
If possible, you should use the @ref new-style-common-code though.
|
||||
|
||||
# Boards outside of RIOTBASE {#boards-outside-of-riotbase}
|
||||
|
||||
All `BOARD`s in RIOT reside in `RIOTBOARD` (`RIOTBOARD` being a make variable
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
MODULE = $(APPLICATION_MODULE)
|
||||
|
||||
DIRS += $(RIOTCPU)/$(CPU) $(BOARDDIR)
|
||||
DIRS += $(RIOTBASE)/boards
|
||||
DIRS += $(RIOTBASE)/core $(RIOTBASE)/core/lib $(RIOTBASE)/drivers $(RIOTBASE)/sys
|
||||
|
||||
# For regular modules, adding files to BLOBS, SRC, SRCXX, ASMSRC or ASSMSRC
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user