Skip to content

Commit

Permalink
Merge pull request #9081 from kaspar030/add_arch_features
Browse files Browse the repository at this point in the history
make: add architecture features and feature blacklisting
  • Loading branch information
kaspar030 authored Oct 14, 2019
2 parents 0e0b6f8 + 3eae2f7 commit 8a1e78b
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 37 deletions.
2 changes: 2 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,8 @@ FEATURES_OPTIONAL += periph_pm
# include package dependencies
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.dep)

# always select provided architecture features
FEATURES_REQUIRED += $(filter arch_%,$(FEATURES_PROVIDED))

# all periph features correspond to a periph submodule
# FEATURES_USED is defined in Makefile.features
Expand Down
10 changes: 8 additions & 2 deletions Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ endif
# Resolve FEATURES_ variables
# Their value will only be complete after resolving dependencies

# Features that are required by the application but not provided by the BSP
# Features that are required by the application but not provided by the BSP and
# features that are used but blacklisted (prepended with "!").
# Having features missing may case the build to fail.
FEATURES_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED)))
FEATURES_MISSING = $(sort $(filter-out $(FEATURES_PROVIDED),$(FEATURES_REQUIRED)) \
$(call _features_used_blacklisted))

# Features that are only optional and not required at the same time.
# The policy is to by default use by features if they are provided by the BSP.
Expand All @@ -47,3 +49,7 @@ _features_conflicting = $(if $(call _features_used_conflicting,$(subst :, ,$1)),
# $1: list of features that conflict together
# Return non empty on error
_features_used_conflicting = $(filter $(words $1),$(words $(filter $(FEATURES_USED),$1)))

# Return features that are used but blacklisted as
# "!<feature>" ("not feature")
_features_used_blacklisted = $(addprefix !,$(sort $(filter $(FEATURES_USED), $(FEATURES_BLACKLIST))))
3 changes: 3 additions & 0 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,9 @@ ifneq (, $(filter all flash, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all)))
EXPECT_ERRORS := 1
endif

# turn provided but blacklisted features into required "!<feature>"
FEATURES_REQUIRED += $(addprefix !,$(sort $(filter $(FEATURES_PROVIDED), $(FEATURES_BLACKLIST))))

