Cleanup in Makefiles

This commit is contained in:
Edvard Pettersen 2018-07-24 18:27:49 +02:00
parent 8fb568a7a2
commit ee0a4df7bf
7 changed files with 38 additions and 58 deletions

View File

@ -1,6 +1,8 @@
################################################################################
# CC13x2/CC26x2 CPU makefile
PRE_RTM = 1
# Core SDK is placed as a submodule under the arch/cpu/cc13xx-cc26xx/lib.
# Do a sanity check that Core SDK submodule has been initialized.
# Note that Core SDK can be overriden with a user-specified SimpleLink SDK.
@ -37,8 +39,8 @@ DEVICE_FAMILY_H := $(CORE_SDK)/source/ti/devices/DeviceFamily.h
# We are interested in the right-hand side of the define, i.e. the third word on the line,
# as it either defines a number or an another Device Family ID.
DEVICE_DEFINE := $(shell cat $(DEVICE_FAMILY_H) \
| grep "\#define DeviceFamily_ID_$(DEVICE_FAMILY)\\b" \
| awk '{print $$3}')
| grep "\#define DeviceFamily_ID_$(DEVICE_FAMILY)\\b" \
| awk '{print $$3}')
# If the define is a number, then the device family name is the resulting device name;
# Else, it points to a sub-name of the device family, e.g. DeviceFamily_ID_CC13X2_V1.
@ -48,19 +50,19 @@ DEVICE_DEFINE := $(shell cat $(DEVICE_FAMILY_H) \
IS_NUMBER := $(shell [ "$(DEVICE_DEFINE)" -eq "$(DEVICE_DEFINE)" ] 2>/dev/null; echo $$?)
ifeq ($(IS_NUMBER),0)
# The define points to a number, meaning the device family name is the same as the
# specified device name in lower case, e.g.
# cc13x2
DEVICE_FAMILY_NAME := $(DEVICE_FAMILY_LC)
# The define points to a number, meaning the device family name is the same as the
# specified device name in lower case, e.g.
# cc13x2
DEVICE_FAMILY_NAME := $(DEVICE_FAMILY_LC)
else
# The define points to a sub-name of the device family. The resulting device family name
# is therefore the name after specified after ID in lower case, e.g.
# DeviceFamily_ID_CC13X2_V1
# will result in
# cc13x2_v1
DEVICE_FAMILY_NAME := $(shell echo "$(DEVICE_DEFINE)" \
| sed -E "s/DeviceFamily_ID_(.+)/\1/" \
| tr A-Z a-z)
# The define points to a sub-name of the device family. The resulting device family name
# is therefore the name after specified after ID in lower case, e.g.
# DeviceFamily_ID_CC13X2_V1
# will result in
# cc13x2_v1
DEVICE_FAMILY_NAME := $(shell echo "$(DEVICE_DEFINE)" \
| sed -E "s/DeviceFamily_ID_(.+)/\1/" \
| tr A-Z a-z)
endif
# The DeviceFamily_constructPath() macro in DeviceFamily.h will always construct the
@ -68,9 +70,9 @@ endif
# root path. Note that the returned path is encased in angular brackets, <...>,
# and is therefore extracted with sed.
SDK_DEVICE_DIR := $(shell echo "DeviceFamily_constructPath(dummy)" \
| arm-none-eabi-cpp -x c -E -DDeviceFamily_$(DEVICE_FAMILY) -include $(DEVICE_FAMILY_H) - \
| tail -1 \
| sed -E 's:<(.+)/dummy>:\1:')
| arm-none-eabi-cpp -x c -E -DDeviceFamily_$(DEVICE_FAMILY) -include $(DEVICE_FAMILY_H) - \
| tail -1 \
| sed -E 's:<(.+)/dummy>:\1:')
################################################################################
# Simplelink SDK paths
@ -100,15 +102,15 @@ CONTIKI_CPU_SOURCEFILES += ieee-addr.c ble-addr.c
CONTIKI_CPU_SOURCEFILES += ble-beacond.c
ifeq ($(SUPPORTS_PROP_MODE),1)
CONTIKI_CPU_SOURCEFILES += prop-mode.c prop-settings.c prop-tx-power.c
CONTIKI_CPU_SOURCEFILES += prop-mode.c prop-settings.c prop-tx-power.c
endif
ifeq ($(SUPPORTS_IEEE_MODE),1)
CONTIKI_CPU_SOURCEFILES += ieee-mode.c ieee-settings.c ieee-tx-power.c
CONTIKI_CPU_SOURCEFILES += ieee-mode.c ieee-settings.c ieee-tx-power.c
endif
ifeq ($(SUPPORTS_BLE_BEACON),1)
CONTIKI_CPU_SOURCEFILES += ble-settings.c ble-tx-power.c
CONTIKI_CPU_SOURCEFILES += ble-settings.c ble-tx-power.c
endif
### CPU-dependent debug source files

View File

