Merge branch 'develop' into contrib/stack-guard

This commit is contained in:
Simon Duquennoy 2017-12-05 15:16:54 +01:00 committed by GitHub
commit e795517750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 425 additions and 408 deletions

View File

@ -1,93 +1,33 @@
# Workaround for the issue found in the stable image promoted on Dec 1, 2016. # Setup environment for Docker
# See https://github.com/travis-ci/travis-ci/issues/6928#issuecomment-264227708 language: generic
group: deprecated services: docker
before_install:
- sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
notifications: notifications:
email: false - email: false
language: c #NOTE: this will set CC=gcc which might cause trouble
before_script:
- WGET="travis_retry wget --continue --tries=20 --waitretry=10 --retry-connrefused --no-dns-cache --timeout 300"
- sudo apt-get -qq update
## Support building a binary that is identical to the CI before_install:
- echo -n "Contiki-NG will be compiled with RELSTR=" ; git --git-dir .git describe --tags --always # Environment setup before test script
- export CNG_HOST_PATH=`pwd`
- export DOCKER_IMG='simonduq/contiki-ng:latest'
- sudo chgrp -hR 1000 $CNG_HOST_PATH
- docker pull $DOCKER_IMG
- ant -q -f $CNG_HOST_PATH/tools/cooja/build.xml jar
## Install 32-bit compatibility libraries script: # The test script for each build.
- sudo apt-get -qq install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 - docker run --privileged -v $CNG_HOST_PATH:/home/user/contiki-ng -ti $DOCKER_IMG bash -c "make -C tests/??-$TEST_NAME";
libstdc++5:i386 libstdc++6:i386 lib32z1 # Check outcome of the test
- $CNG_HOST_PATH/tests/check-test.sh $CNG_HOST_PATH/tests/??-$TEST_NAME; exit $?;
## Install doxygen
- if [ ${BUILD_CATEGORY:-0} = doxygen ] ; then
sudo add-apt-repository ppa:libreoffice/ppa -y && sudo apt-get -qq update &&
sudo apt-get --no-install-suggests --no-install-recommends -qq install doxygen &&
doxygen --version ;
fi
## Install msp430 toolchain
- if [ ${BUILD_ARCH:-0} = msp430 ] ; then
$WGET http://simonduq.github.io/resources/mspgcc-4.7.2-compiled.tar.bz2 &&
tar xjf mspgcc*.tar.bz2 -C /tmp/ &&
sudo cp -f -r /tmp/msp430/* /usr/local/ &&
rm -rf /tmp/msp430 mspgcc*.tar.bz2 &&
msp430-gcc --version ;
fi
## Install mainline ARM toolchain, srecord and nRF52 SDK
- if [ ${BUILD_ARCH:-0} = arm-aapcs ] ; then
sudo apt-get -qq install srecord &&
$WGET https://launchpad.net/gcc-arm-embedded/5.0/5-2015-q4-major/+download/gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2 &&
tar xjf gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2 -C /tmp/ &&
sudo cp -f -r /tmp/gcc-arm-none-eabi-5_2-2015q4/* /usr/local/ &&
rm -rf /tmp/gcc-arm-none-eabi-* gcc-arm-none-eabi-*-linux.tar.bz2 &&
arm-none-eabi-gcc --version &&
$WGET https://developer.nordicsemi.com/nRF5_IoT_SDK/nRF5_IoT_SDK_v0.9.x/nrf5_iot_sdk_3288530.zip &&
mkdir /tmp/nrf52-sdk &&
unzip nrf5_iot_sdk_3288530.zip -d /tmp/nrf52-sdk &&
export NRF52_SDK_ROOT=/tmp/nrf52-sdk ;
fi
## Install NXP toolchain
- if [ ${BUILD_ARCH:-0} = jn516x ] ; then
$WGET http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part1.tar.bz2 &&
$WGET http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part2.tar.bz2 &&
$WGET http://simonduq.github.io/resources/jn516x-sdk-4163-1416.tar.bz2 &&
mkdir /tmp/jn516x-sdk /tmp/ba-elf-gcc &&
tar xjf jn516x-sdk-*.tar.bz2 -C /tmp/jn516x-sdk &&
tar xjf ba-elf-gcc-*part1.tar.bz2 -C /tmp/ba-elf-gcc &&
tar xjf ba-elf-gcc-*part2.tar.bz2 -C /tmp/ba-elf-gcc &&
sudo cp -f -r /tmp/jn516x-sdk /usr/ &&
sudo cp -f -r /tmp/ba-elf-gcc /usr/ &&
export PATH=/usr/ba-elf-gcc/bin:$PATH &&
rm -rf /tmp/ba-elf-gcc* /tmp/jn516x-sdk* &&
ba-elf-gcc --version ;
fi
## Compile cooja.jar only when it's going to be needed
- if [ ${BUILD_CATEGORY:-0} = sim ] ; then
java -version &&
ant -q -f tools/cooja/build.xml jar &&
sudo java -Xshare:dump -version ;
fi
script:
## tests/Makefile handles most of generic logic
- "make -C tests/??-$BUILD_TYPE"
- "tests/check-test.sh tests/??-$BUILD_TYPE; exit $?"
env: env:
## This magically kick-off parallel jobs for each of the for the sets # Parallel builds
## of environment variable defined below - TEST_NAME='compile-base'
- BUILD_TYPE='compile-base' BUILD_CATEGORY='compile' BUILD_ARCH='msp430' - TEST_NAME='compile-arm-ports-01'
- BUILD_TYPE='compile-arm-ports-01' BUILD_CATEGORY='compile' BUILD_ARCH='arm-aapcs' - TEST_NAME='compile-arm-ports-02'
- BUILD_TYPE='compile-arm-ports-02' BUILD_CATEGORY='compile' BUILD_ARCH='arm-aapcs' - TEST_NAME='rpl-lite'
- BUILD_TYPE='compile-nxp-ports' BUILD_CATEGORY='compile' BUILD_ARCH='jn516x' - TEST_NAME='rpl-classic'
- BUILD_TYPE='compile-tools' BUILD_CATEGORY='compile' - TEST_NAME='tun-rpl-br'
- BUILD_TYPE='rpl-lite' BUILD_CATEGORY='sim' - TEST_NAME='simulation-base'
- BUILD_TYPE='rpl-classic' BUILD_CATEGORY='sim' - TEST_NAME='ieee802154'
- BUILD_TYPE='tun-rpl-br' BUILD_CATEGORY='sim' BUILD_ARCH='msp430' - TEST_NAME='compile-nxp-ports'
- BUILD_TYPE='simulation-base' BUILD_CATEGORY='sim' BUILD_ARCH='msp430' - TEST_NAME='doxygen'
- BUILD_TYPE='ieee802154' BUILD_CATEGORY='sim' - TEST_NAME='compile-tools'
- BUILD_TYPE='doxygen' BUILD_CATEGORY='doxygen'

54
arch/cpu/arm/Makefile.arm Normal file
View File

@ -0,0 +1,54 @@
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
SREC_CAT = srec_cat
CFLAGS += -mthumb -mabi=aapcs -mlittle-endian
CFLAGS += -Werror -Wall
CFLAGS += -std=c99
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fshort-enums -fomit-frame-pointer -fno-builtin
LDFLAGS += -mthumb -mlittle-endian
OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb
### Are we building with code size optimisations?
SMALL ?= 1
ifeq ($(SMALL),1)
CFLAGS += -Os
else
CFLAGS += -O2
endif
### Use CMSIS and the existing dbg-io from arch/cpu/arm/common
CONTIKI_ARM_DIRS += . common/dbg-io
CONTIKI_CPU_DIRS += $(addprefix ../arm/, $(CONTIKI_ARM_DIRS))
### CPU-dependent cleanup files
CLEAN += *.d *.elf *.hex
### Don't treat the following files as intermediate
.PRECIOUS: %.elf %.hex %.bin
%.i16hex: %.elf
$(OBJCOPY) -O ihex $< $@
%.hex: %.i16hex
$(SREC_CAT) $< -intel -o $@ -intel
%.bin: %.elf
$(OBJCOPY) -O binary $(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 $< $@

View File

@ -1,19 +0,0 @@
/**
* \defgroup cmsis CMSIS (Cortex Microcontroller Software Interface Standard)
* \ingroup arm
*/
/**
* \defgroup aducrf101 ADUCRF101
* \ingroup arm
*/
/**
* \defgroup at91sam7s AT91SAM7S
* \ingroup arm
*/
/**
* \defgroup stm32f103 STM32F103
* \ingroup arm
*/

View File

@ -66,7 +66,7 @@
* CMSIS definitions * CMSIS definitions
******************************************************************************/ ******************************************************************************/
/** /**
\ingroup Cortex-M0+ \ingroup Cortex_M0_plus
@{ @{
*/ */

View File

@ -1,3 +1,8 @@
/**
* \defgroup cmsis CMSIS (Cortex Microcontroller Software Interface Standard)
* \ingroup arm
*/
/** /**
* \addtogroup CMSIS_Core_FunctionInterface * \addtogroup CMSIS_Core_FunctionInterface
* \ingroup cmsis * \ingroup cmsis
@ -39,7 +44,7 @@
*/ */
/** /**
* \defgroup Cortex-M0+ Cortex-M0+ * \defgroup Cortex_M0_plus Cortex-M0+
* \ingroup cmsis * \ingroup cmsis
*/ */

View File

@ -0,0 +1,3 @@
CONTIKI_ARM_DIRS += cortex-m cortex-m/CMSIS
include $(CONTIKI)/arch/cpu/arm/Makefile.arm

View File

@ -0,0 +1,24 @@
CONTIKI_ARM_DIRS += cortex-m/cm3
CFLAGS += -mcpu=cortex-m3
LDFLAGS += -mcpu=cortex-m3 -nostartfiles
LDFLAGS += -T $(LDSCRIPT)
LDFLAGS += -Wl,--gc-sections,--sort-section=alignment
LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch
OBJCOPY_FLAGS += --gap-fill 0xff
### Build syscalls for newlib
MODULES += os/lib/newlib
CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES)}}
### Compilation rules
CUSTOM_RULE_LINK = 1
%.elf: $(CPU_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 $@
include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m

View File

@ -0,0 +1,13 @@
CONTIKI_ARM_DIRS += cortex-m/cm4
CFLAGS += -mcpu=cortex-m4
LDFLAGS += -mcpu=cortex-m4
### Compilation rules
CUSTOM_RULE_LINK=1
%.elf: $(TARGET_STARTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(TARGET_LIBS)
$(TRACE_LD)
$(Q)$(CC) $(LDFLAGS) ${filter %o %.co %.a,$^} -o $@
include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m

View File

@ -0,0 +1,4 @@
/**
* \defgroup arm Support for Arm CPUs
* \ingroup cpu
*/

View File

@ -1,52 +1,17 @@
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
ifndef SOURCE_LDSCRIPT ifndef SOURCE_LDSCRIPT
SOURCE_LDSCRIPT = $(CONTIKI_CPU)/cc2538.lds SOURCE_LDSCRIPT = $(CONTIKI_CPU)/cc2538.lds
endif endif
LDSCRIPT = $(OBJECTDIR)/cc2538.ld LDSCRIPT = $(OBJECTDIR)/cc2538.ld
CFLAGS += -mcpu=cortex-m3 -mthumb -mlittle-endian CFLAGS += -DCMSIS_DEV_HDR=\"cc2538_cm3.h\"
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -fshort-enums -fomit-frame-pointer -fno-strict-aliasing
CFLAGS += -Wall -DCMSIS_DEV_HDR=\"cc2538_cm3.h\"
LDFLAGS += -mcpu=cortex-m3 -mthumb -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
ifeq ($(WERROR),1)
CFLAGS += -Werror
endif
### Are we building with code size optimisations?
SMALL ?= 1
ifeq ($(SMALL),1)
CFLAGS += -Os
else
CFLAGS += -O2
endif
### If the user-specified a Node ID, pass a define ### If the user-specified a Node ID, pass a define
ifdef NODEID ifdef NODEID
CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID) CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID)
endif endif
### CPU-dependent cleanup files
CLEAN += *.d *.elf *.hex
### CPU-dependent directories ### CPU-dependent directories
CONTIKI_CPU_DIRS = ../arm/common/CMSIS . dev usb usb/common usb/common/cdc-acm CONTIKI_CPU_DIRS = . dev usb usb/common usb/common/cdc-acm
### Use the existing debug I/O in arch/cpu/arm/common
CONTIKI_CPU_DIRS += ../arm/common/dbg-io
### CPU-dependent source files ### CPU-dependent source files
CONTIKI_CPU_SOURCEFILES += soc.c clock.c rtimer-arch.c uart.c watchdog.c CONTIKI_CPU_SOURCEFILES += soc.c clock.c rtimer-arch.c uart.c watchdog.c
@ -66,23 +31,13 @@ DEBUG_IO_SOURCEFILES += dbg-printf.c dbg-snprintf.c dbg-sprintf.c strformat.c
USB_SOURCEFILES += usb-core.c cdc-acm.c usb-arch.c usb-serial.c cdc-acm-descriptors.c USB_SOURCEFILES += usb-core.c cdc-acm.c usb-arch.c usb-serial.c cdc-acm-descriptors.c
ifneq ($(TARGET_START_SOURCEFILES),) CPU_START_SOURCEFILES = startup-gcc.c
CPU_START_SOURCEFILES = TARGET_START_SOURCEFILES
else
CPU_START_SOURCEFILES = startup-gcc.c
endif
CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES)}}
CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES) CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES)
CONTIKI_SOURCEFILES += $(USB_SOURCEFILES) CONTIKI_SOURCEFILES += $(USB_SOURCEFILES)
MODULES += os/lib/newlib
.SECONDEXPANSION: .SECONDEXPANSION:
### 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 ### Always re-build ieee-addr.o in case the command line passes a new NODEID
FORCE: FORCE:
@ -90,27 +45,6 @@ $(OBJECTDIR)/ieee-addr.o: ieee-addr.c FORCE | $(OBJECTDIR)
$(TRACE_CC) $(TRACE_CC)
$(Q)$(CC) $(CFLAGS) -c $< -o $@ $(Q)$(CC) $(CFLAGS) -c $< -o $@
### Compilation rules
CUSTOM_RULE_LINK=1
%.elf: $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(LDSCRIPT)
$(TRACE_LD)
$(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -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 $< $@
### This rule is used to generate the correct linker script ### This rule is used to generate the correct linker script
LDGENFLAGS += $(CFLAGS) LDGENFLAGS += $(CFLAGS)
LDGENFLAGS += -imacros "contiki-conf.h" -imacros "dev/cc2538-dev.h" LDGENFLAGS += -imacros "contiki-conf.h" -imacros "dev/cc2538-dev.h"
@ -121,3 +55,5 @@ LDGENFLAGS += -x c -P -E
$(LDSCRIPT): $(SOURCE_LDSCRIPT) FORCE | $(OBJECTDIR) $(LDSCRIPT): $(SOURCE_LDSCRIPT) FORCE | $(OBJECTDIR)
$(TRACE_CC) $(TRACE_CC)
$(Q)$(CC) $(LDGENFLAGS) $< | grep -v '^\s*#\s*pragma\>' > $@ $(Q)$(CC) $(LDGENFLAGS) $< | grep -v '^\s*#\s*pragma\>' > $@
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3

View File

@ -29,16 +29,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/** /**
* \addtogroup platform * \addtogroup cc2538
* @{
*
* \defgroup cc2538-platforms TI cc2538-powered platforms
*
* Documentation for all platforms powered by the TI cc2538 System-on-Chip
* @{
*
* \defgroup cc2538 The TI cc2538 System-on-Chip
* CPU-Specific functionality - available to all cc2538-based platforms
* @{ * @{
* *
* \defgroup cc2538-cpu cc2538 CPU * \defgroup cc2538-cpu cc2538 CPU
@ -65,8 +56,6 @@
#endif /* CPU_H_ */ #endif /* CPU_H_ */
/** /**
* @}
* @}
* @} * @}
* @} * @}
*/ */

View File

@ -0,0 +1,14 @@
/**
* \defgroup cc2538 The TI CC2538 System-on-Chip
*
* CPU-Specific functionality - available to all cc2538-based platforms
*
* \ingroup cpu
*/
/**
* \defgroup cc2538-platforms TI CC2538-powered platforms
*
* Documentation for all platforms powered by the TI cc2538 System-on-Chip
* \ingroup platform
*/

View File

@ -61,7 +61,7 @@
#define DEEP_SLEEP_PM1_THRESHOLD 10 #define DEEP_SLEEP_PM1_THRESHOLD 10
#define DEEP_SLEEP_PM2_THRESHOLD 100 #define DEEP_SLEEP_PM2_THRESHOLD 100
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#define assert_wfi() do { asm("wfi"::); } while(0) #define assert_wfi() do { __asm("wfi"::); } while(0)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if LPM_CONF_STATS #if LPM_CONF_STATS
rtimer_clock_t lpm_stats[3]; rtimer_clock_t lpm_stats[3];

View File

@ -1,13 +1,3 @@
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
SREC_CAT = srec_cat
CPU_ABS_PATH = arch/cpu/cc26xx-cc13xx CPU_ABS_PATH = arch/cpu/cc26xx-cc13xx
TI_XXWARE = $(CONTIKI_CPU)/$(TI_XXWARE_PATH) TI_XXWARE = $(CONTIKI_CPU)/$(TI_XXWARE_PATH)
@ -29,44 +19,14 @@ MODULES += $(TI_XXWARE_SRC)
LDSCRIPT = $(CONTIKI_CPU)/cc26xx.ld 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 -DCMSIS_DEV_HDR=\"cc13x0-cc26x0-cm3.h\"
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
ifeq ($(WERROR),1)
CFLAGS += -Werror
endif
### Are we building with code size optimisations?
SMALL ?= 1
ifeq ($(SMALL),1)
CFLAGS += -Os
else
CFLAGS += -O2
endif
### If the user-specified a Node ID, pass a define ### If the user-specified a Node ID, pass a define
ifdef NODEID ifdef NODEID
CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID) CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID)
endif endif
### CPU-dependent cleanup files
CLEAN += *.d *.elf *.hex
### CPU-dependent directories ### CPU-dependent directories
CONTIKI_CPU_DIRS += . dev rf-core rf-core/api $(TI_XXWARE_STARTUP_DIR) CONTIKI_CPU_DIRS += . dev rf-core rf-core/api $(TI_XXWARE_STARTUP_DIR)
### Use CMSIS and the existing debug I/O in arch/cpu/arm/common
CONTIKI_CPU_DIRS += ../arm/common/dbg-io ../arm/common/CMSIS
### CPU-dependent source files ### CPU-dependent source files
CONTIKI_CPU_SOURCEFILES += clock.c rtimer-arch.c soc-rtc.c uart.c CONTIKI_CPU_SOURCEFILES += clock.c rtimer-arch.c soc-rtc.c uart.c
CONTIKI_CPU_SOURCEFILES += contiki-watchdog.c aux-ctrl.c CONTIKI_CPU_SOURCEFILES += contiki-watchdog.c aux-ctrl.c
@ -80,8 +40,7 @@ DEBUG_IO_SOURCEFILES += dbg-printf.c dbg-snprintf.c dbg-sprintf.c strformat.c
CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES) CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES)
TARGET_START_SOURCEFILES += fault-handlers.c $(TI_XXWARE_STARTUP_SRCS) CPU_START_SOURCEFILES += fault-handlers.c $(TI_XXWARE_STARTUP_SRCS)
TARGET_STARTFILES = $(addprefix $(OBJECTDIR)/,$(call oname, $(TARGET_START_SOURCEFILES)))
PYTHON = python PYTHON = python
BSL_FLAGS += -e -w -v BSL_FLAGS += -e -w -v
@ -92,9 +51,6 @@ endif
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
### 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 ### Always re-build ieee-addr.o in case the command line passes a new NODEID
FORCE: FORCE:
@ -108,30 +64,6 @@ $(OBJECTDIR)/ccfg.o: ccfg.c FORCE | $(OBJECTDIR)
$(TRACE_CC) $(TRACE_CC)
$(Q)$(CC) $(CFLAGS) -include "ccxxware-conf.h" -c $< -o $@ $(Q)$(CC) $(CFLAGS) -include "ccxxware-conf.h" -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 $@
%.i16hex: %.elf
$(OBJCOPY) -O ihex $< $@
%.hex: %.i16hex
$(SREC_CAT) $< -intel -o $@ -intel
%.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 # 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 # that is statically occupied by the stack as defined in the linker script
# see $(LDSCRIPT) # see $(LDSCRIPT)
@ -170,3 +102,5 @@ UART_BAUDRATE = 115200
login: login:
$(SERIALDUMP) -b$(UART_BAUDRATE) $(PORT) $(SERIALDUMP) -b$(UART_BAUDRATE) $(PORT)
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3

View File

@ -29,22 +29,6 @@
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* \addtogroup platform
* @{
*
* \defgroup cc26xx-platforms TI CC26xx-powered platforms
* @{
*
* \defgroup cc26xx The TI CC26xx and CC13xx CPUs
*
* This group documents the TI CC26xx and CC13xx CPUs. The two CPU families are
* very similar, with the main difference being related to radio capability.
*
* Documentation in this group should be considered to be applicable to both
* families, unless explicitly stated otherwise.
*
* @{
*
* \addtogroup cc26xx-clocks * \addtogroup cc26xx-clocks
* @{ * @{
* *
@ -228,9 +212,6 @@ clock_delay(unsigned int i)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* @}
* @}
* @}
* @} * @}
* @} * @}
*/ */

View File

@ -0,0 +1,16 @@
/**
* \defgroup cc26xx The TI CC13xx and CC26xx Systems-on-Chip
*
* This group documents the TI CC26xx and CC13xx CPUs. The two CPU families are
* very similar, with the main difference being related to radio capability.
*
* Documentation in this group should be considered to be applicable to both
* families, unless explicitly stated otherwise.
*
* \ingroup cpu
*/
/**
* \defgroup cc26xx-platforms TI CC26xx-powered platforms
* \ingroup platform
*/

View File

