Buildsystem: Migrate Boards and CPU using Common Code to USEMODULE
#21331
Labels
Area: boards
Area: Board ports
Area: build system
Area: Build system
Area: cpu
Area: CPU/MCU ports
Community: help wanted
The contributors require help from other members of the community
Type: cleanup
The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Type: tracking
The issue tracks and organizes the sub-tasks of a larger effort
As discussed in #21298 and #21299, boards and cpus use a rather convoluted way of using common code in the
boards/common
andcpu/xxx_common
folders:The
Makefile
usually includes a statement to include the directories:RIOT/boards/feather-nrf52840/Makefile
Lines 3 to 6 in 4ad7df0
The
Makefile.{include, dep, features}
has to have dedicatedinclude
commands:RIOT/boards/feather-nrf52840/Makefile.include
Lines 3 to 4 in 4ad7df0
The
USEMODULE
for the common board is not defined in theboards/xxx/Makefile.dep
as you would expect but in theboards/common/yyy/Makefile.dep
:RIOT/boards/common/adafruit-nrf52-bootloader/Makefile.dep
Lines 3 to 4 in 4ad7df0
Since this is rather ugly, PR #21327 introduced Makefiles in the
boards/
folder that work similar to the way thesys/Makefile*
s work: It checks if the common codeUSEMODULE
is set and automagically includes the necessary folders and directories.Instead of setting all the things discussed previously, a board now only has to set the
USEMODULE
in theboards/xxx/Makefile.dep
and no additional incldues orDIR +=
commands.USEMODULE += boards_common_adafruit-nrf52-bootloader
The first common code that got adapted to the new style was the
adafruit-nrf52-bootloader
in #21327, but there is still a lot of potential:The text was updated successfully, but these errors were encountered: