-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #974 from jonnteolsson/cc26xx-contrib
New platform: Texas Instruments CC26xx
- Loading branch information
Showing
114 changed files
with
23,844 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
*.c128 | ||
*.c64 | ||
*.cc2538dk | ||
*.srf06-cc26xx | ||
*.ev-aducrf101mkxz | ||
*.report | ||
summary | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
CC = arm-none-eabi-gcc | ||
CPP = arm-none-eabi-cpp | ||
LD = arm-none-eabi-gcc | ||
AR = arm-none-eabi-ar | ||
OBJCOPY = arm-none-eabi-objcopy | ||
OBJDUMP = arm-none-eabi-objdump | ||
NM = arm-none-eabi-nm | ||
SIZE = arm-none-eabi-size | ||
|
||
### TI CC26xxware out-of-tree | ||
### TI_CC26XXWARE is the home directory of the cc26xxware | ||
### It MUST be provided as a path relative to $(CONTIKI) | ||
### For example, if | ||
### CONTIKI = /home/user/contiki | ||
### and TI_CC26XXWARE is stored in | ||
### /home/user/cc26xxware | ||
### then set | ||
### TI_CC26XXWARE = ../cc26xxware | ||
ifndef TI_CC26XXWARE | ||
$(error TI_CC26XXWARE not defined. Please see the README) | ||
endif | ||
|
||
### cc26xxware sources will be added to the MODULES list | ||
TI_CC26XXWARE_SRC = $(TI_CC26XXWARE)/driverlib | ||
|
||
### The directory with startup sources will be added to the CONTIKI_CPU_DIRS | ||
### and the sources therein are added to the sources list explicitly. They are | ||
### also listed explicitly in the linker command (through TARGET_STARTFILES), | ||
### to make sure they always get linked in the image | ||
TI_CC26XXWARE_STARTUP = ../../$(TI_CC26XXWARE)/startup_files | ||
TI_CC26XXWARE_STARTUP_SRCS = ccfg.c startup_gcc.c | ||
|
||
### MODULES will add some of these to the include pach, but we need to add | ||
### them earlier to prevent filename clashes with Contiki core files | ||
CFLAGS += -I$(CONTIKI)/$(TI_CC26XXWARE) -I$(CONTIKI)/$(TI_CC26XXWARE_SRC) | ||
CFLAGS += -I$(CONTIKI)/$(TI_CC26XXWARE)/inc | ||
MODULES += $(TI_CC26XXWARE_SRC) | ||
|
||
LDSCRIPT = $(CONTIKI_CPU)/cc26xx.ld | ||
|
||
CFLAGS += -mcpu=cortex-m3 -mthumb -mlittle-endian | ||
CFLAGS += -ffunction-sections -fdata-sections | ||
CFLAGS += -fshort-enums -fomit-frame-pointer -fno-strict-aliasing | ||
CFLAGS += -Wall -std=c99 | ||
|
||
### Workaround for driverlib's cpu.h which tests if defined(gcc) | ||
### Delete if it gets fixed or if we stop using the driverlib | ||
CFLAGS += -Dgcc=__GNUC__ | ||
|
||
LDFLAGS += -mcpu=cortex-m3 -mthumb -mlittle-endian -nostartfiles | ||
LDFLAGS += -T $(LDSCRIPT) | ||
LDFLAGS += -Wl,--gc-sections,--sort-section=alignment | ||
LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch | ||
OBJCOPY_FLAGS += -O binary --gap-fill 0xff | ||
OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb | ||
|
||
### Are we building with code size optimisations? | ||
ifeq ($(SMALL),1) | ||
CFLAGS += -Os | ||
else | ||
CFLAGS += -O2 | ||
endif | ||
|
||
### If the user-specified a Node ID, pass a define | ||
ifdef NODEID | ||
CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID) | ||
endif | ||
|
||
### CPU-dependent cleanup files | ||
CLEAN += symbols.c symbols.h *.d *.elf *.hex | ||
|
||
### CPU-dependent directories | ||
CONTIKI_CPU_DIRS = . dev dev/rfc-api $(TI_CC26XXWARE_STARTUP) | ||
|
||
### Use the existing debug I/O in cpu/arm/common | ||
CONTIKI_CPU_DIRS += ../arm/common/dbg-io | ||
|
||
### CPU-dependent source files | ||
CONTIKI_CPU_SOURCEFILES += clock.c rtimer-arch.c cc26xx-rtc.c uart.c | ||
CONTIKI_CPU_SOURCEFILES += cc26xx-rf.c contiki-watchdog.c | ||
CONTIKI_CPU_SOURCEFILES += putchar.c ieee-addr.c batmon-sensor.c | ||
CONTIKI_CPU_SOURCEFILES += slip-arch.c slip.c cc26xx-uart.c lpm.c | ||
CONTIKI_CPU_SOURCEFILES += gpio-interrupt.c | ||
|
||
DEBUG_IO_SOURCEFILES += dbg-printf.c dbg-snprintf.c dbg-sprintf.c strformat.c | ||
|
||
CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES) | ||
|
||
TARGET_START_SOURCEFILES += fault-handlers.c $(TI_CC26XXWARE_STARTUP_SRCS) | ||
TARGET_STARTFILES = $(addprefix $(OBJECTDIR)/,$(call oname, $(TARGET_START_SOURCEFILES))) | ||
|
||
### Don't treat the .elf as intermediate | ||
.PRECIOUS: %.elf %.hex %.bin | ||
|
||
### 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 $@ | ||
|
||
### Compilation rules | ||
CUSTOM_RULE_LINK=1 | ||
|
||
%.elf: $(TARGET_STARTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(LDSCRIPT) | ||
$(TRACE_LD) | ||
$(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -lm -o $@ | ||
|
||
%.hex: %.elf | ||
$(OBJCOPY) -O ihex $< $@ | ||
|
||
%.bin: %.elf | ||
$(OBJCOPY) $(OBJCOPY_FLAGS) $< $@ | ||
|
||
%.lst: %.elf | ||
$(OBJDUMP) $(OBJDUMP_FLAGS) $< > $@ | ||
|
||
### We don't really need the .hex and .bin for the .$(TARGET) but let's make | ||
### sure they get built | ||
%.$(TARGET): %.elf %.hex %.bin | ||
cp $< $@ | ||
|
||
# a target that gives a user-friendly memory profile, taking into account the RAM | ||
# that is statically occupied by the stack as defined in the linker script | ||
# see $(LDSCRIPT) | ||
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;}' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2015, Texas Instruments Incorporated - http://www.ti.com/ | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
* OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
/*---------------------------------------------------------------------------*/ | ||
/** | ||
* \addtogroup cc26xx | ||
* @{ | ||
* | ||
* \defgroup cc26xx-models CC26xx models | ||
* | ||
* The CC26xx comes out in various flavours. Most notable within the context | ||
* of this Contiki port: The CC2630 with IEEE (but no BLE) support and the | ||
* CC2650 with IEEE and BLE support. | ||
* | ||
* This port supports both models and will automatically turn off the BLE code | ||
* if the CC2630 is selected. | ||
* | ||
* @{ | ||
*/ | ||
/** | ||
* \file | ||
* Header file with definitions relating to various CC26xx variants | ||
*/ | ||
/*---------------------------------------------------------------------------*/ | ||
#ifndef CC26XX_MODEL_H_ | ||
#define CC26XX_MODEL_H_ | ||
/*---------------------------------------------------------------------------*/ | ||
#include "contiki-conf.h" | ||
/*---------------------------------------------------------------------------*/ | ||
#ifdef CC26XX_MODEL_CONF_CPU_VARIANT | ||
#define CC26XX_MODEL_CPU_VARIANT CC26XX_MODEL_CONF_CPU_VARIANT | ||
#else | ||
#define CC26XX_MODEL_CPU_VARIANT 2650 | ||
#endif | ||
|
||
#if (CC26XX_MODEL_CPU_VARIANT != 2630) && (CC26XX_MODEL_CPU_VARIANT != 2650) | ||
#error Incorrect CC26xx variant selected. | ||
#error Check the value of CC26XX_MODEL_CONF_CPU_VARIANT | ||
#error Supported values: 2630 and 2650 | ||
#endif | ||
/*---------------------------------------------------------------------------*/ | ||
#endif /* CC26XX_MODEL_H_ */ | ||
/*---------------------------------------------------------------------------*/ | ||
/** | ||
* @} | ||
* @} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright (c) 2014, Texas Instruments Incorporated - http://www.ti.com/ | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* 3. Neither the name of the copyright holder nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
* OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
/* CC26XX linker script */ | ||
|
||
/* Entry Point */ | ||
ENTRY(ResetISR) | ||
|
||
MEMORY | ||
{ | ||
/* Flash Size 128 KB minus the CCA area below (76 bytes) */ | ||
FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x0001FFAC | ||
|
||
/* | ||
* Customer Configuration Area and Bootloader Backdoor configuration | ||
* in flash, up to 80 bytes | ||
*/ | ||
FLASH_CCFG (RX) : ORIGIN = 0x0001FFAC, LENGTH = 84 | ||
|
||
/* RAM Size 20KB (PG2.1) */ | ||
SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00005000 | ||
} | ||
|
||
/*. Highest address of the stack. Used in startup file .*/ | ||
_estack = ORIGIN(SRAM) + LENGTH(SRAM); /* End of SRAM */ | ||
|
||
/*. Generate a link error if heap and stack don’t fit into RAM .*/ | ||
_Min_Heap_Size = 0; | ||
_Min_Stack_Size = 0x100; | ||
|
||
SECTIONS | ||
{ | ||
.text : | ||
{ | ||
_text = .; | ||
KEEP(*(.vectors)) | ||
*(.text*) | ||
*(.rodata*) | ||
_etext = .; | ||
} > FLASH = 0 | ||
|
||
.data : | ||
{ | ||
_data = .; | ||
*(vtable) | ||
*(.data*) | ||
_edata = .; | ||
} > SRAM AT > FLASH | ||
|
||
.ARM.exidx : | ||
{ | ||
*(.ARM.exidx*) | ||
} > FLASH | ||
|
||
.bss : | ||
{ | ||
_bss = .; | ||
*(.bss*) | ||
*(COMMON) | ||
_ebss = .; | ||
} > SRAM | ||
|
||
.ccfg : | ||
{ | ||
KEEP(*(.ccfg)) | ||
} > FLASH_CCFG | ||
|
||
/* User_heap_stack section, used to check that there is enough RAM left */ | ||
._user_heap_stack : | ||
{ | ||
. = ALIGN(4); | ||
. = . + _Min_Heap_Size; | ||
. = . + _Min_Stack_Size; | ||
. = ALIGN(4); | ||
} >SRAM | ||
} |
Oops, something went wrong.