@ -46,19 +46,6 @@ OBJECT_DIRECTORY = $(OBJECTDIR)
LISTING_DIRECTORY := $(OBJECTDIR) LISTING_DIRECTORY := $(OBJECTDIR)
OUTPUT_BINARY_DIRECTORY := bin_$(TARGET) OUTPUT_BINARY_DIRECTORY := bin_$(TARGET)
MK := mkdir
RM := rm -rf
# Toolchain commands
CC := arm-none-eabi-gcc
AS := arm-none-eabi-as
AR := arm-none-eabi-ar
LD := arm-none-eabi-ld
NM := arm-none-eabi-nm
OBJDUMP := arm-none-eabi-objdump
OBJCOPY := arm-none-eabi-objcopy
SIZE := arm-none-eabi-size
# JLink # JLink
JLINK := $(NRF52_JLINK_PATH)/JLinkExe JLINK := $(NRF52_JLINK_PATH)/JLinkExe
JLINK_OPTS = -Device NRF52 -if swd -speed 1000 JLINK_OPTS = -Device NRF52 -if swd -speed 1000
@ -141,44 +128,24 @@ EXTERNALDIRS += $(addprefix $(NRF52_SDK_ROOT)/, $(INC_PATHS))
# Sorting removes duplicates # Sorting removes duplicates
BUILD_DIRECTORIES := $(sort $(OUTPUT_BINARY_DIRECTORY) $(LISTING_DIRECTORY)) BUILD_DIRECTORIES := $(sort $(OUTPUT_BINARY_DIRECTORY) $(LISTING_DIRECTORY))
# Clean files and directories
CLEAN += bin_$(TARGET) lst_$(TARGET) nrf52832.a *.elf *.hex
#flags common to all targets #flags common to all targets
ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1) ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1)
CFLAGS += -DSOFTDEVICE_PRESENT CFLAGS += -DSOFTDEVICE_PRESENT
CFLAGS += -DS132 CFLAGS += -DS132
endif endif
SMALL ?= 1
ifeq ($(SMALL),1)
CFLAGS += -Os
else
CFLAGS += -O2
endif
CFLAGS += -DNRF52 CFLAGS += -DNRF52
CFLAGS += -DBOARD_$(shell echo $(NRF52_DK_REVISION) | tr a-z A-Z) CFLAGS += -DBOARD_$(shell echo $(NRF52_DK_REVISION) | tr a-z A-Z)
CFLAGS += -D__HEAP_SIZE=512 CFLAGS += -D__HEAP_SIZE=512
CFLAGS += -DSWI_DISABLE0 CFLAGS += -DSWI_DISABLE0
CFLAGS += -DCONFIG_GPIO_AS_PINRESET CFLAGS += -DCONFIG_GPIO_AS_PINRESET
CFLAGS += -DBLE_STACK_SUPPORT_REQD CFLAGS += -DBLE_STACK_SUPPORT_REQD
CFLAGS += -mcpu=cortex-m4
CFLAGS += -mthumb -mabi=aapcs --std=gnu99
CFLAGS += -Wall
ifeq ($(WERROR),1)
CFLAGS += -Werror
endif
CFLAGS += -ggdb CFLAGS += -ggdb
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# keep every function in separate section. This will allow linker to dump unused functions
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin --short-enums
# keep every function in separate section. This will allow linker to dump unused functions # keep every function in separate section. This will allow linker to dump unused functions
LDFLAGS += -Xlinker -Map=$(LISTING_DIRECTORY)/$(OUTPUT_FILENAME).map LDFLAGS += -Xlinker -Map=$(LISTING_DIRECTORY)/$(OUTPUT_FILENAME).map
LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) LDFLAGS += -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT)
LDFLAGS += -mcpu=cortex-m4
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
# let linker to dump unused sections # let linker to dump unused sections
LDFLAGS += -Wl,--gc-sections LDFLAGS += -Wl,--gc-sections
@ -212,41 +179,15 @@ OBJECTS = $(C_OBJECTS) $(ASM_OBJECTS)
TARGET_LIBS= nrf52832.a $(NRF52_SDK_ROOT)/components/iot/ble_6lowpan/lib/ble_6lowpan.a TARGET_LIBS= nrf52832.a $(NRF52_SDK_ROOT)/components/iot/ble_6lowpan/lib/ble_6lowpan.a
### Don't treat the .elf as intermediate
.PRECIOUS: %.hex %.bin
nrf52832.a: $(OBJECTS) nrf52832.a: $(OBJECTS)
$(TRACE_AR) $(TRACE_AR)
$(Q)$(AR) $(AROPTS) $@ $^ $(Q)$(AR) $(AROPTS) $@ $^
### Compilation rules
CUSTOM_RULE_LINK=1
%.elf: $(TARGET_STARTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(TARGET_LIBS)
$(TRACE_LD)
$(Q)$(CC) $(LDFLAGS) ${filter %o %.co %.a,$^} -o $@
# Assemble files # Assemble files
$(OBJECT_DIRECTORY)/%.o: %.s $(OBJECT_DIRECTORY)/%.o: %.s
@echo Compiling file: $(notdir $<) @echo Compiling file: $(notdir $<)
$(Q)$(CC) $(ASMFLAGS) $(addprefix -I$(NRF52_SDK_ROOT)/, $(INC_PATHS)) -c -o $@ $< $(Q)$(CC) $(ASMFLAGS) $(addprefix -I$(NRF52_SDK_ROOT)/, $(INC_PATHS)) -c -o $@ $<
# Create binary file from the .out file
%.bin: %.elf
@echo Preparing: $@
$(Q)$(OBJCOPY) -O binary $^ $@
# Create binary .hex file from the .out file
%.hex: %.elf
@echo Preparing: $@
$(Q)$(OBJCOPY) -O ihex $^ $@
### 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 $*.elf $@
$(Q)$(SIZE) $@
%.jlink: %.jlink:
sed -e 's/#OUTPUT_FILENAME#/$*.hex/' $(CONTIKI_CPU)/flash.jlink > $@ sed -e 's/#OUTPUT_FILENAME#/$*.hex/' $(CONTIKI_CPU)/flash.jlink > $@
@ -265,3 +206,5 @@ erase:
$(JLINK) $(JLINK_OPTS) -CommanderScript $(CONTIKI_CPU)/erase.jlink $(JLINK) $(JLINK_OPTS) -CommanderScript $(CONTIKI_CPU)/erase.jlink
.PHONY: softdevice.jlink .PHONY: softdevice.jlink
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm4/Makefile.cm4

View File

@ -28,13 +28,7 @@
* *
*/ */
/** /**
* \addtogroup dev * \addtogroup nrf52832-ble
* @{
*
* \addtogroup nrf52832
* @{
*
* \addtogroup nrf52832-ble Bluetooth Low Energy drivers
* @{ * @{
* *
* \file * \file
@ -231,8 +225,4 @@ ble_evt_dispatch(ble_evt_t *p_ble_evt)
on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /** @} */
* @}
* @}
* @}
*/

