1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #7241 from kaspar030/make_periph_use_submodules

make: use submodules for periph
This commit is contained in:
Hauke Petersen 2017-11-06 14:28:04 +01:00 committed by GitHub
commit 9c386716a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 118 additions and 128 deletions

View File

@ -603,6 +603,14 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += auto_init_saul
endif
ifneq (,$(filter saul_adc,$(USEMODULE)))
FEATURES_REQUIRED += periph_adc
endif
ifneq (,$(filter saul_gpio,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio
endif
ifneq (,$(filter saul,$(USEMODULE)))
USEMODULE += phydat
endif
@ -707,9 +715,24 @@ USEPKG += nanocoap
USEMODULE += gnrc_sock_udp
endif
# always select gpio (until explicit dependencies are sorted out)
FEATURES_OPTIONAL += periph_gpio
# always select power management if available
FEATURES_OPTIONAL += periph_pm
# include package dependencies
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.dep)
# remove required features from optional features
FEATURES_OPTIONAL := $(filter-out $(FEATURES_REQUIRED),$(FEATURES_OPTIONAL))
# add all optional but provided features to the list of used features
FEATURES_USED := $(sort $(FEATURES_REQUIRED) $(filter $(FEATURES_OPTIONAL),$(FEATURES_PROVIDED)))
# all periph features correspond to a periph submodule
USEMODULE += $(filter periph_%,$(FEATURES_USED))
# recursively catch transitive dependencies
USEMODULE := $(sort $(USEMODULE))
USEPKG := $(sort $(USEPKG))

View File

@ -207,6 +207,9 @@ INCLUDES += -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBAS
INCLUDES += -I$(RIOTCPU)/$(CPU)/include
INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include
# process provided features
-include $(RIOTBOARD)/$(BOARD)/Makefile.features
# mandatory includes!
include $(RIOTMAKE)/pseudomodules.inc.mk
include $(RIOTMAKE)/defaultmodules.inc.mk
@ -223,9 +226,6 @@ ifneq ($(GNRC_NETIF_NUMOF),1)
CFLAGS += -DGNRC_NETIF_NUMOF=$(GNRC_NETIF_NUMOF)
endif
# process provided features
include $(RIOTMAKE)/features.inc.mk
# process dependencies
include $(RIOTBASE)/Makefile.dep

View File

@ -2,3 +2,5 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
USEMODULE += saul_adc
endif
-include $(RIOTCPU)/k22f/Makefile.dep

View File

@ -0,0 +1 @@
-include $(RIOTCPU)/k64f/Makefile.dep

View File

@ -12,6 +12,9 @@ USEMODULE += nvram
USEMODULE += devfs
USEMODULE += mtd_spi_nor
# mulle always uses it's rtt
USEMODULE += periph_rtt
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
USEMODULE += saul_adc

View File

@ -11,3 +11,5 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += tcs37727
USEMODULE += tmp006
endif
-include $(RIOTCPU)/kw2xd/Makefile.dep

View File

@ -1,3 +1,3 @@
MODULE = arm7_common_periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,2 +1,2 @@
MODULE = atmega_common_periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,5 +1,4 @@
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_pm
-include $(RIOTCPU)/cortexm_common/Makefile.features

View File

@ -1 +1 @@
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,4 +1,3 @@
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_pm
-include $(RIOTCPU)/cortexm_common/Makefile.features

View File

@ -1 +1 @@
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1 +1,2 @@
FEATURES_PROVIDED += periph_pm
FEATURES_PROVIDED += cpp

View File

@ -2,6 +2,4 @@
INCLUDES += -I$(RIOTCPU)/cortexm_common/include
INCLUDES += -I$(RIOTCPU)/cortexm_common/include/vendor
USEMODULE += cortexm_common_periph
export IMAGE_HDR_SIZE ?= 512

View File

@ -1,3 +1,2 @@
MODULE = cortexm_common_periph
include $(RIOTBASE)/Makefile.base
include $(RIOTBASE)/makefiles/periph.mk

View File

@ -1 +1 @@
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

1
cpu/k22f/Makefile.dep Normal file
View File

@ -0,0 +1 @@
-include $(RIOTCPU)/kinetis_common/Makefile.dep

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

1
cpu/k64f/Makefile.dep Normal file
View File

@ -0,0 +1 @@
-include $(RIOTCPU)/kinetis_common/Makefile.dep

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -0,0 +1,3 @@
ifneq (,$(filter periph_rtc,$(USEMODULE)))
USEMODULE += periph_rtt
endif

View File

@ -1,5 +1,4 @@
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_pm
-include $(RIOTCPU)/cortexm_common/Makefile.features

View File

@ -14,11 +14,12 @@ export UNDEF += $(BINDIR)/kinetis_common/fcfield.o
export UNDEF += $(BINDIR)/kinetis_common/vectors.o
# include kinetis common periph drivers
export USEMODULE += kinetis_common_periph
export USEMODULE += periph_common
USEMODULE += kinetis_common_periph
USEMODULE += periph_common
#include layered power mode module
USEMODULE += pm_layered
# select kinetis periph drivers
USEMODULE += periph_mcg
USEMODULE += periph_wdog
# Define a recipe to build the watchdog disable binary, used when flashing
$(RIOTCPU)/kinetis_common/dist/wdog-disable.bin: $(RIOTCPU)/kinetis_common/dist/wdog-disable.s

View File

@ -1,3 +1,3 @@
MODULE = kinetis_common_periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

1
cpu/kw2xd/Makefile.dep Normal file
View File

@ -0,0 +1 @@
-include $(RIOTCPU)/kinetis_common/Makefile.dep

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -8,6 +8,9 @@ export USEMODULE += periph
export USEMODULE += periph_common
export USEMODULE += newlib
# mips32 needs periph_timer for its gettimeofday() implementation
export USEMODULE += periph_timer
ifeq ($(USE_UHI_SYSCALLS),1)
#Use UHI to handle syscalls
export LINKFLAGS += -luhi -Tuhi32.ld

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,2 +1,5 @@
export INCLUDES += -I$(RIOTCPU)/mips32r2_common/include \
-I$(RIOTCPU)/mips_pic32_common/include
USEMODULE += periph_common
USEMODULE += periph_hwrng

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1,3 @@
MODULE = msp430_common_periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -5,7 +5,8 @@ ifeq ($(BUILDOSXNATIVE),1)
export NATIVEINCLUDES += -I$(RIOTCPU)/native/osx-libc-extra
endif
export USEMODULE += periph
USEMODULE += periph
USEMODULE += periph_uart
ifeq ($(shell uname -s),Darwin)
export CFLAGS += -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE

View File

@ -1 +1 @@
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,6 +1,5 @@
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_flashpage
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_pm
-include $(RIOTCPU)/cortexm_common/Makefile.features

View File

@ -1,3 +1,3 @@
MODULE = nrf5x_common_periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1,3 @@
MODULE = sam0_common_periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1 +1 @@
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
FEATURES_PROVIDED += periph_pm
-include $(RIOTCPU)/sam0_common/Makefile.features

View File

@ -1 +1 @@
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
FEATURES_PROVIDED += periph_pm
-include $(RIOTCPU)/sam0_common/Makefile.features

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1,3 @@
MODULE = stm32_common_periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,4 +1,3 @@
FEATURES_PROVIDED += periph_flashpage
FEATURES_PROVIDED += periph_pm
-include $(RIOTCPU)/stm32_common/Makefile.features

View File

@ -1,5 +1 @@
# define the module name
MODULE = periph
# include RIOTs generic Makefile
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,4 +1,3 @@
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_pm
-include $(RIOTCPU)/stm32_common/Makefile.features

View File

@ -1,5 +1 @@
# define the module name
MODULE = periph
# include RIOTs generic Makefile
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,5 +1,4 @@
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_pm
# the granularity of provided feature definition for STMs is currently by CPU
# sub-family (e.g., stm32f[1234]). Unfortunately, only some of e.g., the

View File

@ -1,3 +1 @@
MODULE = periph
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,5 +1 @@
# define the module name
MODULE = periph
# include RIOTs generic Makefile
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,5 +1 @@
# define the module name
MODULE = periph
# include RIOTs generic Makefile
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,5 +1 @@
# define the module name
MODULE = periph
# include RIOTs generic Makefile
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,5 +1 @@
# define the module name
MODULE = periph
# include RIOTs generic Makefile
include $(RIOTBASE)/Makefile.base
include $(RIOTMAKE)/periph.mk

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 Freie Universität Berlin
* 2017 Kaspar Schleiser <kaspar@schleiser.de>
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
@ -14,16 +15,19 @@
* @brief Common static peripheral driver initialization implementation
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Kaspar Schleiser <kaspar@schleiser.de>
*
* @}
*/
#ifdef MODULE_PERIPH_SPI
#include "periph/spi.h"
#endif
void periph_init(void)
{
/* initialize configured SPI devices */
#ifdef SPI_NUMOF
#ifdef MODULE_PERIPH_SPI
for (unsigned i = 0; i < SPI_NUMOF; i++) {
spi_init(SPI_DEV(i));
}

View File

@ -31,6 +31,8 @@ export USEMODULE += cortexm_common
export USEMODULE += periph
# include common periph code
export USEMODULE += periph_common
export USEMODULE += cortexm_common_periph
# all cortex MCU's use newlib as libc
export USEMODULE += newlib

View File

@ -1,7 +0,0 @@
# import list of provided features
include $(RIOTBOARD)/$(BOARD)/Makefile.features
DEFAULT_FEATURES += periph_pm
# add available default features to required list
FEATURES_REQUIRED += $(filter-out $(DISABLE_FEATURES), $(filter $(FEATURES_PROVIDED), $(DEFAULT_FEATURES)))

View File

@ -1,9 +1,10 @@
USEMODULE := $(filter-out $(filter-out $(FEATURES_PROVIDED), $(FEATURES_OPTIONAL)), $(sort $(USEMODULE)))
ED = $(addprefix FEATURE_,$(sort $(filter $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))))
ED += $(addprefix MODULE_,$(sort $(USEMODULE) $(USEPKG)))
EXTDEFINES = $(addprefix -D,$(shell echo '$(ED)' | tr 'a-z-' 'A-Z_'))
REALMODULES = $(filter-out $(PSEUDOMODULES), $(sort $(USEMODULE) $(USEPKG)))
# filter "pseudomodules" from "real modules", but not "no_pseudomodules"
NO_PSEUDOMODULES := $(filter $(NO_PSEUDOMODULES), $(sort $(USEMODULE) $(USEPKG)))
REALMODULES = $(filter-out $(PSEUDOMODULES), $(sort $(USEMODULE) $(USEPKG))) $(NO_PSEUDOMODULES)
export BASELIBS += $(REALMODULES:%=$(BINDIR)/%.a)
CFLAGS += $(EXTDEFINES)

12
makefiles/periph.mk Normal file
View File

@ -0,0 +1,12 @@
MODULE ?= periph
# enable submodules
SUBMODULES := 1
# don't fail if requested submodule does not have corresponding *.c file
SUBMODULES_NOFORCE := 1
# in case of e.g., <cpu>_periph_common, use periph_* as submodule prefix
BASE_MODULE := periph
include $(RIOTBASE)/Makefile.base

View File

@ -98,3 +98,7 @@ PSEUDOMODULES += prng_%
# STM32 periph pseudomodules
PSEUDOMODULES += stm32_periph_%
# declare periph submodules as pseudomodules, but exclude periph_common
PSEUDOMODULES += periph_%
NO_PSEUDOMODULES += periph_common