1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-30 00:41:17 +01:00

Merge pull request #1734 from Kijewski/issue-1715

make: add Makefile.features telling the BOARDs' features
This commit is contained in:
Ludwig Ortmann 2014-10-06 09:24:53 -07:00
commit 519821db41
21 changed files with 129 additions and 122 deletions

View File

@ -27,30 +27,36 @@ ifneq (, $(filter buildtest info-concurrency, $(MAKECMDGOALS)))
endif
endif
BOARDS ?= $(shell find $(RIOTBOARD)/* -maxdepth 0 -type d \! -name *-common -printf '%f ')
BOARDS := $(filter $(if $(BOARD_WHITELIST), $(BOARD_WHITELIST), %), $(BOARDS))
BOARDS := $(filter-out $(BOARD_BLACKLIST), $(BOARDS))
.PHONY: buildtest info-objsize info-buildsize info-buildsizes \
info-buildsizes-diff info-build info-boards-supported
info-buildsizes-diff info-build info-boards-supported \
info-features-missing info-boards-features-missing
COLOR_GREEN :=
COLOR_RED :=
COLOR_PURPLE :=
COLOR_RESET :=
COLOR_ECHO := /bin/echo
ifeq (, ${JENKINS_URL})
ifeq (0, $(shell tput colors 2>&1 > /dev/null; echo $$?))
COLOR_GREEN := \033[1;32m
COLOR_RED := \033[1;31m
COLOR_PURPLE := \033[1;35m
COLOR_RESET := \033[0m
COLOR_ECHO := /bin/echo -e
endif
endif
buildtest:
@if [ -z "$${JENKINS_URL}" ] && tput colors 2>&1 > /dev/null; then \
GREEN='\033[1;32m'; RED='\033[1;31m'; PURPLE='\033[1;35m'; RESET='\033[0m'; \
ECHO='/bin/echo -e'; \
else \
GREEN=''; RED=''; PURPLE=''; RESET=''; \
ECHO='/bin/echo'; \
fi; \
\
@ \
BUILDTESTOK=true; \
rm -rf "$$BINDIRBASE"; \
for BOARD in $(BOARDS); do \
for BOARD in $$($(MAKE) -s info-boards-supported); do \
RIOTNOLINK=$$(case ' $(BOARD_INSUFFICIENT_RAM) ' in *" $${BOARD} "*) echo 1; esac); \
$${ECHO} -n "Building for $${BOARD} "; \
[ -n "$${RIOTNOLINK}" ] && $${ECHO} -n "(no linking) "; \
${COLOR_ECHO} -n "Building for $${BOARD} "; \
[ -n "$${RIOTNOLINK}" ] && ${COLOR_ECHO} -n "(no linking) "; \
for NTH_TRY in 1 2; do \
$${ECHO} -n ".. "; \
${COLOR_ECHO} -n ".. "; \
LOG=$$(env -i \
HOME=$${HOME} \
PATH=$${PATH} \
@ -63,12 +69,12 @@ buildtest:
RIOT_VERSION=$${RIOT_VERSION} \
$(MAKE) -j$(NPROC) 2>&1 >/dev/null) ; \
if [ "$${?}" = "0" ]; then \
$${ECHO} "$${GREEN}success$${RESET}"; \
${COLOR_ECHO} "${COLOR_GREEN}success${COLOR_RESET}"; \
elif [ -n "$${RIOT_DO_RETRY}" ] && $${BUILDTESTOK} && [ $${NTH_TRY} = 1 ]; then \
$${ECHO} -n "$${PURPLE}retrying$${RESET} "; \
${COLOR_ECHO} -n "${COLOR_PURPLE}retrying${COLOR_RESET} "; \
continue; \
else \
$${ECHO} "$${RED}failed$${RESET}"; \
${COLOR_ECHO} "${COLOR_RED}failed${COLOR_RESET}"; \
echo "$${LOG}" | grep -v -E '^make(\[[[:digit:]]])?:'; \
BUILDTESTOK=false; \
fi; \
@ -98,7 +104,7 @@ info-buildsize:
info-buildsizes: SHELL=bash
info-buildsizes:
echo -e " text\t data\t bss\t dec\tboard"; \
for BOARD in $(BOARDS); do \
for BOARD in $$($(MAKE) -s info-boards-supported); do \
echo "$$(env -i \
HOME=$${HOME} \
PATH=$${PATH} \
@ -112,10 +118,8 @@ info-buildsizes:
info-buildsizes-diff: SHELL=bash
info-buildsizes-diff:
@GREEN='\033[1;32m'; RED='\033[1;31m'; RESET='\033[0m'; \
\
echo -e "text\tdata\tbss\tdec\tBOARD/BINDIRBASE\n"; \
for BOARD in $(BOARDS); do \
for BOARD in $$($(MAKE) -s info-boards-supported); do \
for BINDIRBASE in $${OLDBIN} $${NEWBIN}; do \
env -i \
HOME=$${HOME} \
@ -131,16 +135,16 @@ info-buildsizes-diff:
for I in 0 1 2 3; do \
if [[ -n "$${NEW[I]}" && -n "$${OLD[I]}" ]]; then \
DIFF=$$(($${NEW[I]} - $${OLD[I]})); \
if [[ "$${DIFF}" -gt 0 ]]; then echo -ne "$${RED}"; fi; \
if [[ "$${DIFF}" -lt 0 ]]; then echo -ne "$${GREEN}"; fi; \
if [[ "$${DIFF}" -gt 0 ]]; then $(COLOR_ECHO) -n "${COLOR_RED}"; fi; \
if [[ "$${DIFF}" -lt 0 ]]; then $(COLOR_ECHO) -n "${COLOR_GREEN}"; fi; \
else \
DIFF="$${RED}ERR"; \
fi; \
echo -ne "$${DIFF}\t$${RESET}"; \
done; \
echo "$${BOARD}"; \
for I in 0 1 2 3; do echo -ne "$${OLD[I]-$${RED}ERR$${RESET}}\t"; done; echo -e "$${OLDBIN}"; \
for I in 0 1 2 3; do echo -ne "$${NEW[I]-$${RED}ERR$${RESET}}\t"; done; echo -e "$${NEWBIN}\n"; \
for I in 0 1 2 3; do echo -ne "$${OLD[I]-${COLOR_RED}ERR${COLOR_RESET}}\t"; done; echo -e "$${OLDBIN}"; \
for I in 0 1 2 3; do echo -ne "$${NEW[I]-${COLOR_RED}ERR${COLOR_RESET}}\t"; done; echo -e "$${NEWBIN}\n"; \
done; \
done;
@ -165,6 +169,9 @@ info-build:
@echo 'ELFFILE: $(ELFFILE)'
@echo 'HEXFILE: $(HEXFILE)'
@echo ''
@echo 'FEATURES_REQUIRED: $(sort $(FEATURES_REQUIRED))'
@echo 'FEATURES_PROVIDED: $(sort $(FEATURES_PROVIDED))'
@echo ''
@echo 'CC: $(CC)'
@echo -e 'CFLAGS:$(patsubst %, \n\t%, $(CFLAGS))'
@echo ''
@ -200,7 +207,39 @@ info-build:
@echo -e 'MAKEFILE_LIST:$(patsubst %, \n\t%, $(abspath $(MAKEFILE_LIST)))'
info-boards-supported:
@echo "$(BOARDS)"
@echo $(BOARDS)
info-features-missing:
@echo $(filter-out $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))
info-boards-features-missing:
@for f in $(BOARDS_FEATURES_MISSING); do echo $${f}; done | column -t
ifneq (, $(filter info-boards-supported info-boards-features-missing info-build, $(MAKECMDGOALS)))
FEATURES_PROVIDED_BAK := $(FEATURES_PROVIDED)
define board_missing_features
FEATURES_PROVIDED :=
-include $${RIOTBOARD}/${1}/Makefile.features
FEATURES_MISSING := $$(filter-out $$(FEATURES_PROVIDED), $$(FEATURES_REQUIRED))
ifneq (, $${FEATURES_MISSING})
BOARDS_WITH_MISSING_FEATURES += ${1}
BOARDS_FEATURES_MISSING += "${1} $${FEATURES_MISSING}"
endif
endef
BOARDS ?= $(shell find $(RIOTBOARD)/* -maxdepth 0 -type d \! -name *-common -printf '%f ')
BOARDS := $(filter $(if $(BOARD_WHITELIST), $(BOARD_WHITELIST), %), $(BOARDS))
BOARDS := $(filter-out $(BOARD_BLACKLIST), $(BOARDS))
BOARDS_WITH_MISSING_FEATURES :=
BOARDS_FEATURES_MISSING :=
$(foreach BOARD, $(BOARDS), $(eval $(call board_missing_features,$(BOARD))))
BOARDS := $(filter-out $(BOARDS_WITH_MISSING_FEATURES), $(BOARDS))
FEATURES_PROVIDED := $(FEATURES_PROVIDED_BAK)
endif
info-concurrency:
@echo "$(NPROC)"

View File

@ -107,3 +107,7 @@ endif
ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))
USEPKG += libfixmath
endif
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
FEATURES_REQUIRED += transceiver
endif

View File

@ -11,18 +11,6 @@ RIOTCPU := $(abspath $(RIOTCPU))
RIOTBOARD ?= $(RIOTBASE)/boards
RIOTBOARD := $(abspath $(RIOTBOARD))
ifeq (,$(filter buildtest,$(MAKECMDGOALS)))
ifneq (,$(BOARD_WHITELIST))
ifeq (,$(filter $(BOARD),$(BOARD_WHITELIST)))
$(error This application only runs on following boards: $(BOARD_WHITELIST))
endif
endif
ifneq (,$(filter $(BOARD),$(BOARD_BLACKLIST)))
$(error This application does not run on following boards: $(BOARD_BLACKLIST))
endif
endif
BINDIRBASE ?= $(CURDIR)/bin
BINDIR ?= $(abspath $(BINDIRBASE)/$(BOARD))/
@ -89,6 +77,9 @@ ifeq ($(strip $(MCU)),)
MCU = $(CPU)
endif
# import list of provided features
-include $(RIOTBOARD)/$(BOARD)/Makefile.features
# if you want to publish the board into the sources as an uppercase #define
BOARDDEF := $(shell echo $(BOARD) | tr 'a-z' 'A-Z' | tr '-' '_')
CPUDEF := $(shell echo $(CPU) | tr 'a-z' 'A-Z' | tr '-' '_')
@ -102,11 +93,6 @@ ifneq (0, $(shell mkdir -p $(BINDIR); $(AR) -rc $(BINDIR)empty-archive.a 2> /dev
AR := $(RIOTBASE)/dist/ar-wrapper $(AR)
endif
# Test if there where dependencies against a module in DISABLE_MODULE.
ifneq (, $(filter $(DISABLE_MODULE), $(USEMODULE)))
$(error "Required modules were disabled using DISABLE_MODULE: $(sort $(filter $(DISABLE_MODULE), $(USEMODULE)))")
endif
# Feature test default CFLAGS and LINKFLAGS for the set compiled.
include $(RIOTBASE)/Makefile.cflags
@ -217,3 +203,41 @@ include $(RIOTBASE)/Makefile.buildtests
# Export variables used throughout the whole make system:
include $(RIOTBASE)/Makefile.vars
ifneq (, $(filter all, $(if $(MAKECMDGOALS), $(MAKECMDGOALS), all)))
EXPECT_ERRORS :=
# Test if there where dependencies against a module in DISABLE_MODULE.
ifneq (, $(filter $(DISABLE_MODULE), $(USEMODULE)))
$(shell $(COLOR_ECHO) "$(COLOR_RED)Required modules were disabled using DISABLE_MODULE:$(COLOR_RESET)"\
"$(sort $(filter $(DISABLE_MODULE), $(USEMODULE)))" 1>&2)
EXPECT_ERRORS := 1
endif
# Test if all feature requirements were met by the selected board.
ifneq (, $(filter-out $(FEATURES_PROVIDED), $(FEATURES_REQUIRED)))
$(shell $(COLOR_ECHO) "$(COLOR_RED)There are unsatisfied feature requirements:$(COLOR_RESET)"\
"$(filter-out $(FEATURES_PROVIDED), $(FEATURES_REQUIRED))" 1>&2)
EXPECT_ERRORS := 1
endif
# If there is a whitelist, then test if the board is whitelisted.
ifneq (, $(BOARD_WHITELIST))
ifeq (, $(filter $(BOARD_WHITELIST), $(BOARD)))
$(shell $(COLOR_ECHO) "$(COLOR_RED)The selected BOARD=${BOARD} is not whitelisted:$(COLOR_RESET) ${BOARD_WHITELIST}" 1>&2)
EXPECT_ERRORS := 1
endif
endif
# If there is a blacklist, then test if the board is blacklisted.
ifneq (, $(BOARD_BLACKLIST))
ifneq (, $(filter $(BOARD_BLACKLIST), $(BOARD)))
$(shell $(COLOR_ECHO) "$(COLOR_RED)The selected BOARD=${BOARD} is blacklisted:$(COLOR_RESET) ${BOARD_BLACKLIST}" 1>&2)
EXPECT_ERRORS := 1
endif
endif
ifneq (, $(EXPECT_ERRORS))
$(shell $(COLOR_ECHO) "\n\n$(COLOR_RED)EXPECT ERRORS!$(COLOR_RESET)\n\n" 1>&2)
endif
endif

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1,2 @@
# Enable this after fixing https://github.com/RIOT-OS/RIOT/issues/659
#FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -11,7 +11,7 @@ export CFLAGS += -march=armv4t -mtune=arm7tdmi-s -mlong-calls \
-nodefaultlibs -Wcast-align -Wall -Wstrict-prototypes -Wextra \
-Os -pipe
export CFLAGS_MTHUMB ?= -mthumb
$(warning TODO add -mthumb)
# TODO add -mthumb
export AFLAGS = -Wa,-gstabs $(CFLAGS)
export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -0,0 +1 @@
FEATURES_PROVIDED = transceiver

View File

@ -28,22 +28,6 @@ CFLAGS += -DDEVELHELP
QUIET ?= 1
BOARD_INSUFFICIENT_RAM := chronos msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1 redbee-econotag
BOARD_BLACKLIST := arduino-due mbed_lpc1768 msb-430 pttu udoo qemu-i386 \
stm32f0discovery stm32f3discovery stm32f4discovery pca10000 pca10005 \
arduino-mega2560 msbiot yunjia-nrf51822 samr21-xpro
# mbed_lpc1768: see https://github.com/RIOT-OS/RIOT/issues/675
# msb-430: see https://github.com/RIOT-OS/RIOT/issues/658
# pttu: see https://github.com/RIOT-OS/RIOT/issues/659
# qemu-i386: no transceiver, yet
# stm32f0discovery: no transceiver, yet
# stm32f3discovery: no transceiver, yet
# stm32f4discovery: no transceiver, yet
# pca10000: no transceiver, yet
# pca10005: no transceiver, yet
# arduino-mega2560: no transceiver, yet
# msbiot: no transceiver, yet
# yunjia-nrf51822: no transceiver, yet
# samr21-xpro: no transceiver, yet
# Modules to include:

View File

@ -28,22 +28,6 @@ CFLAGS += -DDEVELHELP
QUIET ?= 1
BOARD_INSUFFICIENT_RAM := chronos msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1 redbee-econotag
BOARD_BLACKLIST := arduino-due mbed_lpc1768 msb-430 pttu udoo qemu-i386 \
stm32f0discovery stm32f3discovery stm32f4discovery \
pca10000 pca10005 arduino-mega2560 msbiot yunjia-nrf51822 \
samr21-xpro
# mbed_lpc1768: see https://github.com/RIOT-OS/RIOT/issues/675
# msb-430: see https://github.com/RIOT-OS/RIOT/issues/658
# pttu: see https://github.com/RIOT-OS/RIOT/issues/659
# qemu-i386: no transceiver, yet
# stm32f0discovery: no transceiver, yet
# stm32f3discovery: no transceiver, yet
# stm32f4discovery: no transceiver, yet
# pca10000/5: no transceiver, yet
# arduino-mega2560: no transceiver, yet
# msbiot: no transceiver, yet
# yunjia-nrf51822: no transceiver, yet
# samr21-xpro: no transceiver, yet
# Modules to include:

View File

@ -35,22 +35,9 @@ ifeq ($(shell $(CC) -Wno-cpp -E - 2>/dev/null >/dev/null dev/null ; echo $$?),0)
endif
BOARD_INSUFFICIENT_RAM := chronos msb-430h redbee-econotag telosb wsn430-v1_3b wsn430-v1_4 z1
BOARD_BLACKLIST := arduino-due mbed_lpc1768 msb-430 pttu udoo qemu-i386 stm32f0discovery \
stm32f3discovery stm32f4discovery pca10000 pca10005 arduino-mega2560 \
msbiot yunjia-nrf51822 samr21-xpro
# mbed_lpc1768: see https://github.com/RIOT-OS/RIOT/issues/675
# msb-430: see https://github.com/RIOT-OS/RIOT/issues/658
# pttu: see https://github.com/RIOT-OS/RIOT/issues/659
# qemu-i386: no transceiver, yet
# stm32f0discovery: no transceiver, yet
# stm32f3discovery: no transceiver, yet
# stm32f4discovery: no transceiver, yet
# pca10000: no transceiver, yet
# pca10005: no transceiver, yet
# arduino-mega2560: time.h missing from avr-libc
# msbiot: no transceiver, yet
# yunjia-nrf51822: no transceiver, yet
# samr21-xpro: no transceiver, yet
BOARD_BLACKLIST := arduino-mega2560
# Modules to include:

View File

@ -1,18 +1,5 @@
APPLICATION = net_if
BOARD_BLACKLIST = mbed_lpc1768 arduino-due udoo qemu-i386 stm32f0discovery stm32f3discovery \
stm32f4discovery pca10000 pca10005 arduino-mega2560 msbiot yunjia-nrf51822 \
samr21-xpro
# qemu-i386: no transceiver, yet
# stm32f0discovery: no transceiver, yet
# stm32f3discovery: no transceiver, yet
# stm32f4discovery: no transceiver, yet
# pca10000: no transceiver, yet
# pca10005: no transceiver, yet
# msbiot: no transceiver, yet
# yunjia-nrf51822: no transceiver, yet
# samr21-xpro: no transceiver, yet
include ../Makefile.tests_common
ifeq ($(BOARD),stm32f4discovery)

View File

@ -2,21 +2,6 @@ APPLICATION = pnet
include ../Makefile.tests_common
BOARD_INSUFFICIENT_RAM := chronos msb-430h redbee-econotag telosb wsn430-v1_3b wsn430-v1_4 z1
BOARD_BLACKLIST := arduino-due mbed_lpc1768 msb-430 udoo qemu-i386 stm32f0discovery \
stm32f3discovery stm32f4discovery pca10000 pca10005 arduino-mega2560 \
msbiot yunjia-nrf51822 samr21-xpro
# mbed_lpc1768: see https://github.com/RIOT-OS/RIOT/issues/675
# msb-430: see https://github.com/RIOT-OS/RIOT/issues/658
# qemu-i386: no transceiver, yet
# stm32f0discovery: no transceiver, yet
# stm32f3discovery: no transceiver, yet
# stm32f4discovery: no transceiver, yet
# pca10000: no transceiver, yet
# pca10005: no transceiver, yet
# arduino-mega2560: unknown type name radio_packet_length_t
# msbiot: no transceiver, yet
# yunjia-nrf51822: no transceiver, yet
# yunjia-nrf51822: no transceiver, yet
USEMODULE += posix
USEMODULE += pnet