Skip to content

Commit

Permalink
periph_common: add as dependency to periph drivers
Browse files Browse the repository at this point in the history
Rational: the periph_common module is required by (most) other periph drivers
and also during startup of the CPU/MCU to run periph_init. The latter is only
required if other periph drivers are used, hence periph_common should be a
depency of periph_* modules and *not* of the CPU/MCU. This PR fixes that
by making periph_common a depency of periph_* and removing the explicit
include in the CPU/MCU implementation.
  • Loading branch information
smlng committed Mar 29, 2019
1 parent fe25330 commit 8c3e214
Show file tree
Hide file tree
Showing 18 changed files with 9 additions and 36 deletions.
5 changes: 5 additions & 0 deletions Makefile.dep
Expand Up @@ -862,6 +862,11 @@ FEATURES_USED := $(sort $(FEATURES_REQUIRED) $(filter $(FEATURES_OPTIONAL),$(FEA
# all periph features correspond to a periph submodule
USEMODULE += $(filter periph_%,$(FEATURES_USED))

# include periph_common if any periph_* driver is used
ifneq (,$(filter periph_%, $(USEMODULE)))
USEMODULE += periph_common
endif

# recursively catch transitive dependencies
USEMODULE := $(sort $(USEMODULE))
USEPKG := $(sort $(USEPKG))
Expand Down
3 changes: 0 additions & 3 deletions cpu/cc2538/Makefile.include
@@ -1,6 +1,3 @@
export CPU_ARCH := cortex-m3

# include common SPI functions
USEMODULE += periph_common

include $(RIOTMAKE)/arch/cortexm.inc.mk
2 changes: 1 addition & 1 deletion cpu/cc430/Makefile.include
@@ -1,3 +1,3 @@
include $(RIOTCPU)/msp430_common/Makefile.include

export USEMODULE += periph periph_common
export USEMODULE += periph
3 changes: 0 additions & 3 deletions cpu/efm32/Makefile.include
Expand Up @@ -20,9 +20,6 @@ USEMODULE += cpu_$(EFM32_FAMILY)
# vectors.o is provided by 'cpu_$(EFM32_FAMILY)' and not by 'cpu'
VECTORS_O := $(BINDIR)/cpu_$(EFM32_FAMILY)/vectors.o

# include common periph module
USEMODULE += periph_common

# include layered power management
USEMODULE += pm_layered

Expand Down
1 change: 0 additions & 1 deletion cpu/esp32/Makefile.include
Expand Up @@ -67,7 +67,6 @@ USEMODULE += esp_idf_esp32
USEMODULE += esp_idf_soc
USEMODULE += log
USEMODULE += periph
USEMODULE += periph_common
USEMODULE += random
USEMODULE += xtensa

Expand Down
3 changes: 0 additions & 3 deletions cpu/kinetis/Makefile.include
Expand Up @@ -36,9 +36,6 @@ LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_length=$(RAM_LEN)
# add the CPU specific flash configuration field for the linker
export UNDEF += $(BINDIR)/cpu/fcfield.o

# include common periph drivers
USEMODULE += periph_common

# select kinetis periph drivers
ifeq (EA,$(KINETIS_SERIES))
USEMODULE += periph_ics
Expand Down
3 changes: 0 additions & 3 deletions cpu/lm4f120/Makefile.include
Expand Up @@ -2,7 +2,4 @@ export CPU_ARCH = cortex-m4f

include $(RIOTMAKE)/arch/cortexm.inc.mk

# use common periph functions
USEMODULE += periph_common

include $(RIOTCPU)/stellaris_common/Makefile.include
2 changes: 1 addition & 1 deletion cpu/lpc2387/Makefile.include
@@ -1,3 +1,3 @@
include $(RIOTCPU)/arm7_common/Makefile.include

USEMODULE += arm7_common periph periph_common bitfield newlib
USEMODULE += arm7_common periph bitfield newlib
1 change: 0 additions & 1 deletion cpu/mips32r2_common/Makefile.include
Expand Up @@ -2,7 +2,6 @@ export INCLUDES += -I$(RIOTCPU)/mips32r2_common/include

export USEMODULE += mips32r2_common
export USEMODULE += mips32r2_common_periph
export USEMODULE += periph_common
export USEMODULE += newlib

# mips32 needs periph_timer for its gettimeofday() implementation
Expand Down
2 changes: 0 additions & 2 deletions cpu/mips_pic32_common/Makefile.include
Expand Up @@ -4,5 +4,3 @@ export INCLUDES += -I$(RIOTCPU)/mips_pic32_common/include

USEMODULE += mips_pic32_common
USEMODULE += mips_pic32_common_periph

USEMODULE += periph_common
2 changes: 1 addition & 1 deletion cpu/msp430_common/Makefile.include
Expand Up @@ -5,7 +5,7 @@ MODEL = $(shell echo $(CPU_MODEL) | tr 'a-z' 'A-Z')
export CFLAGS += -DCPU_MODEL_$(MODEL)

export UNDEF += $(BINDIR)/msp430_common/startup.o
export USEMODULE += msp430_common msp430_common_periph periph_common
export USEMODULE += msp430_common msp430_common_periph

DEFAULT_MODULE += oneway_malloc

Expand Down
2 changes: 1 addition & 1 deletion cpu/msp430fxyz/Makefile.include
@@ -1,3 +1,3 @@
include $(RIOTCPU)/msp430_common/Makefile.include

export USEMODULE += periph periph_common stdio_uart
export USEMODULE += periph stdio_uart
3 changes: 0 additions & 3 deletions cpu/native/Makefile.include
Expand Up @@ -8,7 +8,4 @@ endif
USEMODULE += periph
USEMODULE += periph_uart

# include common peripheral initialization
USEMODULE += periph_common

TOOLCHAINS_SUPPORTED = gnu llvm
3 changes: 0 additions & 3 deletions cpu/nrf5x_common/Makefile.include
Expand Up @@ -2,9 +2,6 @@
FAM = $(shell echo $(CPU_FAM) | tr 'a-z-' 'A-Z_')
export CFLAGS += -DCPU_FAM_$(FAM)

# use common periph functions
USEMODULE += periph_common

# include nrf5x common periph drivers
USEMODULE += nrf5x_common_periph

Expand Down
3 changes: 0 additions & 3 deletions cpu/sam0_common/Makefile.include
Expand Up @@ -22,9 +22,6 @@ export CFLAGS += -DDONT_USE_PREDEFINED_PERIPHERALS_HANDLERS
# For Cortex-M cpu we use the common cortexm.ld linker script
LINKER_SCRIPT ?= cortexm.ld

# use common periph functions
USEMODULE += periph_common

# include sam0 common periph drivers
USEMODULE += sam0_common_periph

Expand Down
3 changes: 0 additions & 3 deletions cpu/sam3/Makefile.include
@@ -1,8 +1,5 @@
export CPU_ARCH = cortex-m3
export CPU_FAM = sam3

# include common SPI functions
USEMODULE += periph_common

include $(RIOTCPU)/sam_common/Makefile.include
include $(RIOTMAKE)/arch/cortexm.inc.mk
3 changes: 0 additions & 3 deletions cpu/stm32_common/Makefile.include
Expand Up @@ -2,9 +2,6 @@
FAM = $(shell echo $(CPU_FAM) | tr 'a-z-' 'A-Z_')
export CFLAGS += -DCPU_FAM_$(FAM)

# include common periph module
USEMODULE += periph_common

# All stm32 families provide pm support
USEMODULE += pm_layered

Expand Down
1 change: 0 additions & 1 deletion makefiles/arch/cortexm.inc.mk
Expand Up @@ -34,7 +34,6 @@ export USEMODULE += cortexm_common
# Export the peripheral drivers to be linked into the final binary:
export USEMODULE += periph
# include common periph code
export USEMODULE += periph_common
export USEMODULE += cortexm_common_periph

# all cortex MCU's use newlib as libc
Expand Down

0 comments on commit 8c3e214

Please sign in to comment.