@ -8,10 +8,6 @@ ifndef CONTIKI
$(error 'CONTIKI' not defined! You must specify where CONTIKI resides!)
endif
ifndef FAMILY
$(error 'FAMILY' not defined! You must specify which Simplelink family you are using!)
endif
ifndef BOARD
$(error 'BOARD' not defined! You must specify which board you are using!)
endif
@ -19,12 +15,16 @@ endif
################################################################################
### Defines
SIMPLELINK_SDK := $(realpath $(SIMPLELINK_SDK))
SIMPLELINK_FAMILIES := cc13xx-cc26xx
SUPPORTED_FAMILIES := cc13xx-cc26xx
# Given a SimpleLink family as argument, check if it has the Board file and if so return itself.
verify_family = $(shell [ -d $(CONTIKI)/arch/platform/simplelink/$(1)/$(BOARD) ] && echo $(1))
ifeq ($(filter $(FAMILY), $(SUPPORTED_FAMILIES)),)
$(error Simlpelink Family $(FAMILY) is not supported.)
# Test each supported SimpleLink family and see if it contains the specified Board.
# Throw an error if it isn't found.
FAMILY := $(firstword $(foreach FAMILY, $(SIMPLELINK_FAMILIES), $(call verify_family,$(FAMILY))))
ifeq ($(FAMILY),)
$(error Board '$(BOARD)' does not corresponding to any SimpleLink family. Make sure your BOARD variable is correct.)
endif
FAMILY_PATH := $(realpath $(CONTIKI)/arch/platform/simplelink/$(FAMILY))
@ -37,4 +37,4 @@ include $(FAMILY_PATH)/Makefile.$(FAMILY)
################################################################################
# Display all supported SimpleLink Families
simplelink_families:
@echo "$(SUPPORTED_FAMILIES) (current: $(FAMILY))"
@echo "$(SIMPLELINK_FAMILIES) (current: $(FAMILY))"

View File

@ -7,13 +7,7 @@ BOARD_PLATFORMS = launchpad sensortag srf06
# Assigned lazily to avoid breaking environments which doesn't have cd and find
BOARDS := $(foreach BOARD_TYPE, $(BOARD_PLATFORMS), \
$(shell cd $(FAMILY_PATH); find $(BOARD_TYPE)/* -type d -print))
BOARD_EXISTS := $(shell [ -d "$(FAMILY_PATH)/$(BOARD)" ]; echo $$?)
ifneq ($(BOARD_EXISTS),0)
$(error Simplelink Board '$(BOARD)' is not supported for Simplelink Family '$(FAMILY)')
endif
$(shell cd $(FAMILY_PATH); find $(BOARD_TYPE)/* -type d -print))
################################################################################
# Directory and source configurations
@ -35,7 +29,6 @@ DEFINES += DeviceFamily_$(DEVICE_FAMILY)
DEFINES += DEVICE_LINE_$(DEVICE_LINE)
DEFINES += DEVICE_$(DEVICE)
DEFINES += $(BOARD_TYPE)
DEFINES += PLATFORM_HAS_BUTTON=$(PLATFORM_HAS_BUTTON)
DEFINES += SUPPORTS_PROP_MODE=$(SUPPORTS_PROP_MODE)
DEFINES += SUPPORTS_IEEE_MODE=$(SUPPORTS_IEEE_MODE)
DEFINES += SUPPORTS_BLE_BEACON=$(SUPPORTS_BLE_BEACON)

View File

@ -1,15 +1,6 @@
################################################################################
# SimpleLink LaunchPad makefile
# SimpleLink Custom makefile
BOARD_TYPE = BOARD_SENSORTAG
BOARD_TYPE = BOARD_CUSTOM
PLATFORM_HAS_BUTTON = 1
# leds-arch.c/h etc.
BOARD_SOURCEFILES += sensortag-sensors.c
BOARD_SOURCEFILES += button-sensor-arch.c ext-flash.c
BOARD_SOURCEFILES += bmp-280-sensor.c hdc-1000-sensor.c
BOARD_SOURCEFILES += mpu-9250-sensor.c opt-3001-sensor.c
BOARD_SOURCEFILES += tmp-007-sensor.c buzzer.c
TARGET_FAMILY_DIRS += sensortag
TARGET_FAMILY_DIRS += custom

View File

@ -3,9 +3,7 @@
BOARD_TYPE = BOARD_LAUNCHPAD
PLATFORM_HAS_BUTTON = 1
# leds-arch.c/h etc.
# leds-arch.c etc.
BOARD_SOURCEFILES += button-sensor-arch.c leds-arch.c
TARGET_FAMILY_DIRS += launchpad

View File

@ -3,9 +3,7 @@
BOARD_TYPE = BOARD_SENSORTAG
PLATFORM_HAS_BUTTON = 1
# leds-arch.c/h etc.
# leds-arch.c etc.
BOARD_SOURCEFILES += sensortag-sensors.c
BOARD_SOURCEFILES += button-sensor-arch.c
BOARD_SOURCEFILES += bmp-280-sensor.c hdc-1000-sensor.c

View File

@ -3,9 +3,7 @@
BOARD_TYPE = BOARD_SRF06
PLATFORM_HAS_BUTTON = 1
# leds-arch.c/h etc.
# leds-arch.c etc.
BOARD_SOURCEFILES += srf06-sensors.c
BOARD_SOURCEFILES += button-sensor-arch.c leds-arch.c
BOARD_SOURCEFILES += als-sensor.c