View File

@ -28,13 +28,10 @@
* *
*/ */
/** /**
* \addtogroup dev
* @{
*
* \addtogroup nrf52832 * \addtogroup nrf52832
* @{ * @{
* *
* \addtogroup nrf52832-ble Bluetooth Low Energy drivers * \defgroup nrf52832-ble Bluetooth Low Energy drivers
* @{ * @{
* *
* \file * \file
@ -55,7 +52,6 @@ void ble_get_mac(uint8_t addr[8]);
#endif /* DEV_BLE_H_ */ #endif /* DEV_BLE_H_ */
/** /**
* @}
* @} * @}
* @} * @}
*/ */

View File

@ -0,0 +1,4 @@
/**
* \defgroup nrf52832 nrf52832 SoC
* \ingroup cpu
*/

View File

@ -0,0 +1,2 @@
erase
q

View File

@ -0,0 +1,4 @@
loadfile #OUTPUT_FILENAME#
r
g
q

View File

@ -1,3 +1,34 @@
/*
* Copyright (c) 2012, 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 cc2538dk * \addtogroup cc2538dk
* @{ * @{

View File

@ -83,11 +83,11 @@ fade(unsigned char l)
leds_on(l); leds_on(l);
for(i = 0; i < j; ++i) { for(i = 0; i < j; ++i) {
asm("nop"); __asm("nop");
} }
leds_off(l); leds_off(l);
for(i = 0; i < 400 - j; ++i) { for(i = 0; i < 400 - j; ++i) {
asm("nop"); __asm("nop");
} }
} }
} }

View File

@ -0,0 +1,4 @@
/**
* \defgroup cooja COOJA network simulator node
* \ingroup platform
*/

