From a40e5bc31474b9ce395cb097f7343da548c5b504 Mon Sep 17 00:00:00 2001 From: Richard Weickelt Date: Tue, 6 Feb 2018 16:22:02 +0100 Subject: [PATCH] Build the board file and add all libraries from the SDK --- arch/cpu/arm/cortex-m/cm4/Makefile.cm4 | 7 +++++-- arch/cpu/simplelink/Makefile.cc26x2_cc13x2 | 5 +++-- arch/cpu/simplelink/Makefile.simplelink | 19 ++++++++++++++----- arch/platform/simplelink/Makefile.simplelink | 2 +- arch/platform/simplelink/platform.c | 3 +++ 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 b/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 index 02e9e5648..2cfbe4592 100644 --- a/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 +++ b/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 @@ -7,6 +7,9 @@ LDFLAGS += -T $(LDSCRIPT) LDFLAGS += -Wl,--gc-sections,--sort-section=alignment LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch +TARGET_LIBFLAGS := ${addprefix -l:,$(TARGET_LIBFILES)} +TARGET_LIBFLAGS += -gcc -lm -lnosys -lc + OBJCOPY_FLAGS += --gap-fill 0xff ### Build syscalls for newlib @@ -19,8 +22,8 @@ CUSTOM_RULE_LINK = 1 .SECONDEXPANSION: -%.elf: $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(TARGET_LIBS) $(CONTIKI_NG_TARGET_LIB) +%.elf: $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(TRACE_LD) - $(Q)$(LD) $(LDFLAGS) ${filter %.o %.a,$^} $(TARGET_LIBS) -o $@ + $(Q)$(LD) $(LDFLAGS) ${filter %.o %.a,$^} -Wl,--start-group $(TARGET_LIBFLAGS) -Wl,--end-group -o $@ include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m diff --git a/arch/cpu/simplelink/Makefile.cc26x2_cc13x2 b/arch/cpu/simplelink/Makefile.cc26x2_cc13x2 index a0a91679f..d4555ff51 100644 --- a/arch/cpu/simplelink/Makefile.cc26x2_cc13x2 +++ b/arch/cpu/simplelink/Makefile.cc26x2_cc13x2 @@ -8,10 +8,11 @@ endif CFLAGS += -I$(CPU_ABS_PATH)/cc26x2_cc13x2 CFLAGS += -I$(SDK_KERNEL) -TARGET_LIBFILES += $(SDK_DRIVERLIB)/bin/gcc/driverlib.lib +TARGET_LIBFILES += $(SDK_DRIVERS)/rf/lib/rf_multiMode_cc13x2.am4fg TARGET_LIBFILES += $(SDK_DRIVERS)/lib/drivers_cc13x2.am4fg -TARGET_LIBFILES += $(SDK_DRIVERS)/lib/rf_multiMode_cc13x2.am4fg TARGET_LIBFILES += $(SDK_KERNEL)/lib/nortos_cc13x2.am4fg +TARGET_LIBFILES += $(SDK_DRIVERLIB)/bin/gcc/driverlib.lib + include $(CONTIKI)/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 diff --git a/arch/cpu/simplelink/Makefile.simplelink b/arch/cpu/simplelink/Makefile.simplelink index 14b8efb59..3e83c74b3 100644 --- a/arch/cpu/simplelink/Makefile.simplelink +++ b/arch/cpu/simplelink/Makefile.simplelink @@ -11,13 +11,9 @@ 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 startup_gcc.c +SDK_STARTUP_SRCS = ccfg.c EXTERNALDIRS += $(SDK_STARTUP) -ifneq ($(SIMPLELINK_BOARD),CUSTOM) - SDK_BOARDS := $(SDK_SOURCE)/ti/boards - LDSCRIPT = $(SDK_BOARDS)/$(SIMPLELINK_BOARD)/$(SIMPLELINK_BOARD)_NoRTOS.lds -endif ### 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 @@ -28,8 +24,17 @@ CFLAGS += -I$(SDK_DEVICE_SOURCE)/inc CFLAGS += -I$(SDK_KERNEL) CFLAGS += -I$(SDK_KERNEL)/posix +LDFLAGS += --entry resetISR +LDFLAGS += -static +LDFLAGS += --specs=nano.specs + +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 endif @@ -70,6 +75,10 @@ $(OBJECTDIR)/ccfg.o: ccfg.c FORCE | $(OBJECTDIR) $(TRACE_CC) $(Q)$(CC) $(CFLAGS) -include "ccfg-conf.h" -c $< -o $@ +$(OBJECTDIR)/$(SIMPLELINK_BOARD).o: $(SDK_SOURCE)/ti/boards/$(SIMPLELINK_BOARD)/$(SIMPLELINK_BOARD).c + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) -c $< -o $@ + RAM_SIZE = 0x00003E00 FLASH_SIZE = 0x0001E000 STACK_SIZE = 0 diff --git a/arch/platform/simplelink/Makefile.simplelink b/arch/platform/simplelink/Makefile.simplelink index bed4c64a5..1aa17a307 100644 --- a/arch/platform/simplelink/Makefile.simplelink +++ b/arch/platform/simplelink/Makefile.simplelink @@ -8,7 +8,7 @@ ifndef SIMPLELINK_SDK $(error SIMPLELINK_SDK not defined! You must specify where the SimpleLink SDK resides!) endif -AVAILABLE_BOARDS := $(shell ls $(SIMPLELINK_SDK)/source/ti/boards/) +AVAILABLE_BOARDS := $(shell ls $(SIMPLELINK_SDK)/source/ti/boards) AVAILABLE_BOARDS += CUSTOM # Allows an own board file in the application project ifndef SIMPLELINK_BOARD diff --git a/arch/platform/simplelink/platform.c b/arch/platform/simplelink/platform.c index 8f047463a..0a2fdba5c 100644 --- a/arch/platform/simplelink/platform.c +++ b/arch/platform/simplelink/platform.c @@ -50,6 +50,7 @@ #include #include #include +#include //#include "leds.h" @@ -131,6 +132,8 @@ platform_init_stage_one() { Board_initGeneral(); GPIO_init(); + NoRTOS_start(); + GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON); GPIO_write(Board_GPIO_LED1, Board_GPIO_LED_OFF); // /* Enable flash cache and prefetch. */