Skip to content

Commit 76af091

Browse files
committed
doc: add doc about new common board style
1 parent 3a8d3c5 commit 76af091

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

doc/doxygen/src/porting-boards.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,27 @@ static const timer_conf_t timer_config[] = {
315315
/** @} */
316316
```
317317

318+
## New Style Common Code {#new-style-common-code}
319+
320+
The common board definitions of RIOT are currently being reworked to make the
321+
usage of common code easier and less error prone. For example, if you want
322+
to use the common code for the Adafruit nRF52 Bootloader that is used
323+
by many of the nRF52 based boards from Adafruit, you simply have to add the
324+
following line to the `Makefile.dep` of your board. Everything else
325+
will be automatically included by the build system.
326+
327+
```mk
328+
USEMODULE += boards_common_adafruit-nrf52-bootloader
329+
```
330+
331+
Not all common code is migrated to the new style yet, so if you are unsure
332+
whether it is or not, you can check if the `boards/Makefile` already
333+
includes a reference to the common code you want to use. If you are still
334+
unsure, you can still use the @ref old-style-common-code or ask the
335+
community.
336+
337+
## Old Style Common Code {#old-style-common-code}
338+
318339
If you want to use common makefiles, include them at the end of the specific
319340
`Makefile`, e.g. for a `Makefile.features`:
320341

@@ -330,6 +351,20 @@ FEATURES_PROVIDED += periph_uart
330351
include $(RIOTBOARD)/common/foo_common/Makefile.features
331352
```
332353

354+
If the common code includes source files, it might be necessary
355+
to explicitly include the directory in your `Makefile` so the Make system
356+
finds all the necessary files:
357+
358+
```mk
359+
MODULE = board
360+
361+
DIRS += $(RIOTBOARD)/common/myCommonFolder
362+
363+
include $(RIOTBASE)/Makefile.base
364+
```
365+
366+
If possible, you should use the @ref new-style-common-code though.
367+
333368
# Boards outside of RIOTBASE {#boards-outside-of-riotbase}
334369

335370
All `BOARD`s in RIOT reside in `RIOTBOARD` (`RIOTBOARD` being a make variable

0 commit comments

Comments
 (0)