View File

@ -0,0 +1,4 @@
/**
* \defgroup jn516x The JN516x Board
* \ingroup platform
*/

View File

@ -0,0 +1,4 @@
/**
* \defgroup native_platform Native platform
* \ingroup platform
*/

View File

@ -195,7 +195,7 @@
#if (UART0_ENABLED == 1) #if (UART0_ENABLED == 1)
#define UART0_CONFIG_HWFC NRF_UART_HWFC_DISABLED #define UART0_CONFIG_HWFC NRF_UART_HWFC_DISABLED
#define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED #define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED
#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_38400 #define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_115200
#define UART0_CONFIG_PSEL_TXD 6 #define UART0_CONFIG_PSEL_TXD 6
#define UART0_CONFIG_PSEL_RXD 8 #define UART0_CONFIG_PSEL_RXD 8
#define UART0_CONFIG_PSEL_CTS 7 #define UART0_CONFIG_PSEL_CTS 7

View File

@ -0,0 +1,4 @@
/**
* \defgroup nrf52dk nRF52 Development Kit
* \ingroup platform
*/

View File

@ -40,6 +40,7 @@
* is comercialized by OpenMote Technologies since 2014. It is the first * is comercialized by OpenMote Technologies since 2014. It is the first
* commercial platform based on the powerful TI CC2538 SoC. It uses a * commercial platform based on the powerful TI CC2538 SoC. It uses a
* XBee form-factor to ease prototyping. * XBee form-factor to ease prototyping.
* @{
* *
* \file * \file
* Configuration for the OpenMote-CC2538 platform * Configuration for the OpenMote-CC2538 platform
@ -412,7 +413,7 @@ typedef uint32_t rtimer_clock_t;
#ifndef CCM_STAR_CONF #ifndef CCM_STAR_CONF
#define CCM_STAR_CONF cc2538_ccm_star_driver /**< AES-CCM* driver */ #define CCM_STAR_CONF cc2538_ccm_star_driver /**< AES-CCM* driver */
#endif #endif
/** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#endif /* CONTIKI_CONF_H_ */ #endif /* CONTIKI_CONF_H_ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View File

@ -32,7 +32,7 @@
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* \addtogroup platform * \addtogroup cc2538-platforms
* @{ * @{
* *
* \defgroup openmote-cc2538 OpenMote-CC2538 platform * \defgroup openmote-cc2538 OpenMote-CC2538 platform
@ -91,11 +91,11 @@ fade(unsigned char l)
leds_on(l); leds_on(l);
for(i = 0; i < j; ++i) { for(i = 0; i < j; ++i) {
asm("nop"); __asm("nop");
} }
leds_off(l); leds_off(l);
for(i = 0; i < 400 - j; ++i) { for(i = 0; i < 400 - j; ++i) {
asm("nop"); __asm("nop");
} }
} }
} }

View File

@ -29,7 +29,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/** /**
* \addtogroup platform * \addtogroup zoul-core
* @{ * @{
* *
* \defgroup zoul-platforms Zolertia Zoul platforms * \defgroup zoul-platforms Zolertia Zoul platforms

View File

@ -0,0 +1,4 @@
/**
* \defgroup zoul-core Zolertia Zoul-based platforms
* \ingroup cc2538-platforms
*/

