nes-proj/arch/cpu/cc13xx-cc26xx/Makefile.cc13xx-cc26xx

146 lines
5.4 KiB
Makefile
Raw Normal View History

################################################################################
# CC13x2/CC26x2 CPU makefile
2018-07-24 16:27:49 +00:00
PRE_RTM = 1
2018-07-24 15:46:42 +00:00
# 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.
# As long as the SimpleLink SDK matches the device in use and is of a reasonable
# newer version, then it should be no different than using Core SDK.
ifeq ($(CORE_SDK),)
CORE_SDK := $(CONTIKI_CPU)/lib/coresdk_cc13xx_cc26xx
CORE_SDK_INIT := $(shell [ -f $(CORE_SDK)/.git ]; echo $$?)
ifeq ($(CORE_SDK_INIT),1)
$(error The Core SDK submodule is not available. Please run 'git submodule update --init --recursive')
endif
else
# Core SDK was overriden. Do a sanity check the path exists.
CORE_SDK_VALID := $(shell [ -d $(CORE_SDK) ]; echo $$?)
ifeq ($(CORE_SDK_VALID),1)
$(error Supplied CORE_SDK is not a valid path.)
endif
endif
# Clean up the path.
CORE_SDK := ${realpath $(CORE_SDK)}
# ccfg.c comes from the device-specific startp_files folder,
# and startup_cc13xx_cc26xx_gcc.c comes from NoRTOS startup folder
CPU_START_SOURCEFILES += ccfg.c startup_cc13xx_cc26xx_gcc.c
################################################################################
# Device Family
2018-07-24 15:46:42 +00:00
DEVICE_FAMILY_H := $(CORE_SDK)/source/ti/devices/DeviceFamily.h
# The define of the Device Family ID is on the format of either
# #define DeviceFamily_ID_<device> <number>
# or
# #define DeviceFamily_ID_<device> <sub-device-family-id>
# 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) \
2018-07-24 16:27:49 +00:00
| 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.
# This line checks if the extracted define is a number or not, based on this SO post:
# https://stackoverflow.com/a/19116862/5099169
2018-05-30 10:21:54 +00:00
# Return value 0 is no error, i.e. is a number.
IS_NUMBER := $(shell [ "$(DEVICE_DEFINE)" -eq "$(DEVICE_DEFINE)" ] 2>/dev/null; echo $$?)
2018-05-30 10:21:54 +00:00
ifeq ($(IS_NUMBER),0)
2018-07-24 16:27:49 +00:00
# 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
2018-07-24 16:27:49 +00:00
# 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
# correct path for device specific files. In this case, constructing the device specific
# 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)" \
2018-07-24 16:27:49 +00:00
| arm-none-eabi-cpp -x c -E -DDeviceFamily_$(DEVICE_FAMILY) -include $(DEVICE_FAMILY_H) - \
| tail -1 \
| sed -E 's:<(.+)/dummy>:\1:')
################################################################################
# Simplelink SDK paths
2018-07-24 15:46:42 +00:00
SDK_KERNEL := $(CORE_SDK)/kernel/nortos
SDK_SOURCE := $(CORE_SDK)/source
SDK_BOARDS := $(SDK_SOURCE)/ti/boards
SDK_DRIVERS := $(SDK_SOURCE)/ti/drivers
SDK_DEVICE := $(SDK_SOURCE)/$(SDK_DEVICE_DIR)
EXTERNALDIRS += $(SDK_SOURCE)
EXTERNALDIRS += $(SDK_KERNEL)
EXTERNALDIRS += $(SDK_KERNEL)/startup
EXTERNALDIRS += $(SDK_DEVICE)
EXTERNALDIRS += $(SDK_DEVICE)/startup_files
### CPU-dependent source files
CONTIKI_CPU_SOURCEFILES += rtimer-arch.c clock-arch.c
2018-06-29 17:03:17 +00:00
CONTIKI_CPU_SOURCEFILES += watchdog-arch.c dbg-arch.c
CONTIKI_CPU_SOURCEFILES += uart0-arch.c slip-arch.c
CONTIKI_CPU_SOURCEFILES += gpio-hal-arch.c int-master-arch.c
CONTIKI_CPU_SOURCEFILES += random.c trng-arch.c
2018-07-06 16:23:43 +00:00
### RF source files
CONTIKI_CPU_SOURCEFILES += sched.c data-queue.c
CONTIKI_CPU_SOURCEFILES += ieee-addr.c ble-addr.c
CONTIKI_CPU_SOURCEFILES += ble-beacond.c
2018-06-29 17:03:17 +00:00
2018-05-30 10:21:54 +00:00
ifeq ($(SUPPORTS_PROP_MODE),1)
2018-07-24 16:27:49 +00:00
CONTIKI_CPU_SOURCEFILES += prop-mode.c prop-settings.c prop-tx-power.c
2018-05-30 10:21:54 +00:00
endif
ifeq ($(SUPPORTS_IEEE_MODE),1)
2018-07-24 16:27:49 +00:00
CONTIKI_CPU_SOURCEFILES += ieee-mode.c ieee-settings.c ieee-tx-power.c
2018-05-30 10:21:54 +00:00
endif
2018-07-06 16:23:43 +00:00
ifeq ($(SUPPORTS_BLE_BEACON),1)
2018-07-24 16:27:49 +00:00
CONTIKI_CPU_SOURCEFILES += ble-settings.c ble-tx-power.c
2018-07-06 16:23:43 +00:00
endif
### CPU-dependent debug source files
MODULES += os/lib/dbg-io
### CPU-dependent directories
2018-07-09 18:13:01 +00:00
CONTIKI_CPU_DIRS += . dev $(SUBFAMILY)
CONTIKI_CPU_DIRS += rf rf-settings rf-settings/$(DEVICE_FAMILY_LC)
CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES)
### Linker flag
LDFLAGS += --entry resetISR
LDFLAGS += -static
LDFLAGS += --specs=nano.specs
LDSCRIPT := $(CONTIKI_CPU)/$(SUBFAMILY)/$(SUBFAMILY).lds
### Always re-build ieee-addr.o in case the command line passes a new NODEID
FORCE:
$(OBJECTDIR)/ieee-addr.o: ieee-addr.c FORCE | $(OBJECTDIR)
$(TRACE_CC)
$(Q)$(CC) $(CFLAGS) -c $< -o $@
### Always re-build ccfg.c so changes to ccfg-conf.h will apply without having
### to make clean first
$(OBJECTDIR)/ccfg.o: ccfg.c FORCE | $(OBJECTDIR)
$(TRACE_CC)
$(Q)$(CC) $(CFLAGS) -include "ccfg-conf.h" -c $< -o $@
2018-05-30 10:21:54 +00:00
include $(CONTIKI_CPU)/$(SUBFAMILY)/Makefile.$(SUBFAMILY)