Merge branch 'develop' of github.com:contiki-ng/contiki-ng into feature/ipv6_over_ble
This commit is contained in:
commit
604e846ff1
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@
|
||||
*~
|
||||
obj_*
|
||||
Makefile.target
|
||||
Makefile.*.defines
|
||||
tools/doxygen/html
|
||||
patches-*
|
||||
tools/tunslip
|
||||
|
@ -8,7 +8,7 @@ endif
|
||||
# Setting this option is also important for tests on Cooja motes to check for warnings.
|
||||
WERROR ?= 1
|
||||
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
|
||||
ifeq ($(DEFINES),)
|
||||
-include Makefile.$(TARGET).defines
|
||||
@ -57,7 +57,6 @@ MODULES += os os/net os/net/mac os/storage
|
||||
oname = ${patsubst %.c,%.o,${patsubst %.S,%.o,$(1)}}
|
||||
|
||||
CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFILES)}}
|
||||
|
||||
PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}}
|
||||
|
||||
# Provide way to create $(OBJECTDIR) if it has been removed by make clean
|
||||
@ -169,13 +168,22 @@ else
|
||||
CFLAGS += -DUIP_CONF_IPV6_RPL=0
|
||||
endif
|
||||
|
||||
ifdef MODULES
|
||||
UNIQUEMODULES = $(call uniq,$(MODULES))
|
||||
MODULEDIRS = ${wildcard ${addprefix $(CONTIKI)/, $(UNIQUEMODULES)}}
|
||||
MODULES_SOURCES = ${foreach d, $(MODULEDIRS), ${subst ${d}/,,${wildcard $(d)/*.c}}}
|
||||
MODULES_INCLUDES = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/Makefile.${notdir $(d)}}}
|
||||
include $(MODULES_INCLUDES)
|
||||
CONTIKI_SOURCEFILES += $(MODULES_SOURCES)
|
||||
MODULEDIRS = $(MODULES_REL) ${wildcard ${addprefix $(CONTIKI)/, $(MODULES)}}
|
||||
UNIQUEMODULES = $(call uniq,$(MODULEDIRS))
|
||||
MODULES_SOURCES = ${foreach d, $(MODULEDIRS), ${subst ${d}/,,${wildcard $(d)/*.c}}}
|
||||
CONTIKI_SOURCEFILES += $(MODULES_SOURCES)
|
||||
|
||||
# Include module-specific makefiles
|
||||
MODULES_INCLUDES = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/Makefile.${notdir $(d)}}}
|
||||
include $(MODULES_INCLUDES)
|
||||
# Iterate once more: include the modules added from the previous include.
|
||||
# Only works with one level of nested module inclusion.
|
||||
include $(MODULES_INCLUDES)
|
||||
|
||||
# C-include module-specific macros using -imacros
|
||||
MODULES_IMACROS = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/module-macros.h}}
|
||||
ifneq ($(MODULES_IMACROS),)
|
||||
CFLAGS += ${foreach d, $(MODULES_IMACROS), -imacros $(d)}
|
||||
endif
|
||||
|
||||
### Verbosity control. Use make V=1 to get verbose builds.
|
||||
@ -247,7 +255,6 @@ clean:
|
||||
-rm -f *~ *core core *.srec \
|
||||
*.lst *.map \
|
||||
*.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \
|
||||
*.ce *.co
|
||||
rm -rf $(CLEAN)
|
||||
-rm -rf $(OBJECTDIR)
|
||||
|
||||
@ -256,13 +263,6 @@ distclean: clean
|
||||
|
||||
-include $(CONTIKI)/arch/platform/$(TARGET)/Makefile.customrules-$(TARGET)
|
||||
|
||||
ifndef CUSTOM_RULE_C_TO_CE
|
||||
%.ce: %.c
|
||||
$(TRACE_CC)
|
||||
$(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE -c $< -o $@
|
||||
$(STRIP) --strip-unneeded -g -x $@
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O
|
||||
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
|
||||
$(TRACE_CC)
|
||||
@ -306,12 +306,6 @@ ifndef CUSTOM_RULE_C_TO_E
|
||||
$(Q)$(CC) $(CFLAGS) -E $< -o $@
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_C_TO_CO
|
||||
%.co: %.c
|
||||
$(TRACE_CC)
|
||||
$(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE -c $< -o $@
|
||||
endif
|
||||
|
||||
ifndef AROPTS
|
||||
AROPTS = rcf
|
||||
endif
|
||||
@ -327,7 +321,7 @@ ifndef LD
|
||||
endif
|
||||
|
||||
ifndef CUSTOM_RULE_LINK
|
||||
%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
||||
%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
||||
$(TRACE_LD)
|
||||
$(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \
|
||||
${filter %.a,$^} $(TARGET_LIBFILES) -o $@
|
||||
|
@ -6,7 +6,7 @@ endif
|
||||
|
||||
STRUCTGEN = structgen
|
||||
|
||||
PROJECTDIRS += $(BUILTSRCDIR)
|
||||
MODULES_REL += $(BUILTSRCDIR)
|
||||
|
||||
USB_STRING_DESCRIPTORS ?= $(CONTIKI_CPU_ARM)/common/usb/cdc-acm/string-descriptors.xml
|
||||
|
||||
|
@ -17,7 +17,9 @@ 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)
|
||||
.SECONDEXPANSION:
|
||||
|
||||
%.elf: $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(LDSCRIPT)
|
||||
$(TRACE_LD)
|
||||
$(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -lm -o $@
|
||||
|
||||
|
@ -6,8 +6,8 @@ LDFLAGS += -mcpu=cortex-m4
|
||||
### Compilation rules
|
||||
CUSTOM_RULE_LINK=1
|
||||
|
||||
%.elf: $(TARGET_STARTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(TARGET_LIBS)
|
||||
%.elf: $(TARGET_STARTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(TARGET_LIBS)
|
||||
$(TRACE_LD)
|
||||
$(Q)$(CC) $(LDFLAGS) ${filter %o %.co %.a,$^} -o $@
|
||||
$(Q)$(CC) $(LDFLAGS) ${filter %.o %.a,$^} -o $@
|
||||
|
||||
include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m
|
||||
|
@ -36,8 +36,6 @@ CPU_START_SOURCEFILES = startup-gcc.c
|
||||
CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES)
|
||||
CONTIKI_SOURCEFILES += $(USB_SOURCEFILES)
|
||||
|
||||
.SECONDEXPANSION:
|
||||
|
||||
### Always re-build ieee-addr.o in case the command line passes a new NODEID
|
||||
FORCE:
|
||||
|
||||
|
@ -209,7 +209,7 @@ static const output_config_t output_power[] = {
|
||||
#define OUTPUT_POWER_UNKNOWN 0xFFFF
|
||||
|
||||
/* Default TX Power - position in output_power[] */
|
||||
const output_config_t *tx_power_current = &output_power[0];
|
||||
static const output_config_t *tx_power_current = &output_power[0];
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static volatile int8_t last_rssi = 0;
|
||||
static volatile uint8_t last_corr_lqi = 0;
|
||||
|
@ -203,7 +203,7 @@ extern const prop_mode_tx_power_config_t TX_POWER_DRIVER[];
|
||||
#define OUTPUT_POWER_UNKNOWN 0xFFFF
|
||||
|
||||
/* Default TX Power - position in output_power[] */
|
||||
const prop_mode_tx_power_config_t *tx_power_current = &TX_POWER_DRIVER[1];
|
||||
static const prop_mode_tx_power_config_t *tx_power_current = &TX_POWER_DRIVER[1];
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef PROP_MODE_CONF_LO_DIVIDER
|
||||
#define PROP_MODE_LO_DIVIDER PROP_MODE_CONF_LO_DIVIDER
|
||||
|
@ -108,11 +108,6 @@ ifeq ($(HOST_OS),Windows)
|
||||
@$(FINALIZE_CYGWIN_DEPENDENCY)
|
||||
endif
|
||||
|
||||
CUSTOM_RULE_C_TO_CO = 1
|
||||
%.co: %.c
|
||||
$(TRACE_CC)
|
||||
$(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@
|
||||
|
||||
AROPTS = -o
|
||||
|
||||
else
|
||||
@ -195,10 +190,6 @@ PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(STRIP) --strip-unneeded -g -x $@
|
||||
|
||||
%.cm: %.co
|
||||
$(LD) -i -r --unresolved-symbols=ignore-in-object-files -mmsp430x149 -o $@ $^
|
||||
$(STRIP) --strip-unneeded -g -x $@
|
||||
|
||||
%-stripped.o: %.o
|
||||
$(STRIP) --strip-unneeded -g -x -o $@ $<
|
||||
|
||||
@ -206,7 +197,7 @@ PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
|
||||
mv $< $@
|
||||
|
||||
ifdef IAR
|
||||
%.ihex: %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
||||
%.ihex: %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
||||
$(LD) $(LDFLAGSNO) -Fintel-extended $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@
|
||||
else
|
||||
%.ihex: %.$(TARGET)
|
||||
|
@ -1,9 +1,39 @@
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "dev/uart0.h"
|
||||
|
||||
/* In case of IPv4: putchar() is defined by the SLIP driver */
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define SLIP_END 0300
|
||||
#undef putchar
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
putchar(int c)
|
||||
{
|
||||
#if SLIP_ARCH_CONF_ENABLED
|
||||
static char debug_frame = 0;
|
||||
|
||||
if(!debug_frame) { /* Start of debug output */
|
||||
uart0_writeb(SLIP_END);
|
||||
uart0_writeb('\r'); /* Type debug line == '\r' */
|
||||
debug_frame = 1;
|
||||
}
|
||||
#endif /* SLIP_ARCH_CONF_ENABLED */
|
||||
|
||||
/* Need to also print '\n' because for example COOJA will not show
|
||||
any output before line end */
|
||||
uart0_writeb((char)c);
|
||||
|
||||
#if SLIP_ARCH_CONF_ENABLED
|
||||
/*
|
||||
* Line buffered output, a newline marks the end of debug output and
|
||||
* implicitly flushes debug output.
|
||||
*/
|
||||
if(c == '\n') {
|
||||
uart0_writeb(SLIP_END);
|
||||
debug_frame = 0;
|
||||
}
|
||||
#endif /* SLIP_ARCH_CONF_ENABLED */
|
||||
return c;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -1,9 +1,39 @@
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "dev/uart1.h"
|
||||
|
||||
/* In case of IPv4: putchar() is defined by the SLIP driver */
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define SLIP_END 0300
|
||||
#undef putchar
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
putchar(int c)
|
||||
{
|
||||
#if SLIP_ARCH_CONF_ENABLED
|
||||
static char debug_frame = 0;
|
||||
|
||||
if(!debug_frame) { /* Start of debug output */
|
||||
uart1_writeb(SLIP_END);
|
||||
uart1_writeb('\r'); /* Type debug line == '\r' */
|
||||
debug_frame = 1;
|
||||
}
|
||||
#endif /* SLIP_ARCH_CONF_ENABLED */
|
||||
|
||||
/* Need to also print '\n' because for example COOJA will not show
|
||||
any output before line end */
|
||||
uart1_writeb((char)c);
|
||||
|
||||
#if SLIP_ARCH_CONF_ENABLED
|
||||
/*
|
||||
* Line buffered output, a newline marks the end of debug output and
|
||||
* implicitly flushes debug output.
|
||||
*/
|
||||
if(c == '\n') {
|
||||
uart1_writeb(SLIP_END);
|
||||
debug_frame = 0;
|
||||
}
|
||||
#endif /* SLIP_ARCH_CONF_ENABLED */
|
||||
return c;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -1,30 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Swedish Institute of Computer Science
|
||||
* All rights reserved.
|
||||
* 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 Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef MSP430_CONF_H_
|
||||
@ -42,6 +42,20 @@
|
||||
#else
|
||||
#define MSP430_CPU_SPEED 2457600UL
|
||||
#endif
|
||||
|
||||
#ifndef SLIP_ARCH_CONF_ENABLED
|
||||
/*
|
||||
* Determine whether we need SLIP
|
||||
* This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT
|
||||
* keep using SLIP
|
||||
*/
|
||||
#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT)
|
||||
#define SLIP_ARCH_CONF_ENABLED 1
|
||||
#else
|
||||
#define SLIP_ARCH_CONF_ENABLED 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* MSP430_CONF_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -178,6 +178,8 @@ vpath %.s $(ASM_PATHS)
|
||||
|
||||
OBJECTS = $(C_OBJECTS) $(ASM_OBJECTS)
|
||||
|
||||
CLEAN += nrf52832.a
|
||||
|
||||
TARGET_LIBS= nrf52832.a $(NRF52_SDK_ROOT)/components/iot/ble_6lowpan/lib/ble_6lowpan.a
|
||||
|
||||
nrf52832.a: $(OBJECTS)
|
||||
|
@ -38,7 +38,7 @@ endif ## QUICKSTART
|
||||
MAIN_OBJ = $(OBJECTDIR)/$(LIBNAME).o
|
||||
ARCHIVE = $(OBJECTDIR)/$(LIBNAME).a
|
||||
JNILIB = $(OBJECTDIR)/$(LIBNAME).$(TARGET)
|
||||
CONTIKI_APP_OBJ = $(CONTIKI_APP).co
|
||||
CONTIKI_APP_OBJ = $(CONTIKI_APP).o
|
||||
|
||||
# Modules
|
||||
MODULES += os/net os/net/mac os/net/mac/framer
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "sys/clock.h"
|
||||
#include "sys/etimer.h"
|
||||
#include "sys/cooja_mt.h"
|
||||
#include "sys/autostart.h"
|
||||
#include "sys/log.h"
|
||||
|
||||
#include "lib/random.h"
|
||||
@ -62,6 +61,7 @@
|
||||
#include "dev/vib-sensor.h"
|
||||
|
||||
#include "sys/node-id.h"
|
||||
#include "services/rpl-border-router/rpl-border-router.h"
|
||||
#if BUILD_WITH_ORCHESTRA
|
||||
#include "orchestra.h"
|
||||
#endif /* BUILD_WITH_ORCHESTRA */
|
||||
@ -241,6 +241,9 @@ contiki_init()
|
||||
/* Start serial process */
|
||||
serial_line_init();
|
||||
|
||||
#if BUILD_WITH_RPL_BORDER_ROUTER
|
||||
rpl_border_router_init();
|
||||
#endif /* BUILD_WITH_RPL_BORDER_ROUTER */
|
||||
#if BUILD_WITH_ORCHESTRA
|
||||
orchestra_init();
|
||||
#endif /* BUILD_WITH_ORCHESTRA */
|
||||
|
@ -236,7 +236,7 @@ ABS_APPLIBS = $(addsuffix _$(JENNIC_CHIP_FAMILY).a,$(addprefix $(COMPONENTS_BASE
|
||||
|
||||
ifneq ($(wildcard $(SDK_BASE_DIR)/Components/Library/*),)
|
||||
# The SDK is fully installed, proceed to linking and objcopy to ready-to-upload .jn516x.bin file
|
||||
%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(ABS_APPLIBS)
|
||||
%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(ABS_APPLIBS)
|
||||
echo ${filter %.a,$^}
|
||||
$(Q)$(CC) -Wl,--gc-sections $(LDFLAGS) -T$(LINKCMD) -o $@ -Wl,--start-group \
|
||||
$(patsubst /cygdrive/c/%,c:/%,${filter-out %.a,$^}) \
|
||||
@ -245,7 +245,7 @@ ifneq ($(wildcard $(SDK_BASE_DIR)/Components/Library/*),)
|
||||
$(OBJCOPY) -S -O binary $@ $@.bin
|
||||
else
|
||||
# The SDK does not include libraries, only build objects and libraries, skip linking
|
||||
%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
||||
%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
||||
echo Creating empty $@
|
||||
touch $@
|
||||
endif
|
||||
|
@ -272,9 +272,14 @@ typedef uint32_t clock_time_t;
|
||||
|
||||
/* Set this to zero only if we are using SLIP */
|
||||
#ifndef SLIP_BRIDGE_CONF_NO_PUTCHAR
|
||||
#define SLIP_BRIDGE_CONF_NO_PUTCHAR 1
|
||||
#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT)
|
||||
#define SLIP_BRIDGE_CONF_NO_PUTCHAR 0
|
||||
#else
|
||||
#define SLIP_BRIDGE_CONF_NO_PUTCHAR 1
|
||||
#endif
|
||||
#endif /* SLIP_BRIDGE_CONF_NO_PUTCHAR */
|
||||
|
||||
|
||||
/* Extension of LED definitions from leds.h for various JN516x dev boards
|
||||
JN516x Dongle:
|
||||
LEDS_RED Red LED on dongle
|
||||
|
@ -67,9 +67,11 @@ typedef uint16_t u16_t;
|
||||
typedef uint32_t u32_t;
|
||||
typedef int32_t s32_t;
|
||||
|
||||
typedef unsigned short uip_stats_t;
|
||||
typedef unsigned int uip_stats_t;
|
||||
|
||||
#ifndef UIP_CONF_BYTE_ORDER
|
||||
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
|
||||
|
@ -70,12 +70,44 @@
|
||||
#define LOG_MODULE "Native"
|
||||
#define LOG_LEVEL LOG_LEVEL_MAIN
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \name Native Platform Configuration
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* Defines the maximum number of file descriptors monitored by the platform
|
||||
* main loop.
|
||||
*/
|
||||
#ifdef SELECT_CONF_MAX
|
||||
#define SELECT_MAX SELECT_CONF_MAX
|
||||
#else
|
||||
#define SELECT_MAX 8
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Defines the timeout (in msec) of the select operation if no monitored file
|
||||
* descriptors becomes ready.
|
||||
*/
|
||||
#ifdef SELECT_CONF_TIMEOUT
|
||||
#define SELECT_TIMEOUT SELECT_CONF_TIMEOUT
|
||||
#else
|
||||
#define SELECT_TIMEOUT 1000
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Adds the STDIN file descriptor to the list of monitored file descriptors.
|
||||
*/
|
||||
#ifdef SELECT_CONF_STDIN
|
||||
#define SELECT_STDIN SELECT_CONF_STDIN
|
||||
#else
|
||||
#define SELECT_STDIN 1
|
||||
#endif
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static const struct select_callback *select_callback[SELECT_MAX];
|
||||
static int select_max = 0;
|
||||
|
||||
@ -116,6 +148,7 @@ select_set_callback(int fd, const struct select_callback *callback)
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if SELECT_STDIN
|
||||
static int
|
||||
stdin_set_fd(fd_set *rset, fd_set *wset)
|
||||
{
|
||||
@ -135,6 +168,7 @@ stdin_handle_fd(fd_set *rset, fd_set *wset)
|
||||
const static struct select_callback stdin_fd = {
|
||||
stdin_set_fd, stdin_handle_fd
|
||||
};
|
||||
#endif /* SELECT_STDIN */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
set_lladdr(void)
|
||||
@ -240,7 +274,9 @@ platform_init_stage_three()
|
||||
void
|
||||
platform_main_loop()
|
||||
{
|
||||
#if SELECT_STDIN
|
||||
select_set_callback(STDIN_FILENO, &stdin_fd);
|
||||
#endif /* SELECT_STDIN */
|
||||
while(1) {
|
||||
fd_set fdr;
|
||||
fd_set fdw;
|
||||
@ -252,7 +288,7 @@ platform_main_loop()
|
||||
retval = process_run();
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = retval ? 1 : 1000;
|
||||
tv.tv_usec = retval ? 1 : SELECT_TIMEOUT;
|
||||
|
||||
FD_ZERO(&fdr);
|
||||
FD_ZERO(&fdw);
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include "sys/node-id.h"
|
||||
#include "cfs-coffee-arch.h"
|
||||
#include "cfs/cfs-coffee.h"
|
||||
#include "sys/autostart.h"
|
||||
|
||||
#if DCOSYNCH_CONF_ENABLED
|
||||
static struct timer mgt_timer;
|
||||
|
@ -70,12 +70,12 @@
|
||||
/* Platform-specific define to signify sensor reading failure */
|
||||
#define CC26XX_SENSOR_READING_ERROR 0x80000000
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* board.h assumes that basic configuration is done */
|
||||
#include "board.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Include CPU-related configuration */
|
||||
#include "cc13xx-cc26xx-conf.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* board.h assumes that basic configuration is done */
|
||||
#include "board.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* CONTIKI_CONF_H */
|
||||
|
||||
/** @} */
|
||||
|
@ -3,20 +3,12 @@ all: coap-example-server coap-example-client
|
||||
|
||||
CONTIKI=../..
|
||||
|
||||
# automatically build RESTful resources
|
||||
REST_RESOURCES_DIR = ./resources
|
||||
ifndef TARGET
|
||||
REST_RESOURCES_FILES = $(notdir $(shell find $(REST_RESOURCES_DIR) -name '*.c'))
|
||||
else
|
||||
ifeq ($(TARGET), native)
|
||||
REST_RESOURCES_FILES = $(notdir $(shell find $(REST_RESOURCES_DIR) -name '*.c'))
|
||||
else
|
||||
REST_RESOURCES_FILES = $(notdir $(shell find $(REST_RESOURCES_DIR) -name '*.c' ! -name 'res-plugtest*'))
|
||||
# build RESTful resources
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
ifeq ($(TARGET),native)
|
||||
MODULES_REL += ./resources-plugtest
|
||||
endif
|
||||
endif
|
||||
|
||||
PROJECTDIRS += $(REST_RESOURCES_DIR)
|
||||
PROJECT_SOURCEFILES += $(REST_RESOURCES_FILES)
|
||||
MODULES_REL += ./resources
|
||||
|
||||
# Include the CoAP implementation
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
@ -1,12 +1,6 @@
|
||||
all: cc26xx-web-demo
|
||||
|
||||
REST_RESOURCES_DIR = ./resources
|
||||
|
||||
REST_RESOURCES_FILES += res-leds.c res-toggle-leds.c res-device.c
|
||||
REST_RESOURCES_FILES += res-sensors.c res-ble-advd.c res-net.c
|
||||
|
||||
PROJECTDIRS += $(REST_RESOURCES_DIR)
|
||||
PROJECT_SOURCEFILES += $(REST_RESOURCES_FILES)
|
||||
MODULES_REL += ./resources
|
||||
|
||||
PROJECT_SOURCEFILES += cetic-6lbr-client.c coap-server.c net-uart.c mqtt-client.c
|
||||
PROJECT_SOURCEFILES += httpd-simple.c
|
||||
|
@ -8,8 +8,7 @@ CONTIKI=../../../../..
|
||||
|
||||
MAKE_MAC = MAKE_MAC_TSCH
|
||||
MODULES += os/lib/json
|
||||
PROJECTDIRS += .. ../tools
|
||||
PROJECT_SOURCEFILES += rpl-tools.c
|
||||
MODULES_REL += .. ../tools
|
||||
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
||||
|
@ -8,8 +8,7 @@ CONTIKI=../../../../..
|
||||
|
||||
MAKE_MAC = MAKE_MAC_TSCH
|
||||
MODULES += os/lib/json
|
||||
PROJECTDIRS += .. ../tools
|
||||
PROJECT_SOURCEFILES += rpl-tools.c
|
||||
MODULES_REL += .. ../tools
|
||||
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
||||
|
@ -8,8 +8,7 @@ CONTIKI=../../../../..
|
||||
|
||||
MAKE_MAC = MAKE_MAC_TSCH
|
||||
MODULES += os/lib/json
|
||||
PROJECTDIRS += .. ../tools
|
||||
PROJECT_SOURCEFILES += rpl-tools.c
|
||||
MODULES_REL += .. ../tools
|
||||
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
||||
|
@ -6,7 +6,6 @@ TARGET ?= jn516x
|
||||
CONTIKI=../../../../..
|
||||
|
||||
MAKE_MAC = MAKE_MAC_TSCH
|
||||
PROJECTDIRS += .. ../tools
|
||||
PROJECT_SOURCEFILES += rpl-tools.c
|
||||
MODULES_REL += .. ../tools
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
@ -5,8 +5,7 @@ JN516x_WITH_DONGLE = 1
|
||||
|
||||
CONTIKI=../../../../../..
|
||||
|
||||
PROJECTDIRS += .. ../../tools
|
||||
PROJECT_SOURCEFILES += rpl-tools.c
|
||||
MODULES_REL += .. ../../tools
|
||||
MAKE_MAC = MAKE_MAC_TSCH
|
||||
MODULES += os/net/app-layer/coap
|
||||
MODULES += os/services/orchestra os/lib/json
|
||||
|
@ -5,8 +5,7 @@ JN516x_WITH_DONGLE = 1
|
||||
|
||||
CONTIKI=../../../../../..
|
||||
|
||||
PROJECTDIRS += .. ../../tools
|
||||
PROJECT_SOURCEFILES += rpl-tools.c
|
||||
MODULES_REL += .. ../../tools
|
||||
|
||||
MAKE_MAC = MAKE_MAC_TSCH
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
@ -7,8 +7,7 @@ CONTIKI=../../../../../..
|
||||
|
||||
PROJECT_SOURCEFILES += slip-bridge.c slip.c
|
||||
|
||||
PROJECTDIRS += .. ../../tools
|
||||
PROJECT_SOURCEFILES += rpl-tools.c
|
||||
MODULES_REL += .. ../../tools
|
||||
|
||||
MAKE_MAC = MAKE_MAC_TSCH
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
@ -6,8 +6,7 @@ TARGET_WITH_UART1 = 1
|
||||
|
||||
CONTIKI=../../../../..
|
||||
|
||||
PROJECTDIRS += .. ../tools
|
||||
PROJECT_SOURCEFILES += rpl-tools.c
|
||||
MODULES_REL += .. ../tools
|
||||
|
||||
MAKE_MAC = MAKE_MAC_TSCH
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
@ -16,11 +16,7 @@ CFLAGS += -DDEVICE_NAME=\"nRF52-DK-CoAP-Server\"
|
||||
endif
|
||||
|
||||
# automatically build RESTful resources
|
||||
REST_RESOURCES_DIR = ./resources
|
||||
REST_RESOURCES_FILES = $(notdir $(shell find $(REST_RESOURCES_DIR) -name '*.c' ! -name 'res-plugtest*'))
|
||||
|
||||
PROJECTDIRS += $(REST_RESOURCES_DIR)
|
||||
PROJECT_SOURCEFILES += $(REST_RESOURCES_FILES)
|
||||
MODULES_REL += ./resources
|
||||
|
||||
# REST Engine shall use Erbium CoAP implementation
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
@ -1,21 +1,13 @@
|
||||
PROJECTDIRS += common
|
||||
PREFIX ?= fd00::1/64
|
||||
CONTIKI_PROJECT = border-router
|
||||
all: $(CONTIKI_PROJECT)
|
||||
CONTIKI = ../..
|
||||
|
||||
-include $(CONTIKI)/Makefile.identify-target
|
||||
|
||||
all: border-router.$(TARGET)
|
||||
|
||||
ifeq ($(TARGET),native)
|
||||
SOURCES_DIR = native
|
||||
else
|
||||
SOURCES_DIR = embedded
|
||||
endif
|
||||
|
||||
include $(SOURCES_DIR)/Makefile
|
||||
|
||||
PROJECTDIRS += $(SOURCES_DIR)
|
||||
PROJECT_SOURCEFILES += httpd-simple.c webserver.c border-router-common.c
|
||||
CFLAGS += -DPROJECT_CONF_PATH=\"$(SOURCES_DIR)/project-conf.h\"
|
||||
# Include RPL BR module
|
||||
MODULES += os/services/rpl-border-router
|
||||
# Include webserver module
|
||||
MODULES_REL += webserver
|
||||
# Include optional target-specific module
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
MODULES_REL += $(TARGET)
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
@ -32,11 +32,26 @@
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
PROCESS_NAME(border_router_process);
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "RPL BR"
|
||||
#define LOG_LEVEL LOG_LEVEL_INFO
|
||||
|
||||
/* Declare and auto-start this file's process */
|
||||
PROCESS(contiki_ng_br, "Contiki-NG Border Router");
|
||||
AUTOSTART_PROCESSES(&contiki_ng_br);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(contiki_ng_br, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
#if BORDER_ROUTER_CONF_WEBSERVER
|
||||
PROCESS_NAME(webserver_nogui_process);
|
||||
AUTOSTART_PROCESSES(&border_router_process, &webserver_nogui_process);
|
||||
#else /* BORDER_ROUTER_CONF_WEBSERVER */
|
||||
AUTOSTART_PROCESSES(&border_router_process);
|
||||
PROCESS_NAME(webserver_nogui_process);
|
||||
process_start(&webserver_nogui_process, NULL);
|
||||
#endif /* BORDER_ROUTER_CONF_WEBSERVER */
|
||||
|
||||
LOG_INFO("Contiki-NG Border Router started\n");
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
### Optionally, the target can add its own Makefile, to do things like e.g.
|
||||
### add more source files to the build or define make variables.
|
||||
-include $(SOURCES_DIR)/$(TARGET)/Makefile.$(TARGET)
|
||||
|
||||
PROJECTDIRS += $(SOURCES_DIR)/$(TARGET)
|
||||
|
||||
PROJECT_SOURCEFILES += slip-bridge.c border-router-embedded.c
|
||||
|
||||
$(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c
|
||||
(cd $(CONTIKI)/tools && $(MAKE) tunslip6)
|
||||
|
||||
connect-router: $(CONTIKI)/tools/tunslip6
|
||||
sudo $(CONTIKI)/tools/tunslip6 $(PREFIX)
|
||||
|
||||
connect-router-cooja: $(CONTIKI)/tools/tunslip6
|
||||
sudo $(CONTIKI)/tools/tunslip6 -a 127.0.0.1 $(PREFIX)
|
@ -1,3 +0,0 @@
|
||||
PROJECT_SOURCEFILES += slip-bridge-putchar.c
|
||||
|
||||
CFLAGS += -DTARGET_CONF_PATH=\"target-conf.h\"
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Swedish Institute of Computer Science.
|
||||
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
*
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "dev/slip.h"
|
||||
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define SLIP_END 0300
|
||||
#undef putchar
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
putchar(int c)
|
||||
{
|
||||
static char debug_frame = 0;
|
||||
|
||||
if(!debug_frame) { /* Start of debug output */
|
||||
slip_arch_writeb(SLIP_END);
|
||||
slip_arch_writeb('\r'); /* Type debug line == '\r' */
|
||||
debug_frame = 1;
|
||||
}
|
||||
|
||||
/* Need to also print '\n' because for example COOJA will not show
|
||||
any output before line end */
|
||||
slip_arch_writeb((char)c);
|
||||
|
||||
/*
|
||||
* Line buffered output, a newline marks the end of debug output and
|
||||
* implicitly flushes debug output.
|
||||
*/
|
||||
if(c == '\n') {
|
||||
slip_arch_writeb(SLIP_END);
|
||||
debug_frame = 0;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
@ -1,11 +0,0 @@
|
||||
MODULES += os/services/slip-cmd
|
||||
|
||||
PROJECT_SOURCEFILES += border-router-native.c
|
||||
PROJECT_SOURCEFILES += border-router-cmds.c tun-bridge.c
|
||||
PROJECT_SOURCEFILES += slip-config.c slip-dev.c border-router-mac.c
|
||||
|
||||
MAKE_MAC = MAKE_MAC_OTHER
|
||||
MAKE_NET = MAKE_NET_IPV6
|
||||
|
||||
connect-router: border-router.native
|
||||
sudo ./border-router.native fd00::1/64
|
@ -28,17 +28,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PROJECT_ROUTER_CONF_H_
|
||||
#define PROJECT_ROUTER_CONF_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Include target-specific header */
|
||||
#ifdef TARGET_CONF_PATH
|
||||
#include TARGET_CONF_PATH
|
||||
#endif /* TARGET_CONF_PATH */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef UIP_FALLBACK_INTERFACE
|
||||
#define UIP_FALLBACK_INTERFACE rpl_interface
|
||||
#endif
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#ifndef WEBSERVER_CONF_CFS_CONNS
|
||||
#define WEBSERVER_CONF_CFS_CONNS 2
|
||||
@ -52,4 +43,4 @@
|
||||
#define UIP_CONF_TCP 1
|
||||
#endif
|
||||
|
||||
#endif /* PROJECT_ROUTER_CONF_H_ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
@ -29,13 +29,8 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef TARGET_CONF_H_
|
||||
#define TARGET_CONF_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Save some RAM and ROM */
|
||||
#define QUEUEBUF_CONF_NUM 4
|
||||
#define UIP_CONF_BUFFER_SIZE 140
|
||||
#define BORDER_ROUTER_CONF_WEBSERVER 0
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* TARGET_CONF_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
@ -2,13 +2,9 @@ CONTIKI_PROJECT = sensniff
|
||||
CONTIKI = ../..
|
||||
|
||||
PROJECT_SOURCEFILES += sensniff-mac.c netstack.c
|
||||
PROJECTDIRS += pool $(TARGET)
|
||||
MODULES_REL += pool $(TARGET)
|
||||
|
||||
-include $(CONTIKI)/Makefile.identify-target
|
||||
|
||||
### Optionally, the target can add its own Makefile, to do things like e.g.
|
||||
### add more source files to the build or define make variables.
|
||||
-include $(TARGET)/Makefile.$(TARGET)
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
|
@ -3,13 +3,9 @@ all: $(CONTIKI_PROJECT)
|
||||
MODULES += os/services/slip-cmd
|
||||
|
||||
CONTIKI=../..
|
||||
-include $(CONTIKI)/Makefile.identify-target
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
|
||||
### Optionally, the target can add its own Makefile, to do things like e.g.
|
||||
### add more source files to the build or define make variables.
|
||||
-include $(TARGET)/Makefile.$(TARGET)
|
||||
|
||||
PROJECTDIRS += $(TARGET)
|
||||
MODULES_REL += $(TARGET)
|
||||
PROJECT_SOURCEFILES += slip-net.c
|
||||
|
||||
# custom net layer, but with IPv6 enabled
|
||||
|
@ -29,11 +29,7 @@
|
||||
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Include target-specific header */
|
||||
#ifdef TARGET_CONF_PATH
|
||||
#include TARGET_CONF_PATH
|
||||
#endif /* TARGET_CONF_PATH */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define UIP_CONF_ROUTER 0
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
PROJECT_SOURCEFILES += slip-radio-cc2420.c slip-radio-sky-sensors.c
|
||||
PROJECT_SOURCEFILES += slip-radio-putchar.c
|
||||
|
||||
CFLAGS += -DTARGET_CONF_PATH=\"target-conf.h\"
|
@ -29,9 +29,6 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef TARGET_CONF_H_
|
||||
#define TARGET_CONF_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define QUEUEBUF_CONF_NUM 4
|
||||
#define UIP_CONF_BUFFER_SIZE 140
|
||||
|
||||
@ -39,5 +36,3 @@
|
||||
#define SLIP_RADIO_CONF_SENSORS slip_radio_sky_sensors
|
||||
#define UART1_CONF_RX_WITH_DMA 1
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* TARGET_CONF_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
@ -47,6 +47,7 @@
|
||||
#include "sys/stack-check.h"
|
||||
#include "dev/watchdog.h"
|
||||
|
||||
#include "services/rpl-border-router/rpl-border-router.h"
|
||||
#include "services/orchestra/orchestra.h"
|
||||
#include "services/shell/serial-shell.h"
|
||||
|
||||
@ -110,6 +111,11 @@ main(void)
|
||||
|
||||
platform_init_stage_three();
|
||||
|
||||
#if BUILD_WITH_RPL_BORDER_ROUTER
|
||||
rpl_border_router_init();
|
||||
LOG_DBG("With RPL Border Router\n");
|
||||
#endif /* BUILD_WITH_RPL_BORDER_ROUTER */
|
||||
|
||||
#if BUILD_WITH_ORCHESTRA
|
||||
orchestra_init();
|
||||
LOG_DBG("With Orchestra\n");
|
||||
|
@ -44,15 +44,14 @@
|
||||
* \addtogroup list
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "lib/list.h"
|
||||
|
||||
#define NULL 0
|
||||
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
struct list {
|
||||
struct list *next;
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Initialize a list.
|
||||
@ -118,13 +117,13 @@ void *
|
||||
list_tail(list_t list)
|
||||
{
|
||||
struct list *l;
|
||||
|
||||
|
||||
if(*list == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
for(l = *list; l->next != NULL; l = l->next);
|
||||
|
||||
|
||||
return l;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -148,7 +147,7 @@ list_add(list_t list, void *item)
|
||||
list_remove(list, item);
|
||||
|
||||
((struct list *)item)->next = NULL;
|
||||
|
||||
|
||||
l = list_tail(list);
|
||||
|
||||
if(l == NULL) {
|
||||
@ -164,8 +163,6 @@ list_add(list_t list, void *item)
|
||||
void
|
||||
list_push(list_t list, void *item)
|
||||
{
|
||||
/* struct list *l;*/
|
||||
|
||||
/* Make sure not to add the same element twice */
|
||||
list_remove(list, item);
|
||||
|
||||
@ -186,7 +183,7 @@ void *
|
||||
list_chop(list_t list)
|
||||
{
|
||||
struct list *l, *r;
|
||||
|
||||
|
||||
if(*list == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -195,12 +192,12 @@ list_chop(list_t list)
|
||||
*list = NULL;
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
for(l = *list; l->next->next != NULL; l = l->next);
|
||||
|
||||
r = l->next;
|
||||
l->next = NULL;
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -240,20 +237,20 @@ void
|
||||
list_remove(list_t list, void *item)
|
||||
{
|
||||
struct list *l, *r;
|
||||
|
||||
|
||||
if(*list == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
r = NULL;
|
||||
for(l = *list; l != NULL; l = l->next) {
|
||||
if(l == item) {
|
||||
if(r == NULL) {
|
||||
/* First on list */
|
||||
*list = l->next;
|
||||
/* First on list */
|
||||
*list = l->next;
|
||||
} else {
|
||||
/* Not first on list */
|
||||
r->next = l->next;
|
||||
/* Not first on list */
|
||||
r->next = l->next;
|
||||
}
|
||||
l->next = NULL;
|
||||
return;
|
||||
@ -305,7 +302,7 @@ list_insert(list_t list, void *previtem, void *newitem)
|
||||
if(previtem == NULL) {
|
||||
list_push(list, newitem);
|
||||
} else {
|
||||
|
||||
list_remove(list, newitem);
|
||||
((struct list *)newitem)->next = ((struct list *)previtem)->next;
|
||||
((struct list *)previtem)->next = newitem;
|
||||
}
|
||||
@ -324,7 +321,7 @@ list_insert(list_t list, void *previtem, void *newitem)
|
||||
void *
|
||||
list_item_next(void *item)
|
||||
{
|
||||
return item == NULL? NULL: ((struct list *)item)->next;
|
||||
return item == NULL ? NULL : ((struct list *)item)->next;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
@ -115,7 +115,7 @@ static uip_ds6_nbr_t *nbr; /** Pointer to a nbr cache entry*/
|
||||
static uip_ds6_addr_t *addr; /** Pointer to an interface address */
|
||||
#endif /* UIP_ND6_SEND_NS || UIP_ND6_SEND_NA || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER */
|
||||
|
||||
#if UIP_ND6_SEND_NS || !UIP_CONF_ROUTER
|
||||
#if UIP_ND6_SEND_NS || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER
|
||||
static uip_ds6_defrt_t *defrt; /** Pointer to a router list entry */
|
||||
#endif /* UIP_ND6_SEND_NS || UIP_ND6_SEND_RA || !UIP_CONF_ROUTER */
|
||||
|
||||
@ -973,7 +973,7 @@ ra_input(void)
|
||||
default:
|
||||
LOG_DBG("Updating timer of prefix ");
|
||||
LOG_DBG_6ADDR(&prefix->ipaddr);
|
||||
LOG_DBG_(" new value %lu\n", uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||
LOG_DBG_(" new value %lu\n", (unsigned long)uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||
stimer_set(&prefix->vlifetime,
|
||||
uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||
prefix->isinfinite = 0;
|
||||
@ -999,7 +999,7 @@ ra_input(void)
|
||||
LOG_DBG("Updating timer of address ");
|
||||
LOG_DBG_6ADDR(&addr->ipaddr);
|
||||
LOG_DBG_(" new value %lu\n",
|
||||
uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||
(unsigned long)uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||
stimer_set(&addr->vlifetime,
|
||||
uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||
} else {
|
||||
@ -1027,18 +1027,16 @@ ra_input(void)
|
||||
break;
|
||||
#if UIP_ND6_RA_RDNSS
|
||||
case UIP_ND6_OPT_RDNSS:
|
||||
if(UIP_ND6_RA_BUF->flags_reserved & (UIP_ND6_O_FLAG << 6)) {
|
||||
LOG_DBG("Processing RDNSS option\n");
|
||||
uint8_t naddr = (UIP_ND6_OPT_RDNSS_BUF->len - 1) / 2;
|
||||
uip_ipaddr_t *ip = (uip_ipaddr_t *)(&UIP_ND6_OPT_RDNSS_BUF->ip);
|
||||
LOG_DBG("got %d nameservers\n", naddr);
|
||||
while(naddr-- > 0) {
|
||||
LOG_DBG("nameserver: ");
|
||||
LOG_DBG_6ADDR(ip);
|
||||
LOG_DBG_(" lifetime: %lx\n", uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
|
||||
uip_nameserver_update(ip, uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
|
||||
ip++;
|
||||
}
|
||||
LOG_DBG("Processing RDNSS option\n");
|
||||
uint8_t naddr = (UIP_ND6_OPT_RDNSS_BUF->len - 1) / 2;
|
||||
uip_ipaddr_t *ip = (uip_ipaddr_t *)(&UIP_ND6_OPT_RDNSS_BUF->ip);
|
||||
LOG_DBG("got %d nameservers\n", naddr);
|
||||
while(naddr-- > 0) {
|
||||
LOG_DBG("nameserver: ");
|
||||
LOG_DBG_6ADDR(ip);
|
||||
LOG_DBG_(" lifetime: %lx\n", (unsigned long)uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
|
||||
uip_nameserver_update(ip, uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
|
||||
ip++;
|
||||
}
|
||||
break;
|
||||
#endif /* UIP_ND6_RA_RDNSS */
|
||||
|
@ -118,7 +118,7 @@ be added regardless of their reachability and liveness. */
|
||||
#define UIP_ND6_MIN_RA_INTERVAL UIP_CONF_ND6_MIN_RA_INTERVAL
|
||||
#endif
|
||||
#define UIP_ND6_M_FLAG 0
|
||||
#define UIP_ND6_O_FLAG (UIP_ND6_RA_RDNSS || UIP_ND6_RA_DNSSL)
|
||||
#define UIP_ND6_O_FLAG 0
|
||||
#ifndef UIP_CONF_ROUTER_LIFETIME
|
||||
#define UIP_ND6_ROUTER_LIFETIME 3 * UIP_ND6_MAX_RA_INTERVAL
|
||||
#else
|
||||
|
@ -141,15 +141,23 @@ get_global_addr(uip_ipaddr_t *addr)
|
||||
{
|
||||
int i;
|
||||
int state;
|
||||
uip_ipaddr_t *prefix = NULL;
|
||||
uint8_t prefix_length = 0;
|
||||
rpl_dag_t *dag = rpl_get_any_dag();
|
||||
|
||||
if(dag != NULL && dag->prefix_info.length != 0) {
|
||||
prefix = &dag->prefix_info.prefix;
|
||||
prefix_length = dag->prefix_info.length;
|
||||
}
|
||||
|
||||
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
|
||||
state = uip_ds6_if.addr_list[i].state;
|
||||
if(uip_ds6_if.addr_list[i].isused &&
|
||||
(state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
|
||||
if(!uip_is_addr_linklocal(&uip_ds6_if.addr_list[i].ipaddr)) {
|
||||
memcpy(addr, &uip_ds6_if.addr_list[i].ipaddr, sizeof(uip_ipaddr_t));
|
||||
return 1;
|
||||
}
|
||||
state == ADDR_PREFERRED &&
|
||||
!uip_is_addr_linklocal(&uip_ds6_if.addr_list[i].ipaddr) &&
|
||||
(prefix == NULL || uip_ipaddr_prefixcmp(prefix, &uip_ds6_if.addr_list[i].ipaddr, prefix_length))) {
|
||||
memcpy(addr, &uip_ds6_if.addr_list[i].ipaddr, sizeof(uip_ipaddr_t));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -71,12 +71,20 @@ rpl_get_global_address(void)
|
||||
int i;
|
||||
uint8_t state;
|
||||
uip_ipaddr_t *ipaddr = NULL;
|
||||
uip_ipaddr_t *prefix = NULL;
|
||||
uint8_t prefix_length = 0;
|
||||
|
||||
if(curr_instance.used && curr_instance.dag.prefix_info.length != 0) {
|
||||
prefix = &curr_instance.dag.prefix_info.prefix;
|
||||
prefix_length = curr_instance.dag.prefix_info.length;
|
||||
}
|
||||
|
||||
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
|
||||
state = uip_ds6_if.addr_list[i].state;
|
||||
if(uip_ds6_if.addr_list[i].isused &&
|
||||
state == ADDR_PREFERRED &&
|
||||
!uip_is_addr_linklocal(&uip_ds6_if.addr_list[i].ipaddr)) {
|
||||
!uip_is_addr_linklocal(&uip_ds6_if.addr_list[i].ipaddr) &&
|
||||
(prefix == NULL || uip_ipaddr_prefixcmp(prefix, &uip_ds6_if.addr_list[i].ipaddr, prefix_length))) {
|
||||
ipaddr = &uip_ds6_if.addr_list[i].ipaddr;
|
||||
}
|
||||
}
|
||||
|
8
os/services/rpl-border-router/Makefile.rpl-border-router
Normal file
8
os/services/rpl-border-router/Makefile.rpl-border-router
Normal file
@ -0,0 +1,8 @@
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
|
||||
# Include either native or embedded BR
|
||||
ifeq ($(TARGET),native)
|
||||
MODULES += os/services/rpl-border-router/native
|
||||
else
|
||||
MODULES += os/services/rpl-border-router/embedded
|
||||
endif
|
9
os/services/rpl-border-router/embedded/Makefile.embedded
Normal file
9
os/services/rpl-border-router/embedded/Makefile.embedded
Normal file
@ -0,0 +1,9 @@
|
||||
$(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c
|
||||
(cd $(CONTIKI)/tools && $(MAKE) tunslip6)
|
||||
|
||||
PREFIX ?= fd00::1/64
|
||||
connect-router: $(CONTIKI)/tools/tunslip6
|
||||
sudo $(CONTIKI)/tools/tunslip6 $(PREFIX)
|
||||
|
||||
connect-router-cooja: $(CONTIKI)/tools/tunslip6
|
||||
sudo $(CONTIKI)/tools/tunslip6 -a 127.0.0.1 $(PREFIX)
|
@ -39,7 +39,7 @@
|
||||
#include "rpl.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/slip.h"
|
||||
#include "border-router-common.h"
|
||||
#include "rpl-border-router.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Log configuration */
|
32
os/services/rpl-border-router/module-macros.h
Normal file
32
os/services/rpl-border-router/module-macros.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2017, RISE SICS
|
||||
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#define BUILD_WITH_RPL_BORDER_ROUTER 1
|
||||
#define UIP_FALLBACK_INTERFACE rpl_interface
|
8
os/services/rpl-border-router/native/Makefile.native
Normal file
8
os/services/rpl-border-router/native/Makefile.native
Normal file
@ -0,0 +1,8 @@
|
||||
MODULES += os/services/slip-cmd
|
||||
|
||||
MAKE_MAC = MAKE_MAC_OTHER
|
||||
MAKE_NET = MAKE_NET_IPV6
|
||||
|
||||
PREFIX ?= fd00::1/64
|
||||
connect-router: border-router.native
|
||||
sudo ./border-router.native $(PREFIX)
|
@ -41,7 +41,7 @@
|
||||
#include "contiki.h"
|
||||
#include "contiki-net.h"
|
||||
#include "rpl.h"
|
||||
#include "border-router-common.h"
|
||||
#include "rpl-border-router.h"
|
||||
#include "cmd.h"
|
||||
#include "border-router.h"
|
||||
#include "border-router-cmds.h"
|
@ -27,13 +27,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef PROJECT_ROUTER_CONF_H_
|
||||
#define PROJECT_ROUTER_CONF_H_
|
||||
|
||||
#define BORDER_ROUTER_CONF_WEBSERVER 1
|
||||
|
||||
#define UIP_FALLBACK_INTERFACE rpl_interface
|
||||
|
||||
/* use a non-default network driver */
|
||||
#define NETSTACK_CONF_NETWORK sicslowpan_driver
|
||||
|
||||
@ -42,14 +35,9 @@
|
||||
|
||||
#define SLIP_DEV_CONF_SEND_DELAY (CLOCK_SECOND / 32)
|
||||
|
||||
#define WEBSERVER_CONF_CFS_CONNS 2
|
||||
|
||||
#define SERIALIZE_ATTRIBUTES 1
|
||||
#define UIP_CONF_TCP 1
|
||||
|
||||
#define CMD_CONF_OUTPUT border_router_cmd_output
|
||||
|
||||
/* used by wpcap (see /cpu/native/net/wpcap-drv.c) */
|
||||
#define SELECT_CALLBACK 1
|
||||
|
||||
#endif /* PROJECT_ROUTER_CONF_H_ */
|
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "border-router-common.h"
|
||||
#include "rpl-border-router.h"
|
||||
#include "rpl-dag-root.h"
|
||||
|
||||
/* Log configuration */
|
||||
@ -67,3 +67,11 @@ set_prefix_64(uip_ipaddr_t *prefix_64)
|
||||
rpl_dag_root_init(prefix_64, NULL);
|
||||
rpl_dag_root_init_dag_immediately();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
rpl_border_router_init(void)
|
||||
{
|
||||
PROCESS_NAME(border_router_process);
|
||||
process_start(&border_router_process, NULL);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
@ -36,5 +36,6 @@
|
||||
|
||||
extern uint8_t prefix_set;
|
||||
|
||||
void rpl_border_router_init(void);
|
||||
void print_local_addresses(void);
|
||||
void set_prefix_64(uip_ipaddr_t *prefix_64);
|
@ -37,12 +37,12 @@
|
||||
#include "contiki.h"
|
||||
#include "unit-test.h"
|
||||
|
||||
/* Register two unit tests that will be executed by using
|
||||
/* Register two unit tests that will be executed by using
|
||||
the UNIT_TEST_RUN macro. */
|
||||
UNIT_TEST_REGISTER(arithmetic, "Arith ops");
|
||||
UNIT_TEST_REGISTER(string, "String ops");
|
||||
|
||||
/* arithmetic: Demonstrates a test that succeeds. The exit point will be
|
||||
/* arithmetic: Demonstrates a test that succeeds. The exit point will be
|
||||
the line where UNIT_TEST_END is called. */
|
||||
UNIT_TEST(arithmetic)
|
||||
{
|
||||
@ -58,7 +58,7 @@ UNIT_TEST(arithmetic)
|
||||
UNIT_TEST_END();
|
||||
}
|
||||
|
||||
/* string: Demonstrates a test that fails. The exit point will be
|
||||
/* string: Demonstrates a test that fails. The exit point will be
|
||||
the line where the call to UNIT_TEST_ASSERT fails. */
|
||||
UNIT_TEST(string)
|
||||
{
|
||||
@ -72,7 +72,6 @@ UNIT_TEST(string)
|
||||
}
|
||||
|
||||
PROCESS(test_process, "Unit testing");
|
||||
AUTOSTART_PROCESSES(&test_process);
|
||||
|
||||
PROCESS_THREAD(test_process, ev, data)
|
||||
{
|
||||
|
@ -44,13 +44,8 @@
|
||||
#include "sys/process.h"
|
||||
|
||||
#if ! CC_NO_VA_ARGS
|
||||
#if AUTOSTART_ENABLE
|
||||
#define AUTOSTART_PROCESSES(...) \
|
||||
struct process * const autostart_processes[] = {__VA_ARGS__, NULL}
|
||||
#else /* AUTOSTART_ENABLE */
|
||||
#define AUTOSTART_PROCESSES(...) \
|
||||
extern int _dummy
|
||||
#endif /* AUTOSTART_ENABLE */
|
||||
#else
|
||||
#error "C compiler must support __VA_ARGS__ macro"
|
||||
#endif
|
||||
|
@ -30,15 +30,15 @@ DOCDIR=../../tools/doxygen
|
||||
all: clean summary
|
||||
|
||||
doxygen:
|
||||
@make -C $(DOCDIR) 2> doxygen.runerr > doxygen.runlog
|
||||
@make -C $(DOCDIR) 2> doxygen.err > /dev/null
|
||||
|
||||
summary: doxygen
|
||||
@( \
|
||||
1> summary; \
|
||||
if [ -s doxygen.runerr ] ; then \
|
||||
if [ -s doxygen.err ] ; then \
|
||||
echo "Doxygen: TEST FAIL" | tee summary; \
|
||||
echo "Errors:"; \
|
||||
cat doxygen.runerr; \
|
||||
cat doxygen.err; \
|
||||
fi ; \
|
||||
if [ -s $(DOCDIR)/doxygen.log ] ; then \
|
||||
echo "Doxygen: TEST FAIL" | tee summary; \
|
||||
@ -49,10 +49,10 @@ summary: doxygen
|
||||
echo "Doxygen: TEST OK (no warning nor error)" | tee summary; \
|
||||
fi ; \
|
||||
)
|
||||
@rm doxygen.runlog doxygen.runerr
|
||||
@rm doxygen.err
|
||||
@echo "========== Summary =========="
|
||||
@cat summary
|
||||
|
||||
clean:
|
||||
@rm -f summary doxygen.runlog doxygen.runerr
|
||||
@rm -f summary doxygen.err
|
||||
@make -C $(DOCDIR) clean
|
||||
|
@ -30,6 +30,7 @@
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "lib/list.h"
|
||||
#include "lib/stack.h"
|
||||
#include "lib/queue.h"
|
||||
#include "lib/circular-list.h"
|
||||
@ -65,6 +66,141 @@ print_test_report(const unit_test_t *utp)
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
UNIT_TEST_REGISTER(test_list, "Singly-linked list");
|
||||
UNIT_TEST(test_list)
|
||||
{
|
||||
demo_struct_t *head, *tail;
|
||||
|
||||
LIST(lst);
|
||||
|
||||
UNIT_TEST_BEGIN();
|
||||
|
||||
memset(elements, 0, sizeof(elements));
|
||||
list_init(lst);
|
||||
|
||||
/* Starts from empty */
|
||||
UNIT_TEST_ASSERT(list_head(lst) == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 0);
|
||||
|
||||
/*
|
||||
* Add an item. Should be head and tail
|
||||
* 0 --> NULL
|
||||
*/
|
||||
list_add(lst, &elements[0]);
|
||||
UNIT_TEST_ASSERT(list_head(lst) == &elements[0]);
|
||||
UNIT_TEST_ASSERT(list_tail(lst) == &elements[0]);
|
||||
UNIT_TEST_ASSERT(elements[0].next == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 1);
|
||||
|
||||
/*
|
||||
* Add an item. Should become the new tail
|
||||
* 0 --> 1 --> NULL
|
||||
*/
|
||||
list_add(lst, &elements[1]);
|
||||
head = list_head(lst);
|
||||
tail = list_tail(lst);
|
||||
UNIT_TEST_ASSERT(list_head(lst) == &elements[0]);
|
||||
UNIT_TEST_ASSERT(list_tail(lst) == &elements[1]);
|
||||
UNIT_TEST_ASSERT(head->next == tail);
|
||||
UNIT_TEST_ASSERT(tail->next == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 2);
|
||||
|
||||
/*
|
||||
* Add after existing head
|
||||
* 0 --> 2 --> 1 --> NULL
|
||||
*/
|
||||
head = list_head(lst);
|
||||
list_insert(lst, head, &elements[2]);
|
||||
head = list_head(lst);
|
||||
tail = list_tail(lst);
|
||||
UNIT_TEST_ASSERT(list_head(lst) == &elements[0]);
|
||||
UNIT_TEST_ASSERT(list_tail(lst) == &elements[1]);
|
||||
UNIT_TEST_ASSERT(head->next == &elements[2]);
|
||||
UNIT_TEST_ASSERT(elements[2].next == tail);
|
||||
UNIT_TEST_ASSERT(tail->next == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 3);
|
||||
|
||||
/*
|
||||
* Add after existing head
|
||||
* 0 --> 2 --> 1 --> 3 --> NULL
|
||||
*/
|
||||
tail = list_tail(lst);
|
||||
list_insert(lst, tail, &elements[3]);
|
||||
tail = list_tail(lst);
|
||||
UNIT_TEST_ASSERT(list_head(lst) == &elements[0]);
|
||||
UNIT_TEST_ASSERT(list_tail(lst) == &elements[3]);
|
||||
UNIT_TEST_ASSERT(tail->next == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 4);
|
||||
|
||||
/*
|
||||
* Re-add item 2 using list_add
|
||||
* 0 --> 1 --> 3 --> 2 --> NULL
|
||||
*/
|
||||
list_add(lst, &elements[2]);
|
||||
tail = list_tail(lst);
|
||||
UNIT_TEST_ASSERT(list_head(lst) == &elements[0]);
|
||||
UNIT_TEST_ASSERT(list_tail(lst) == &elements[2]);
|
||||
UNIT_TEST_ASSERT(tail->next == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 4);
|
||||
|
||||
/*
|
||||
* Re-add item 3 using list_insert
|
||||
* 0 --> 1 --> 2 --> 3 --> NULL
|
||||
*/
|
||||
tail = list_tail(lst);
|
||||
list_insert(lst, tail, &elements[3]);
|
||||
tail = list_tail(lst);
|
||||
UNIT_TEST_ASSERT(list_head(lst) == &elements[0]);
|
||||
UNIT_TEST_ASSERT(list_tail(lst) == &elements[3]);
|
||||
UNIT_TEST_ASSERT(elements[2].next == tail);
|
||||
UNIT_TEST_ASSERT(tail->next == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 4);
|
||||
|
||||
/*
|
||||
* Remove the tail
|
||||
* 0 --> 1 --> 2 --> NULL
|
||||
*/
|
||||
tail = list_tail(lst);
|
||||
UNIT_TEST_ASSERT(list_chop(lst) == tail);
|
||||
head = list_head(lst);
|
||||
tail = list_tail(lst);
|
||||
UNIT_TEST_ASSERT(tail == &elements[2]);
|
||||
UNIT_TEST_ASSERT(tail->next == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 3);
|
||||
|
||||
/*
|
||||
* Remove an item in the middle
|
||||
* 0 --> 2 --> NULL
|
||||
*/
|
||||
head = list_head(lst);
|
||||
list_remove(lst, head->next);
|
||||
head = list_head(lst);
|
||||
tail = list_tail(lst);
|
||||
UNIT_TEST_ASSERT(head->next == tail);
|
||||
UNIT_TEST_ASSERT(list_head(lst) == &elements[0]);
|
||||
UNIT_TEST_ASSERT(list_tail(lst) == &elements[2]);
|
||||
UNIT_TEST_ASSERT(tail->next == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 2);
|
||||
|
||||
/*
|
||||
* Remove the head
|
||||
* 2 --> NULL
|
||||
*/
|
||||
list_remove(lst, list_head(lst));
|
||||
tail = list_tail(lst);
|
||||
UNIT_TEST_ASSERT(list_head(lst) == &elements[2]);
|
||||
UNIT_TEST_ASSERT(list_tail(lst) == &elements[2]);
|
||||
UNIT_TEST_ASSERT(tail->next == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 1);
|
||||
|
||||
/* Ends empty */
|
||||
list_remove(lst, list_tail(lst));
|
||||
UNIT_TEST_ASSERT(list_head(lst) == NULL);
|
||||
UNIT_TEST_ASSERT(list_length(lst) == 0);
|
||||
|
||||
UNIT_TEST_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
UNIT_TEST_REGISTER(test_stack, "Stack Push/Pop");
|
||||
UNIT_TEST(test_stack)
|
||||
{
|
||||
@ -884,6 +1020,7 @@ PROCESS_THREAD(data_structure_test_process, ev, data)
|
||||
|
||||
memset(elements, 0, sizeof(elements));
|
||||
|
||||
UNIT_TEST_RUN(test_list);
|
||||
UNIT_TEST_RUN(test_stack);
|
||||
UNIT_TEST_RUN(test_queue);
|
||||
UNIT_TEST_RUN(test_csll);
|
||||
|
@ -44,7 +44,7 @@ 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;
|
||||
printf "%-32s TEST OK %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" > $BASENAME.testlog;
|
||||
else
|
||||
echo "==== make.log ====" ; cat make.log;
|
||||
echo "==== make.err ====" ; cat make.err;
|
||||
|
@ -41,10 +41,10 @@ define dooneexample
|
||||
@echo -n Building example $(3): $(1) $(4) for target $(2)
|
||||
@((cd $(EXAMPLESDIR)/$(1); \
|
||||
make $(4) TARGET=$(2) clean && make -j $(4) TARGET=$(2) WERROR=1) > \
|
||||
/dev/null 2>make.runerr && \
|
||||
/dev/null 2>make.err && \
|
||||
(echo " -> OK" && printf "%-75s %-35s %-20s TEST OK\n" "$(1)" "$(4)" "$(2)" > $(3)-$(subst /,-,$(1))$(2).testlog) || \
|
||||
(echo " -> FAIL" && printf "%-75s %-35s %-20s TEST FAIL\n" "$(1)" "$(4)" "$(2)" > $(3)-$(subst /,-,$(1))$(2).testlog ; cat make.runerr))
|
||||
@rm -f make.runerr
|
||||
(echo " -> FAIL" && printf "%-75s %-35s %-20s TEST FAIL\n" "$(1)" "$(4)" "$(2)" > $(3)-$(subst /,-,$(1))$(2).testlog ; cat make.err))
|
||||
@rm -f make.err
|
||||
endef
|
||||
|
||||
define doexample
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 1256b299930b57f4c1d5512f8e96aa22a327591c
|
||||
Subproject commit c1a1b4fdc9329b6cf22a7740145f448841ac2254
|
@ -12,7 +12,7 @@ ifndef TARGET
|
||||
TARGET=sky
|
||||
endif
|
||||
|
||||
PROJECTDIRS = dev
|
||||
MODULES_REL += dev
|
||||
PROJECT_SOURCEFILES = fakeuip.c sicslow_ethernet.c
|
||||
|
||||
all: uip6-bridge-tap.sky
|
||||
|
Loading…
Reference in New Issue
Block a user