View File

@ -30,7 +30,7 @@
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
/** /**
* \addtogroup platform * \addtogroup zoul-core
* @{ * @{
* *
* \defgroup zoul Zolertia Zoul core module * \defgroup zoul Zolertia Zoul core module
@ -90,11 +90,11 @@ fade(unsigned char l)
leds_on(l); leds_on(l);
for(i = 0; i < j; ++i) { for(i = 0; i < j; ++i) {
asm("nop"); __asm("nop");
} }
leds_off(l); leds_off(l);
for(i = 0; i < 400 - j; ++i) { for(i = 0; i < 400 - j; ++i) {
asm("nop"); __asm("nop");
} }
} }
} }

View File

@ -2,7 +2,8 @@ sensniff Contiki Project
======================== ========================
This example can be used to create an IEEE 802.15.4 wireless sniffer firmware, This example can be used to create an IEEE 802.15.4 wireless sniffer firmware,
meant to be used in parallel with meant to be used in parallel with
[sensniff](https://github.com/g-oikonomou/sensniff). [sensniff](https://github.com/g-oikonomou/sensniff). Sensniff is distributed
standalone, but also as part of Contiki-NG under `tools/sensniff`.
Running Running
======= =======

View File

@ -544,8 +544,6 @@ coap_parse_message(void *packet, uint8_t *data, uint16_t data_len)
return BAD_REQUEST_4_00; return BAD_REQUEST_4_00;
} }
option_number += option_delta;
PRINTF("OPTION %u (delta %u, len %zu): ", option_number, option_delta, PRINTF("OPTION %u (delta %u, len %zu): ", option_number, option_delta,
option_length); option_length);

View File

@ -81,6 +81,22 @@
#define LOG_OUTPUT(...) printf(__VA_ARGS__) #define LOG_OUTPUT(...) printf(__VA_ARGS__)
#endif /* LOG_CONF_OUTPUT */ #endif /* LOG_CONF_OUTPUT */
/*
* Custom output function to prefix logs with level and module.
*
* This will only be called when LOG_CONF_WITH_MODULE_PREFIX is enabled and
* all implementations should be based on LOG_OUTPUT.
*
* \param level The log level
* \param levelstr The log level as string
* \param module The module string descriptor
*/
#ifdef LOG_CONF_OUTPUT_PREFIX
#define LOG_OUTPUT_PREFIX(level, levelstr, module) LOG_CONF_OUTPUT_PREFIX(level, levelstr, module)
#else /* LOG_CONF_OUTPUT_PREFIX */
#define LOG_OUTPUT_PREFIX(level, levelstr, module) LOG_OUTPUT("[%-4s: %-10s] ", levelstr, module)
#endif /* LOG_CONF_OUTPUT_PREFIX */
/******************************************************************************/ /******************************************************************************/
/********************* A list of currently supported modules ******************/ /********************* A list of currently supported modules ******************/
/******************************************************************************/ /******************************************************************************/

View File

