nes-proj/arch/cpu/simplelink/Makefile.simplelink
2018-08-31 11:04:38 +02:00

108 lines
3.5 KiB
Makefile

CPU_ABS_PATH = $(CONTIKI)/arch/cpu/simplelink
SDK_SOURCE := $(SIMPLELINK_SDK)/source
# TODO fix switch
SDK_DEVICES := $(SDK_SOURCE)/ti/devices
SDK_DEVICE := $(shell ls $(SDK_DEVICES) | grep $(SIMPLELINK_DEVICE))
SDK_DEVICE_SOURCE := $(SDK_SOURCE)/ti/devices/$(SDK_DEVICE)
SDK_DRIVERLIB := $(SDK_DEVICE_SOURCE)/driverlib
SDK_DRIVERS := $(SDK_SOURCE)/ti/drivers
SDK_KERNEL := $(SIMPLELINK_SDK)/kernel/nortos
SDK_BOARDS := $(SDK_SOURCE)/ti/boards
SDK_STARTUP := $(SDK_DEVICE_SOURCE)/startup_files
SDK_STARTUP_SRCS := ccfg.c
EXTERNALDIRS += $(SDK_STARTUP)
### MODULES will add some of these to the include path, but we need to add
### them earlier to prevent filename clashes with Contiki core files
CFLAGS += -I$(CPU_ABS_PATH)
CFLAGS += -I$(CPU_ABS_PATH)/source
CFLAGS += -I$(SDK_SOURCE)
CFLAGS += -I$(SDK_DEVICE_SOURCE)
CFLAGS += -I$(SDK_DEVICE_SOURCE)/inc
CFLAGS += -I$(SDK_KERNEL)
CFLAGS += -I$(SDK_KERNEL)/posix
LDFLAGS += --entry resetISR
LDFLAGS += -static
LDFLAGS += --specs=nano.specs
LDFLAGS += -Wl,--defsym=_stack_origin=__stack
LDFLAGS += -Wl,--defsym=_heap=__heap_start__
LDFLAGS += -Wl,--defsym=_eheap=__heap_end__
SDK_BOARDS :=
ifneq ($(SIMPLELINK_BOARD),CUSTOM)
SDK_BOARDS := $(SDK_SOURCE)/ti/boards
LDSCRIPT = $(SDK_BOARDS)/$(SIMPLELINK_BOARD)/$(SIMPLELINK_BOARD)_NoRTOS.lds
CFLAGS += -I$(SDK_BOARDS)/$(SIMPLELINK_BOARD)
CONTIKI_SOURCEFILES += $(SIMPLELINK_BOARD).c
else
ifndef $(LDSCRIPT)
$(error You must speficy a custom linker script in LDSCRIPT.)
endif
endif
### If the user-specified a Node ID, pass a define
ifdef NODEID
CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID)
endif
### CPU-dependent directories
CONTIKI_ARM_DIRS += . common/dbg-io
CONTIKI_CPU_DIRS += . $(addprefix ../arm/, $(CPU_DIRS))
CONTIKI_CPU_DIRS += source
### CPU-dependent source files
CONTIKI_CPU_SOURCEFILES += rtimer-arch.c clock-arch.c
CONTIKI_CPU_SOURCEFILES += watchdog-arch.c putchar-arch.c
CONTIKI_CPU_SOURCEFILES += simplelink-uart.c
# CONTIKI_CPU_SOURCEFILES += contiki-watchdog.c aux-ctrl.c
# CONTIKI_CPU_SOURCEFILES += putchar.c ieee-addr.c batmon-sensor.c adc-sensor.c
# CONTIKI_CPU_SOURCEFILES += slip-arch.c slip.c cc26xx-uart.c lpm.c
# CONTIKI_CPU_SOURCEFILES += gpio-interrupt.c oscillators.c
# CONTIKI_CPU_SOURCEFILES += rf-core.c rf-ble.c ieee-mode.c
# CONTIKI_CPU_SOURCEFILES += random.c soc-trng.c int-master.c
DEBUG_IO_SOURCEFILES += dbg-printf.c dbg-snprintf.c dbg-sprintf.c strformat.c
CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES)
CPU_START_SOURCEFILES += $(SDK_STARTUP_SRCS)
### 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 $@
$(OBJECTDIR)/$(SIMPLELINK_BOARD).o: $(SDK_BOARDS)/$(SIMPLELINK_BOARD)/$(SIMPLELINK_BOARD).c
$(TRACE_CC)
$(Q)$(CC) $(CFLAGS) -c $< -o $@
RAM_SIZE = 0x00003E00
FLASH_SIZE = 0x0001E000
STACK_SIZE = 0
%.size: %.$(TARGET)
@$(SIZE) -A $< | egrep "data|bss" | awk '{s+=$$2} END {s=s+$(STACK_SIZE); f=$(RAM_SIZE)-s; printf "[RAM] used %6d, free %6d\n",s,f;}'
@$(SIZE) -A $< | egrep "text|isr_vector" | awk '{s+=$$2} END {f=$(FLASH_SIZE)-s; printf "[Flash] used %6d, free %6d\n",s,f;}'
UART_BAUDRATE = 115200
login:
$(SERIALDUMP) -b$(UART_BAUDRATE) $(PORT)
# TODO fix switch
include $(CPU_ABS_PATH)/Makefile.cc26x2_cc13x2