# Test if all feature requirements were met by the selected board.
ifneq (,$(FEATURES_MISSING))
$(shell $(COLOR_ECHO) "$(COLOR_RED)There are unsatisfied feature requirements:$(COLOR_RESET)"\
Expand Down
3 changes: 3 additions & 0 deletions cpu/arm7_common/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
FEATURES_PROVIDED += arch_32bit
FEATURES_PROVIDED += arch_arm
FEATURES_PROVIDED += arch_arm7
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += periph_pm
5 changes: 3 additions & 2 deletions cpu/atmega_common/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FEATURES_PROVIDED += arch_8bit
FEATURES_PROVIDED += arch_avr8
FEATURES_PROVIDED += atmega_pcint0
FEATURES_PROVIDED += periph_eeprom
FEATURES_PROVIDED += periph_pm

FEATURES_PROVIDED += atmega_pcint0
3 changes: 3 additions & 0 deletions cpu/cortexm_common/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
FEATURES_PROVIDED += arch_32bit
FEATURES_PROVIDED += arch_arm
FEATURES_PROVIDED += arch_cortexm
FEATURES_PROVIDED += periph_pm
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += cpu_check_address
3 changes: 2 additions & 1 deletion cpu/esp32/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Features that are provided by the CPU independent on the board
FEATURES_PROVIDED += arch_32bit
FEATURES_PROVIDED += arch_esp32
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_hwrng
Expand Down
2 changes: 2 additions & 0 deletions cpu/esp8266/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# MCU defined features that are provided independent on board definitions

FEATURES_PROVIDED += arch_32bit
FEATURES_PROVIDED += arch_esp8266
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_pm
Expand Down
2 changes: 2 additions & 0 deletions cpu/mips32r2_common/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
FEATURES_PROVIDED += arch_32bit
FEATURES_PROVIDED += arch_mips32r2
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += periph_pm
2 changes: 2 additions & 0 deletions cpu/msp430_common/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
FEATURES_PROVIDED += arch_16bit
FEATURES_PROVIDED += arch_msp430
FEATURES_PROVIDED += periph_flashpage
FEATURES_PROVIDED += periph_pm
2 changes: 2 additions & 0 deletions cpu/native/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FEATURES_PROVIDED += arch_32bit
FEATURES_PROVIDED += arch_native
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_hwrng
Expand Down
2 changes: 2 additions & 0 deletions makefiles/info-global.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ FEATURES_CONFLICT_GLOBAL := $(FEATURES_CONFLICT)
FEATURES_CONFLICT_MSG_GLOBAL := $(FEATURES_MSG_CONFLICT)
DISABLE_MODULE_GLOBAL := $(DISABLE_MODULE)
DEFAULT_MODULE_GLOBAL := $(DEFAULT_MODULE)
FEATURES_BLACKLIST_GLOBAL := $(FEATURES_BLACKLIST)

define board_missing_features
BOARD := $(1)
Expand All @@ -20,6 +21,7 @@ define board_missing_features
FEATURES_OPTIONAL := $(FEATURES_OPTIONAL_GLOBAL)
FEATURES_CONFLICT := $(FEATURES_CONFLICT_GLOBAL)
FEATURES_CONFLICT_MSG := $(FEATURES_CONFLICT_MSG_GLOBAL)
FEATURES_BLACKLIST:= $(FEATURES_BLACKLIST_GLOBAL)

# Remove board specific variables set by Makefile.features/Makefile.dep
FEATURES_PROVIDED :=
Expand Down
2 changes: 2 additions & 0 deletions makefiles/info.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ info-build:
@echo ' $(or $(sort $(FEATURES_PROVIDED)), -none-)'
@echo 'FEATURES_MISSING (only non optional features):'
@echo ' $(or $(FEATURES_MISSING), -none-)'
@echo 'FEATURES_BLACKLIST (blacklisted features):'
@echo ' $(or $(sort $(FEATURES_BLACKLIST)), -none-)'
@echo ''
@echo 'FEATURES_CONFLICT: $(FEATURES_CONFLICT)'
@echo 'FEATURES_CONFLICT_MSG: $(FEATURES_CONFLICT_MSG)'
Expand Down
6 changes: 6 additions & 0 deletions pkg/lwip/Makefile.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# lwIP's memory management doesn't seem to work on non 32-bit platforms at the
# moment.
FEATURES_REQUIRED += arch_32bit

# lwip currently doesn't compile on esp8266
FEATURES_BLACKLIST += arch_esp8266
8 changes: 0 additions & 8 deletions tests/lwip/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
include ../Makefile.tests_common

# lwIP's memory management doesn't seem to work on non 32-bit platforms at the
# moment.
BOARD_BLACKLIST := arduino-duemilanove arduino-leonardo \
arduino-mega2560 arduino-nano \
arduino-uno chronos esp8266-esp-12x esp8266-olimex-mod \
esp8266-sparkfun-thing mega-xplained \
msb-430 msb-430h telosb waspmote-pro \
wsn430-v1_3b wsn430-v1_4 z1
BOARD_INSUFFICIENT_MEMORY := airfy-beacon hifive1 hifive1b i-nucleo-lrwan1 nrf6310 \
nucleo-f031k6 nucleo-f042k6 \
nucleo-l031k6 nucleo-f030r8 nucleo-f303k8 \
Expand Down
8 changes: 0 additions & 8 deletions tests/lwip_sock_ip/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
include ../Makefile.tests_common

# lwIP's memory management doesn't seem to work on non 32-bit platforms at the
# moment.
BOARD_BLACKLIST := arduino-duemilanove arduino-leonardo \
arduino-mega2560 arduino-nano \
arduino-uno chronos esp8266-esp-12x esp8266-olimex-mod \
esp8266-sparkfun-thing mega-xplained \
msb-430 msb-430h telosb waspmote-pro \
wsn430-v1_3b wsn430-v1_4 z1
BOARD_INSUFFICIENT_MEMORY = i-nucleo-lrwan1 nucleo-f031k6 nucleo-f042k6 \
nucleo-l031k6 nucleo-f030r8 nucleo-f303k8 \
nucleo-f334r8 nucleo-l053r8 stm32f0discovery \
Expand Down
8 changes: 0 additions & 8 deletions tests/lwip_sock_tcp/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
include ../Makefile.tests_common

# lwIP's memory management doesn't seem to work on non 32-bit platforms at the
# moment.
BOARD_BLACKLIST := arduino-duemilanove arduino-leonardo \
arduino-mega2560 arduino-nano \
arduino-uno chronos esp8266-esp-12x esp8266-olimex-mod \
esp8266-sparkfun-thing mega-xplained \
msb-430 msb-430h telosb waspmote-pro \
wsn430-v1_3b wsn430-v1_4 z1
BOARD_INSUFFICIENT_MEMORY = blackpill bluepill i-nucleo-lrwan1 \
nucleo-f031k6 nucleo-f042k6 \
nucleo-l031k6 nucleo-f030r8 nucleo-f302r8 \
Expand Down
8 changes: 0 additions & 8 deletions tests/lwip_sock_udp/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
include ../Makefile.tests_common

# lwIP's memory management doesn't seem to work on non 32-bit platforms at the
# moment.
BOARD_BLACKLIST := arduino-duemilanove arduino-leonardo \
arduino-mega2560 arduino-nano \
arduino-uno chronos esp8266-esp-12x esp8266-olimex-mod \
esp8266-sparkfun-thing mega-xplained \
msb-430 msb-430h telosb waspmote-pro \
wsn430-v1_3b wsn430-v1_4 z1
BOARD_INSUFFICIENT_MEMORY = i-nucleo-lrwan1 nucleo-f031k6 nucleo-f042k6 \
nucleo-l031k6 nucleo-f030r8 \
nucleo-f303k8 nucleo-f334r8 nucleo-l053r8 \
Expand Down

0 comments on commit 8a1e78b

Please sign in to comment.