@ -101,7 +101,7 @@ extern struct log_module all_modules[];
if(level <= (LOG_LEVEL)) { \ if(level <= (LOG_LEVEL)) { \
if(newline) { \ if(newline) { \
if(LOG_WITH_MODULE_PREFIX) { \ if(LOG_WITH_MODULE_PREFIX) { \
LOG_OUTPUT("[%-4s: %-10s] ", levelstr, LOG_MODULE); \ LOG_OUTPUT_PREFIX(level, levelstr, LOG_MODULE); \
} \ } \
if(LOG_WITH_LOC) { \ if(LOG_WITH_LOC) { \
LOG_OUTPUT("[%s: %d] ", __FILE__, __LINE__); \ LOG_OUTPUT("[%s: %d] ", __FILE__, __LINE__); \

View File

@ -0,0 +1,62 @@
#!/bin/bash
# Contiki directory
CONTIKI=$1
# Test basename
BASENAME=06-native-coap
IPADDR=fd00::302:304:506:708
declare -i OKCOUNT=0
declare -i TESTCOUNT=0
echo "Enabling IPv6"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Starting Contiki-NG native node
echo "Starting native CoAP server"
make -C $CONTIKI/examples/coap > make.log 2> make.err
sudo $CONTIKI/examples/coap/coap-example-server.native > node.log 2> node.err &
CPID=$!
sleep 2
# Send CoAP requests
echo "Sending CoAP requests"
rm -f $BASENAME.log
for TARGET in .well-known/core test/push; do
echo "Get $TARGET" | tee -a $BASENAME.log
coap get coap://[$IPADDR]/$TARGET 2>&1 | tee coap.log
cat coap.log >> $BASENAME.log
# Fetch coap status code (not $? because this is piped)
SUCCESS=`grep -c '(2.05)' coap.log`
if [ $SUCCESS == 1 ]; then
printf "> OK\n"
OKCOUNT+=1
else
printf "> FAIL\n"
fi
TESTCOUNT+=1
done
echo "Closing native node"
sleep 2
pgrep hello-world | sudo xargs kill -9
if [ $TESTCOUNT -eq $OKCOUNT ] ; then
printf "%-40s TEST OK %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" > $BASENAME.testlog;
else
echo "==== make.log ====" ; cat make.log;
echo "==== make.err ====" ; cat make.err;
echo "==== node.log ====" ; cat node.log;
echo "==== node.err ====" ; cat node.err;
echo "==== $BASENAME.log ====" ; cat $BASENAME.log;
printf "%-32s TEST FAIL %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" > $BASENAME.testlog;
fi
rm -f make.log make.err node.log node.err coap.log
# We do not want Make to stop -> Return 0
# The Makefile will check if a log contains FAIL at the end
exit 0

90
tools/docker/Dockerfile Normal file
View File

@ -0,0 +1,90 @@
FROM 32bit/ubuntu:16.04
# Tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential doxygen git wget unzip python-serial \
default-jdk ant srecord iputils-tracepath && \
apt-get clean
# Install ARM toolchain
RUN wget https://launchpad.net/gcc-arm-embedded/5.0/5-2015-q4-major/+download/gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2 && \
tar xjf gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2 -C /tmp/ && \
cp -f -r /tmp/gcc-arm-none-eabi-5_2-2015q4/* /usr/local/ && \
rm -rf /tmp/gcc-arm-none-eabi-* gcc-arm-none-eabi-*-linux.tar.bz2
# Install msp430 toolchain
RUN wget http://simonduq.github.io/resources/mspgcc-4.7.2-compiled.tar.bz2 && \
tar xjf mspgcc*.tar.bz2 -C /tmp/ && \
cp -f -r /tmp/msp430/* /usr/local/ && \
rm -rf /tmp/msp430 mspgcc*.tar.bz2
# Install NXP toolchain (partial, with binaries excluded. Download from nxp.com)
RUN wget http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part1.tar.bz2 && \
wget http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part2.tar.bz2 && \
wget http://simonduq.github.io/resources/jn516x-sdk-4163-1416.tar.bz2 && \
mkdir /tmp/jn516x-sdk /tmp/ba-elf-gcc && \
tar xjf jn516x-sdk-*.tar.bz2 -C /tmp/jn516x-sdk && \
tar xjf ba-elf-gcc-*part1.tar.bz2 -C /tmp/ba-elf-gcc && \
tar xjf ba-elf-gcc-*part2.tar.bz2 -C /tmp/ba-elf-gcc && \
cp -f -r /tmp/jn516x-sdk /usr/ && \
cp -f -r /tmp/ba-elf-gcc /usr/ && \
rm -rf jn516x*.bz2 ba-elf-gcc*.bz2 /tmp/ba-elf-gcc* /tmp/jn516x-sdk*
ENV PATH="/usr/ba-elf-gcc/bin:${PATH}"
## Install nRF52 SDK
RUN wget https://developer.nordicsemi.com/nRF5_IoT_SDK/nRF5_IoT_SDK_v0.9.x/nrf5_iot_sdk_3288530.zip && \
mkdir /usr/nrf52-sdk && \
unzip nrf5_iot_sdk_3288530.zip -d /usr/nrf52-sdk && \
rm nrf5_iot_sdk_3288530.zip
ENV NRF52_SDK_ROOT /usr/nrf52-sdk
# Create user, enable X forwarding, add to group dialout
# -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix
RUN export uid=1000 gid=1000 && \
mkdir -p /home/user && \
echo "user:x:${uid}:${gid}:user,,,:/home/user:/bin/bash" >> /etc/passwd && \
echo "user:x:${uid}:" >> /etc/group && \
echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers && \
chmod 0440 /etc/sudoers && \
chown ${uid}:${gid} -R /home/user && \
usermod -aG dialout user
# Set user for what comes next
USER user
# Environment variables
ENV JAVA_HOME /usr/lib/jvm/default-java
ENV HOME /home/user
ENV CONTIKI_NG ${HOME}/contiki-ng
ENV COOJA ${CONTIKI_NG}/tools/cooja
ENV PATH="${HOME}:${PATH}"
WORKDIR ${HOME}
# Create Cooja shortcut
RUN echo "#!/bin/bash\nant -Dbasedir=${COOJA} -f ${COOJA}/build.xml run" > ${HOME}/cooja && \
chmod +x ${HOME}/cooja
# Optional: download Contiki-NG and pre-compile Cooja.
# Else, use a Docker bind mount to share the repo with the host.
# Docker run option:
# -v <HOST_CONTIKI_NG_ABS_PATH>:/home/user/contiki-ng
#RUN git clone --recursive https://github.com/contiki-ng/contiki-ng.git ${CONTIKI_NG}
#RUN ant -q -f ${CONTIKI_NG}/tools/cooja/build.xml jar
# Enable IPv6 -- must be done at runtime, not in Dockerfile
#RUN sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# Install coap-cli
RUN sudo apt-get install -y npm \
&& sudo apt-get clean \
&& sudo npm install coap-cli -g \
&& sudo ln -s /usr/bin/nodejs /usr/bin/node
# Working directory
WORKDIR ${CONTIKI_NG}
# Start a bash
CMD bash

View File

@ -8,36 +8,6 @@ CPU, device drivers and platform code
* \ingroup arch * \ingroup arch
*/ */
/**
* \addtogroup cc2538dk The cc2538 Development Kit platform
* \ingroup platform
*/
/**
* \addtogroup cooja COOJA network simulator node
* \ingroup platform
*/
/**
* \addtogroup exp5438 MSP430F5438 Experimenter Board
* \ingroup platform
*/
/**
* \addtogroup jn516x The JN516x Board
* \ingroup platform
*/
/**
* \addtogroup native_platform Native platform
* \ingroup platform
*/
/**
* \addtogroup nrf52dk nRF52 Development Kit
* \ingroup platform
*/
/** /**
\defgroup net IoT networking \defgroup net IoT networking
The communication protocols The communication protocols
@ -89,18 +59,13 @@ Core system components such as processes and timers
*/ */
/** /**
\defgroup dev CPUs and Device driver \defgroup cpu CPUs
\ingroup arch \ingroup arch
*/ */
/** /**
* \defgroup arm ARM CPUs \defgroup dev Device Drivers
* \ingroup dev \ingroup arch
*/
/**
* \addtogroup nrf52832 nrf52832 SoC
* \ingroup dev
*/ */
/** /**