Merge branch 'develop' into contrib/default-prefix-as-variable

This commit is contained in:
George Oikonomou 2018-11-25 02:43:45 +00:00 committed by GitHub
commit 4243836e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 1180 additions and 538 deletions

View File

@ -82,7 +82,10 @@ uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
### Include target makefile (TODO Unsafe?)
target_makefile := $(wildcard $(CONTIKI)/arch/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
# Configurable arch path
ARCH_PATH ?= $(CONTIKI)/arch
target_makefile := $(wildcard $(ARCH_PATH)/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
# Check if the target makefile exists, and create the object directory if necessary.
ifeq ($(strip $(target_makefile)),)
@ -326,13 +329,13 @@ clean:
@echo Target $(TARGET) cleaned
distclean:
@for TARG in `ls $(CONTIKI)/arch/platform $(TARGETDIRS)`; do \
@for TARG in `ls $(ARCH_PATH)/platform $(TARGETDIRS)`; do \
echo Running: $(MAKE) TARGET=$$TARG clean; \
$(MAKE) TARGET=$$TARG clean; \
done
-$(Q)rm -rf $(BUILD_DIR)
-include $(CONTIKI)/arch/platform/$(TARGET)/Makefile.customrules-$(TARGET)
-include $(ARCH_PATH)/platform/$(TARGET)/Makefile.customrules-$(TARGET)
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
@ -414,7 +417,7 @@ endif
include $(CONTIKI)/Makefile.help
targets:
@ls $(CONTIKI)/arch/platform $(TARGETDIRS)
@ls $(ARCH_PATH)/platform $(TARGETDIRS)
boards:
ifdef BOARD

View File

@ -25,4 +25,4 @@ $(OUT_ELF): $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.o $(PROJECT_OBJECTFILES)
$(TRACE_LD)
$(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFLAGS) -o $@
include $(CONTIKI)/arch/cpu/arm/Makefile.arm
include $(ARCH_PATH)/cpu/arm/Makefile.arm

View File

@ -6,4 +6,4 @@ LDFLAGS += -mcpu=cortex-m3 -nostartfiles
TARGET_LIBFILES += -lm
include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m
include $(ARCH_PATH)/cpu/arm/cortex-m/Makefile.cortex-m

View File

@ -4,4 +4,4 @@ CFLAGS += -mcpu=cortex-m4
LDFLAGS += -mcpu=cortex-m4
include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m
include $(ARCH_PATH)/cpu/arm/cortex-m/Makefile.cortex-m

View File

@ -52,4 +52,4 @@ $(LDSCRIPT): $(SOURCE_LDSCRIPT) FORCE | $(OBJECTDIR)
$(TRACE_CC)
$(Q)$(CC) $(LDGENFLAGS) $< | grep -v '^\s*#\s*pragma\>' > $@
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3
include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3

View File

@ -24,7 +24,7 @@ CFLAGS += -I$(TI_XXWARE) -I$(CONTIKI)/$(TI_XXWARE_SRC)
CFLAGS += -I$(TI_XXWARE)/inc
MODULES += $(TI_XXWARE_SRC)
LDSCRIPT = $(CONTIKI_CPU)/cc26xx.ld
LDSCRIPT ?= $(CONTIKI_CPU)/cc26xx.ld
### If the user-specified a Node ID, pass a define
ifdef NODEID
@ -81,7 +81,7 @@ STACK_SIZE = 0
@$(SIZE) -A $< | egrep "data|bss" | awk '{s+=$$2} END {s=s+$(STACK_SIZE); f=$(RAM_SIZE)-s; printf "[RAM] used %6d, free %6d\n",s,f;}'
@$(SIZE) -A $< | egrep "text|isr_vector" | awk '{s+=$$2} END {f=$(FLASH_SIZE)-s; printf "[Flash] used %6d, free %6d\n",s,f;}'
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3
include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3
ifeq ($(BOARD_SUPPORTS_BSL),1)
%.upload: $(OUT_BIN)

View File

@ -11,7 +11,7 @@ CFLAGS += -gstabs+
.SUFFIXES:
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/msp430
CONTIKI_CPU=$(ARCH_PATH)/cpu/msp430
### Define the source files we have in the MSP430 port

View File

@ -25,9 +25,9 @@ ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1)
NRF52_SOFTDEVICE := $(shell find $(NRF52_SDK_ROOT) -name *iot*_softdevice.hex | head -n 1)
endif
$(info SoftDevice: $(NRF52_SOFTDEVICE))
LDSCRIPT := $(CONTIKI_CPU)/ld/nrf52-$(NRF52_DK_REVISION)-sd.ld
LDSCRIPT ?= $(CONTIKI_CPU)/ld/nrf52-$(NRF52_DK_REVISION)-sd.ld
else
LDSCRIPT := $(CONTIKI_CPU)/ld/nrf52.ld
LDSCRIPT ?= $(CONTIKI_CPU)/ld/nrf52.ld
endif
OUTPUT_FILENAME := $(CONTIKI_PROJECT)
@ -204,4 +204,4 @@ erase:
.PHONY: softdevice.jlink
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm4/Makefile.cm4
include $(ARCH_PATH)/cpu/arm/cortex-m/cm4/Makefile.cm4

View File

@ -120,7 +120,7 @@ LDFLAGS += -nostartfiles
LDFLAGS += -static
# Linker script
LDSCRIPT := $(CONTIKI_CPU)/$(SUBFAMILY)/$(SUBFAMILY).lds
LDSCRIPT ?= $(CONTIKI_CPU)/$(SUBFAMILY)/$(SUBFAMILY).lds
# Globally linked libraries
TARGET_LIBFILES += -lc -lgcc -lnosys -lm

View File

@ -8,4 +8,4 @@ TARGET_LIBFILES += $(SDK_DRIVERS)/lib/drivers_$(SDK_LIB_NAME).am3g
TARGET_LIBFILES += $(SDK_DEVICES)/driverlib/bin/gcc/driverlib.lib
# CC13x0/CC26x0 is a Cortex-M3 architecture
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3
include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3

View File

@ -95,42 +95,42 @@ SECTIONS {
* --------- DO NOT MODIFY -----------
*/
UDMACC26XX_dmaSpi0RxControlTableEntry_is_placed = 0;
.dmaSpi0RxControlTableEntry DMA_SPI0_RX_CTEA : AT (DMA_SPI0_RX_CTEA) {
.dmaSpi0RxControlTableEntry DMA_SPI0_RX_CTEA (NOLOAD) : AT (DMA_SPI0_RX_CTEA) {
*(.dmaSpi0RxControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaSpi0TxControlTableEntry_is_placed = 0;
.dmaSpi0TxControlTableEntry DMA_SPI0_TX_CTEA : AT (DMA_SPI0_TX_CTEA) {
.dmaSpi0TxControlTableEntry DMA_SPI0_TX_CTEA (NOLOAD) : AT (DMA_SPI0_TX_CTEA) {
*(.dmaSpi0TxControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaADCPriControlTableEntry_is_placed = 0;
.dmaADCPriControlTableEntry DMA_ADC_PRI_CTEA : AT (DMA_ADC_PRI_CTEA) {
.dmaADCPriControlTableEntry DMA_ADC_PRI_CTEA (NOLOAD) : AT (DMA_ADC_PRI_CTEA) {
*(.dmaADCPriControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaGPT0APriControlTableEntry_is_placed = 0;
.dmaGPT0APriControlTableEntry DMA_GPT0A_PRI_CTEA : AT (DMA_GPT0A_PRI_CTEA) {
.dmaGPT0APriControlTableEntry DMA_GPT0A_PRI_CTEA (NOLOAD) : AT (DMA_GPT0A_PRI_CTEA) {
*(.dmaGPT0APriControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaSpi1RxControlTableEntry_is_placed = 0;
.dmaSpi1RxControlTableEntry DMA_SPI1_RX_CTEA : AT (DMA_SPI1_RX_CTEA) {
.dmaSpi1RxControlTableEntry DMA_SPI1_RX_CTEA (NOLOAD) : AT (DMA_SPI1_RX_CTEA) {
*(.dmaSpi1RxControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaSpi1TxControlTableEntry_is_placed = 0;
.dmaSpi1TxControlTableEntry DMA_SPI1_TX_CTEA : AT (DMA_SPI1_TX_CTEA) {
.dmaSpi1TxControlTableEntry DMA_SPI1_TX_CTEA (NOLOAD) : AT (DMA_SPI1_TX_CTEA) {
*(.dmaSpi1TxControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaADCAltControlTableEntry_is_placed = 0;
.dmaADCAltControlTableEntry DMA_ADC_ALT_CTEA : AT (DMA_ADC_ALT_CTEA) {
.dmaADCAltControlTableEntry DMA_ADC_ALT_CTEA (NOLOAD) : AT (DMA_ADC_ALT_CTEA) {
*(.dmaADCAltControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaGPT0AAltControlTableEntry_is_placed = 0;
.dmaGPT0AAltControlTableEntry DMA_GPT0A_ALT_CTEA : AT (DMA_GPT0A_ALT_CTEA) {
.dmaGPT0AAltControlTableEntry DMA_GPT0A_ALT_CTEA (NOLOAD) : AT (DMA_GPT0A_ALT_CTEA) {
*(.dmaGPT0AAltControlTableEntry)
} > REGION_DATA

View File

@ -8,4 +8,4 @@ TARGET_LIBFILES += $(SDK_DRIVERS)/lib/drivers_$(SDK_LIB_NAME).am4fg
TARGET_LIBFILES += $(SDK_DEVICES)/driverlib/bin/gcc/driverlib.lib
# CC13x2/CC26x2 is a Cortex-M4 architecture
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm4/Makefile.cm4
include $(ARCH_PATH)/cpu/arm/cortex-m/cm4/Makefile.cm4

View File

@ -95,42 +95,42 @@ SECTIONS {
* --------- DO NOT MODIFY -----------
*/
UDMACC26XX_dmaSpi0RxControlTableEntry_is_placed = 0;
.dmaSpi0RxControlTableEntry DMA_SPI0_RX_CTEA : AT (DMA_SPI0_RX_CTEA) {
.dmaSpi0RxControlTableEntry DMA_SPI0_RX_CTEA (NOLOAD) : AT (DMA_SPI0_RX_CTEA) {
*(.dmaSpi0RxControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaSpi0TxControlTableEntry_is_placed = 0;
.dmaSpi0TxControlTableEntry DMA_SPI0_TX_CTEA : AT (DMA_SPI0_TX_CTEA) {
.dmaSpi0TxControlTableEntry DMA_SPI0_TX_CTEA (NOLOAD) : AT (DMA_SPI0_TX_CTEA) {
*(.dmaSpi0TxControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaADCPriControlTableEntry_is_placed = 0;
.dmaADCPriControlTableEntry DMA_ADC_PRI_CTEA : AT (DMA_ADC_PRI_CTEA) {
.dmaADCPriControlTableEntry DMA_ADC_PRI_CTEA (NOLOAD) : AT (DMA_ADC_PRI_CTEA) {
*(.dmaADCPriControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaGPT0APriControlTableEntry_is_placed = 0;
.dmaGPT0APriControlTableEntry DMA_GPT0A_PRI_CTEA : AT (DMA_GPT0A_PRI_CTEA) {
.dmaGPT0APriControlTableEntry DMA_GPT0A_PRI_CTEA (NOLOAD) : AT (DMA_GPT0A_PRI_CTEA) {
*(.dmaGPT0APriControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaSpi1RxControlTableEntry_is_placed = 0;
.dmaSpi1RxControlTableEntry DMA_SPI1_RX_CTEA : AT (DMA_SPI1_RX_CTEA) {
.dmaSpi1RxControlTableEntry DMA_SPI1_RX_CTEA (NOLOAD) : AT (DMA_SPI1_RX_CTEA) {
*(.dmaSpi1RxControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaSpi1TxControlTableEntry_is_placed = 0;
.dmaSpi1TxControlTableEntry DMA_SPI1_TX_CTEA : AT (DMA_SPI1_TX_CTEA) {
.dmaSpi1TxControlTableEntry DMA_SPI1_TX_CTEA (NOLOAD) : AT (DMA_SPI1_TX_CTEA) {
*(.dmaSpi1TxControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaADCAltControlTableEntry_is_placed = 0;
.dmaADCAltControlTableEntry DMA_ADC_ALT_CTEA : AT (DMA_ADC_ALT_CTEA) {
.dmaADCAltControlTableEntry DMA_ADC_ALT_CTEA (NOLOAD) : AT (DMA_ADC_ALT_CTEA) {
*(.dmaADCAltControlTableEntry)
} > REGION_DATA
UDMACC26XX_dmaGPT0AAltControlTableEntry_is_placed = 0;
.dmaGPT0AAltControlTableEntry DMA_GPT0A_ALT_CTEA : AT (DMA_GPT0A_ALT_CTEA) {
.dmaGPT0AAltControlTableEntry DMA_GPT0A_ALT_CTEA (NOLOAD) : AT (DMA_GPT0A_ALT_CTEA) {
*(.dmaGPT0AAltControlTableEntry)
} > REGION_DATA

View File

@ -14,7 +14,7 @@ CONTIKI_TARGET_SOURCEFILES += board-buttons.c als-sensor.c
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc2538
CONTIKI_CPU=$(ARCH_PATH)/cpu/cc2538
include $(CONTIKI_CPU)/Makefile.cc2538
MODULES += os/storage/cfs

View File

@ -11,7 +11,7 @@ BOARDS = srf06/cc26x0 srf06/cc13x0 launchpad/cc2640r2 launchpad/cc2650 launchpad
CONTIKI_TARGET_DIRS += .
### Include the board-specific makefile
PLATFORM_ROOT_DIR = $(CONTIKI)/arch/platform/$(TARGET)
PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET)
-include $(PLATFORM_ROOT_DIR)/$(BOARD)/Makefile.$(notdir $(BOARD))
CONTIKI_TARGET_SOURCEFILES += platform.c leds-arch.c
@ -25,5 +25,5 @@ SMALL ?= 0
### Define the CPU directory and pull in the correct CPU makefile. This will
### be defined by one of the makefiles included above and it can be either
### Makefile.cc26xx or Makefile.cc13xx
CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc26x0-cc13x0
CONTIKI_CPU=$(ARCH_PATH)/cpu/cc26x0-cc13x0
include $(CONTIKI_CPU)/Makefile.$(CPU_FAMILY)

View File

@ -41,7 +41,7 @@ JNILIB = $(BUILD_DIR_BOARD)/$(LIBNAME).$(TARGET)
CONTIKI_APP_OBJ = $(CONTIKI_APP).o
### COOJA platform sources
COOJA = $(CONTIKI)/arch/platform/$(TARGET)
COOJA = $(ARCH_PATH)/platform/$(TARGET)
CONTIKI_TARGET_DIRS = . dev lib sys cfs net
# (COOJA_SOURCEDIRS contains additional sources dirs set from simulator)
@ -67,7 +67,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
CLEAN += COOJA.log
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/x86
CONTIKI_CPU=$(ARCH_PATH)/cpu/x86
### Compiler arguments
#CC = gcc

View File

@ -28,5 +28,5 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
MAKE_MAC ?= MAKE_MAC_NULLMAC
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/native
include $(CONTIKI)/arch/cpu/native/Makefile.native
CONTIKI_CPU=$(ARCH_PATH)/cpu/native
include $(ARCH_PATH)/cpu/native/Makefile.native

View File

@ -3,7 +3,7 @@ ifndef CONTIKI
endif
### Include the board-specific makefile
PLATFORM_ROOT_DIR = $(CONTIKI)/arch/platform/$(TARGET)
PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET)
CONTIKI_TARGET_DIRS += . dev config
CONTIKI_SOURCEFILES += platform.c leds-arch.c nrf52dk-sensors.c button-sensor.c temperature-sensor.c
@ -21,5 +21,5 @@ endif
SMALL ?= 0
### Define the CPU directory and pull in the correct CPU makefile.
CONTIKI_CPU=$(CONTIKI)/arch/cpu/nrf52832
CONTIKI_CPU=$(ARCH_PATH)/cpu/nrf52832
include $(CONTIKI_CPU)/Makefile.nrf52832

View File

@ -11,7 +11,7 @@ endif
### Configure the build for the board and pull in board-specific sources
CONTIKI_TARGET_DIRS += . dev
PLATFORM_ROOT_DIR = $(CONTIKI)/arch/platform/$(TARGET)
PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET)
### Include
CONTIKI_TARGET_SOURCEFILES += platform.c board.c
@ -21,7 +21,7 @@ CONTIKI_TARGET_SOURCEFILES += antenna.c adxl346.c max44009.c sht21.c tps62730.c
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc2538
CONTIKI_CPU=$(ARCH_PATH)/cpu/cc2538
include $(CONTIKI_CPU)/Makefile.cc2538
MODULES += os/storage/cfs

View File

@ -51,7 +51,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
CPU_FAMILY = cc13xx-cc26xx
# Define the CPU directory and pull in the correct CPU Makefile
CONTIKI_CPU := $(realpath $(CONTIKI)/arch/cpu/simplelink-$(CPU_FAMILY))
CONTIKI_CPU := $(realpath $(ARCH_PATH)/cpu/simplelink-$(CPU_FAMILY))
include $(CONTIKI_CPU)/Makefile.$(CPU_FAMILY)
MODULES += os/net os/net/mac os/net/mac/framer

View File

@ -18,7 +18,7 @@ endif
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
MCU=msp430f1611
include $(CONTIKI)/arch/cpu/msp430/Makefile.msp430
include $(ARCH_PATH)/cpu/msp430/Makefile.msp430
ifdef IAR

View File

@ -4,6 +4,6 @@ CONTIKI_TARGET_SOURCEFILES += contiki-sky-platform.c \
sht11.c sht11-sensor.c light-sensor.c battery-sensor.c \
button-sensor.c
include $(CONTIKI)/arch/platform/sky/Makefile.common
include $(ARCH_PATH)/platform/sky/Makefile.common
MODULES += arch/dev/cc2420 arch/dev/sht11 arch/dev/ds2411 os/storage/cfs

View File

@ -25,7 +25,7 @@ CFLAGS += -DDATE="\"`date +"%02u %02d %02m %02y %02H %02M %02S"`\""
### Configure the build for the board and pull in board-specific sources
CONTIKI_TARGET_DIRS += . dev
CONTIKI_TARGET_DIRS += . $(BOARD)
PLATFORM_ROOT_DIR = $(CONTIKI)/arch/platform/$(TARGET)
PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET)
### Include the board dir if one exists
-include $(PLATFORM_ROOT_DIR)/$(BOARD)/Makefile.$(BOARD)
@ -39,7 +39,7 @@ CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES)
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc2538
CONTIKI_CPU=$(ARCH_PATH)/cpu/cc2538
include $(CONTIKI_CPU)/Makefile.cc2538
MODULES += arch/dev/cc1200 arch/dev/rgb-led os/storage/cfs

View File

@ -42,6 +42,8 @@
#include "contiki-net.h"
#include "services/deployment/deployment.h"
#include <inttypes.h>
/* Log configuration */
#include "sys/log.h"
#define LOG_MODULE "App"

View File

@ -70,6 +70,9 @@ def parseRPL(log):
if res:
# This was the last line, commit full topology
return {'event': 'topology' }
res = re.compile('initialized DAG').match(log)
if res:
return {'event': 'DAGinit' }
return None
def parseEnergest(log):
@ -123,6 +126,7 @@ def doParse(file):
"ranks": [],
"trickle": [],
"switches": [],
"DAGinits": [],
"topology": [],
}
@ -178,6 +182,8 @@ def doParse(file):
arrays["trickle"].append(entry)
elif(ret['event'] == 'switch'):
arrays["switches"].append(entry)
elif(ret['event'] == 'DAGinit'):
arrays["DAGinits"].append(entry)
elif(ret['event'] == 'sending'):
if not ret['message'] in arrays:
arrays[ret['message']] = []
@ -255,6 +261,7 @@ def main():
outputStats(dfs, "ranks", "rank", "mean", "RPL rank (ETX-128)")
outputStats(dfs, "switches", "pswitch", "count", "RPL parent switches (#)")
outputStats(dfs, "DAGinits", "event", "count", "RPL joining DAG (#)")
outputStats(dfs, "trickle", "trickle", "mean", "RPL Trickle period (min)")
outputStats(dfs, "DIS", "message", "count", "RPL DIS sent (#)", "rpl-dis")

View File

@ -34,6 +34,7 @@
* \author
* Joakim Eriksson, joakime@sics.se
* Niclas Finne, nfi@sics.se
* Carlos Gonzalo Peces, carlosgp143@gmail.com
*/
#include "contiki.h"
@ -51,18 +52,28 @@
#define DEBUG DEBUG_NONE
#include "net/ipv6/uip-debug.h"
/* Define this macro to non-zero to register via a bootstrap server */
#ifndef REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER
#define REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER 0
#endif
#ifndef REGISTER_WITH_LWM2M_SERVER
#define REGISTER_WITH_LWM2M_SERVER 1
#if REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER
#define SERVER_TYPE LWM2M_RD_CLIENT_BOOTSTRAP_SERVER
#else
#define SERVER_TYPE LWM2M_RD_CLIENT_LWM2M_SERVER
#endif
#ifndef LWM2M_SERVER_ADDRESS
#define LWM2M_SERVER_ADDRESS "coap://[fd00::1]"
#endif
static lwm2m_session_info_t session_info;
/* Define this macro to register with a second LWM2M server */
#ifdef LWM2M_SERVER_ADDRESS_SECOND
static lwm2m_session_info_t session_info_second;
#endif
#if BOARD_SENSORTAG
#include "board-peripherals.h"
@ -148,13 +159,17 @@ setup_lwm2m_servers(void)
coap_endpoint_t server_ep;
if(coap_endpoint_parse(LWM2M_SERVER_ADDRESS, strlen(LWM2M_SERVER_ADDRESS),
&server_ep) != 0) {
lwm2m_rd_client_register_with_bootstrap_server(&server_ep);
lwm2m_rd_client_register_with_server(&server_ep);
lwm2m_rd_client_register_with_server(&session_info, &server_ep, SERVER_TYPE);
}
#endif /* LWM2M_SERVER_ADDRESS */
lwm2m_rd_client_use_bootstrap_server(REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER);
lwm2m_rd_client_use_registration_server(REGISTER_WITH_LWM2M_SERVER);
#ifdef LWM2M_SERVER_ADDRESS_SECOND
coap_endpoint_t server_ep_second;
if(coap_endpoint_parse(LWM2M_SERVER_ADDRESS_SECOND, strlen(LWM2M_SERVER_ADDRESS_SECOND),
&server_ep_second) != 0) {
lwm2m_rd_client_register_with_server(&session_info_second, &server_ep_second, SERVER_TYPE);
}
#endif /* LWM2M_SERVER_ADDRESS_SECOND */
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(example_ipso_objects, ev, data)

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 2016, George Oikonomou - http://www.spd.gr
* 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.
*/
/*---------------------------------------------------------------------------*/
#ifndef CC2530_CC2531_IO_H_
#define CC2530_CC2531_IO_H_
/*---------------------------------------------------------------------------*/
#include "contiki.h"
#include "dev/io-arch.h"
/*---------------------------------------------------------------------------*/
#define sensniff_io_byte_out(b) io_arch_writeb(b)
#define sensniff_io_flush() io_arch_flush()
#define sensniff_io_set_input(f) io_arch_set_input(f)
/*---------------------------------------------------------------------------*/
#endif /* CC2530_CC2531_IO_H_ */
/*---------------------------------------------------------------------------*/

View File

@ -45,6 +45,7 @@
#include "net/mac/tsch/tsch.h"
#include <stdio.h>
#include <inttypes.h>
#if TSCH_ADAPTIVE_TIMESYNC

View File

@ -368,15 +368,16 @@ rpl_set_root(uint8_t instance_id, uip_ipaddr_t *dag_id)
if(uip_ipaddr_cmp(&dag->dag_id, dag_id)) {
version = dag->version;
RPL_LOLLIPOP_INCREMENT(version);
}
if(dag == dag->instance->current_dag) {
LOG_INFO("Dropping a joined DAG when setting this node as root\n");
rpl_set_default_route(instance, NULL);
dag->instance->current_dag = NULL;
} else {
LOG_INFO("Dropping a DAG when setting this node as root\n");
if(dag == dag->instance->current_dag) {
LOG_INFO("Dropping a joined DAG when setting this node as root\n");
rpl_set_default_route(instance, NULL);
dag->instance->current_dag = NULL;
} else {
LOG_INFO("Dropping a DAG when setting this node as root\n");
}
rpl_free_dag(dag);
}
rpl_free_dag(dag);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,13 @@
#ifndef LWM2M_RD_CLIENT_H_
#define LWM2M_RD_CLIENT_H_
/* The type of server to use for registration: bootstrap or LWM2M */
typedef enum {
LWM2M_RD_CLIENT_BOOTSTRAP_SERVER,
LWM2M_RD_CLIENT_LWM2M_SERVER
} lwm2m_rd_client_server_type_t;
/* Session callback states */
#define LWM2M_RD_CLIENT_BOOTSTRAPPED 1
#define LWM2M_RD_CLIENT_REGISTERED 2
#define LWM2M_RD_CLIENT_DEREGISTERED 3
@ -54,28 +61,70 @@
#include "lwm2m-object.h"
#include "lwm2m-queue-mode-conf.h"
#include "coap-endpoint.h"
#include "coap-callback-api.h"
struct lwm2m_session_info;
typedef void (*session_callback_t)(struct lwm2m_session_info *session, int status);
int lwm2m_rd_client_is_registered(void);
void lwm2m_rd_client_use_bootstrap_server(int use);
void lwm2m_rd_client_use_registration_server(int use);
void lwm2m_rd_client_register_with_server(const coap_endpoint_t *server);
void lwm2m_rd_client_register_with_bootstrap_server(const coap_endpoint_t *server);
uint16_t lwm2m_rd_client_get_lifetime(void);
void lwm2m_rd_client_set_lifetime(uint16_t lifetime);
#ifndef LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN
#define LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN 15
#endif /* LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN */
/*---------------------------------------------------------------------------*/
/*- Server session----------------------------*/
/*---------------------------------------------------------------------------*/
typedef struct lwm2m_session_info {
struct lwm2m_session_info *next;
/* Information */
const char *ep;
const char *binding;
char assigned_ep[LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN];
uint16_t lifetime;
coap_endpoint_t bs_server_ep;
coap_endpoint_t server_ep;
lwm2m_rd_client_server_type_t use_server_type;
uint8_t has_bs_server_info;
uint8_t has_registration_server_info;
uint8_t bootstrapped; /* bootstrap done */
session_callback_t callback;
/* CoAP Request */
coap_callback_request_state_t rd_request_state;
coap_message_t request[1]; /* This way the message can be treated as pointer as usual. */
/* RD parameters */
uint8_t rd_state;
uint8_t rd_flags;
uint64_t wait_until_network_check;
uint64_t last_update;
uint64_t last_rd_progress;
/* Blosk Transfer */
uint32_t rd_block1;
uint8_t rd_more;
void (*rd_callback)(coap_callback_request_state_t *state);
coap_timer_t block1_timer;
} lwm2m_session_info_t;
int lwm2m_rd_client_is_registered(lwm2m_session_info_t *session_info);
void lwm2m_rd_client_register_with_server(lwm2m_session_info_t *session_info, const coap_endpoint_t *server, lwm2m_rd_client_server_type_t server_type);
uint16_t lwm2m_rd_client_get_lifetime(lwm2m_session_info_t *session_info);
void lwm2m_rd_client_set_lifetime(lwm2m_session_info_t *session_info, uint16_t lifetime);
void lwm2m_rd_client_set_endpoint_name(lwm2m_session_info_t *session_info, const char *endpoint);
void lwm2m_rd_client_set_default_endpoint_name(const char *endpoint);
/* Indicate that something in the object list have changed */
void lwm2m_rd_client_set_update_rd(void);
/* Control if the object list should be automatically updated at updates of lifetime */
void lwm2m_rd_client_set_automatic_update(int update);
void lwm2m_rd_client_set_automatic_update(lwm2m_session_info_t *session_info, int update);
/* trigger an immediate update */
void lwm2m_rd_client_update_triggered(void);
void lwm2m_rd_client_update_triggered(const coap_endpoint_t *server_ep);
int lwm2m_rd_client_deregister(void);
int lwm2m_rd_client_deregister(lwm2m_session_info_t *session_info);
void lwm2m_rd_client_init(const char *ep);
void lwm2m_rd_client_set_session_callback(session_callback_t cb);
void lwm2m_rd_client_set_session_callback(lwm2m_session_info_t *session_info, session_callback_t cb);
#if LWM2M_QUEUE_MODE_ENABLED
uint8_t lwm2m_rd_client_is_client_awake(void);
@ -84,28 +133,5 @@ void lwm2m_rd_client_fsm_execute_queue_mode_awake();
void lwm2m_rd_client_fsm_execute_queue_mode_update();
#endif
#ifndef LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN
#define LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN 15
#endif /* LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN */
/*---------------------------------------------------------------------------*/
/*- Server session-*Currently single session only*---------------------------*/
/*---------------------------------------------------------------------------*/
struct lwm2m_session_info {
const char *ep;
const char *binding;
char assigned_ep[LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN];
uint16_t lifetime;
coap_endpoint_t bs_server_ep;
coap_endpoint_t server_ep;
uint8_t use_bootstrap;
uint8_t has_bs_server_info;
uint8_t use_registration;
uint8_t has_registration_server_info;
uint8_t registered;
uint8_t bootstrapped; /* bootstrap done */
session_callback_t callback;
};
#endif /* LWM2M_RD_CLIENT_H_ */
/** @} */

View File

@ -221,7 +221,7 @@ lwm2m_callback(lwm2m_object_instance_t *object,
} else if(ctx->operation == LWM2M_OP_EXECUTE) {
switch(ctx->resource_id) {
case LWM2M_SERVER_REG_UPDATE_TRIGGER_ID:
lwm2m_rd_client_update_triggered();
lwm2m_rd_client_update_triggered(ctx->request->src_ep);
break;
}
} else {

View File

@ -142,14 +142,20 @@ slip_config_handle_arguments(int argc, char **argv)
fprintf(stderr, " -a host Connect via TCP to server at <host>\n");
fprintf(stderr, " -p port Connect via TCP to server at <host>:<port>\n");
fprintf(stderr, " -t tundev Name of interface (default tun0)\n");
#ifdef __APPLE__
fprintf(stderr, " -v level Verbosity level\n");
#else
fprintf(stderr, " -v[level] Verbosity level\n");
#endif
fprintf(stderr, " -v0 No messages\n");
fprintf(stderr, " -v1 Encapsulated SLIP debug messages (default)\n");
fprintf(stderr, " -v2 Printable strings after they are received\n");
fprintf(stderr, " -v3 Printable strings and SLIP packet notifications\n");
fprintf(stderr, " -v4 All printable characters as they are received\n");
fprintf(stderr, " -v5 All SLIP packets in hex\n");
#ifndef __APPLE__
fprintf(stderr, " -v Equivalent to -v3\n");
#endif
fprintf(stderr, " -d[basedelay] Minimum delay between outgoing SLIP packets.\n");
fprintf(stderr, " Actual delay is basedelay*(#6LowPAN fragments) milliseconds.\n");
fprintf(stderr, " -d is equivalent to -d10.\n");

View File

@ -0,0 +1,294 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<project EXPORT="discard">[APPS_DIR]/mrm</project>
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
<project EXPORT="discard">[APPS_DIR]/avrora</project>
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
<simulation>
<title>My simulation</title>
<speedlimit>10.0</speedlimit>
<randomseed>123456</randomseed>
<motedelay_us>1000000</motedelay_us>
<radiomedium>
org.contikios.cooja.radiomediums.UDGM
<transmitting_range>50.0</transmitting_range>
<interference_range>100.0</interference_range>
<success_ratio_tx>1.0</success_ratio_tx>
<success_ratio_rx>1.0</success_ratio_rx>
</radiomedium>
<events>
<logoutput>40000</logoutput>
</events>
<motetype>
org.contikios.cooja.contikimote.ContikiMoteType
<identifier>mtype34</identifier>
<description>mote</description>
<source>[CONTIKI_DIR]/examples/libs/shell/example.c</source>
<commands>make example.cooja TARGET=cooja MAKE_ROUTING=MAKE_ROUTING_RPL_LITE -j</commands>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiEEPROM</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
<symbols>false</symbols>
</motetype>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>50.0</x>
<y>0.0</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>3</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.inter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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype34</motetype_identifier>
</mote>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>100.0</x>
<y>0.0</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>2</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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ikios.cooja.interfaces.Position
<x>150.0</x>
<y>0.0</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>1</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRS232
<history>ip-addr~;routes~;routing~;</history>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype34</motetype_identifier>
</mote>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>0.0</x>
<y>0.0</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>4</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype34</motetype_identifier>
</mote>
</simulation>
<plugin>
org.contikios.cooja.plugins.SimControl
<width>280</width>
<z>0</z>
<height>160</height>
<location_x>400</location_x>
<location_y>0</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.Visualizer
<plugin_config>
<moterelations>true</moterelations>
<skin>org.contikios.cooja.plugins.skins.IDVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.GridVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.TrafficVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin</skin>
<viewport>0.9090909090909091 0.0 0.0 0.9090909090909091 125.81818181818181 173.0</viewport>
</plugin_config>
<width>400</width>
<z>4</z>
<height>400</height>
<location_x>1</location_x>
<location_y>1</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.LogListener
<plugin_config>
<filter />
<formatted_time />
<coloring />
</plugin_config>
<width>604</width>
<z>3</z>
<height>784</height>
<location_x>400</location_x>
<location_y>160</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.Notes
<plugin_config>
<notes>Enter notes here</notes>
<decorations>true</decorations>
</plugin_config>
<width>944</width>
<z>1</z>
<height>160</height>
<location_x>680</location_x>
<location_y>0</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.ScriptRunner
<plugin_config>
<script>var last_msg = 0;
var root_id = 4;
var ip_addresses = [];
var rpl_done = 60000; // 1 minute - expected time for all motes to be part of rpl instance
function MY_GENERATE_MSG(wait, string)
{
last_msg += wait;
GENERATE_MSG(last_msg, string);
}
/* All motes starts from scratch */
MY_GENERATE_MSG(1000, "set root");
MY_GENERATE_MSG(rpl_done, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Root restarts and acts as root before rejoining existing rpl instance */
MY_GENERATE_MSG(1000, "remove root " + root_id);
MY_GENERATE_MSG(1000, "add root " + root_id);
MY_GENERATE_MSG(1000, "set root");
MY_GENERATE_MSG(rpl_done, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Set root 2nd time should be ignored */
MY_GENERATE_MSG(100, "set root");
MY_GENERATE_MSG(1000, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Root restarts and rejoins existing rpl instance */
MY_GENERATE_MSG(1000, "remove root " + root_id);
MY_GENERATE_MSG(1000, "add root " + root_id);
MY_GENERATE_MSG(rpl_done, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Root starts acting as root again */
MY_GENERATE_MSG(1000, "set root");
MY_GENERATE_MSG(rpl_done, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Sink test */
/* End test */
MY_GENERATE_MSG(1000, "end test");
while(true) {
YIELD();
if(msg.equals("set root")) {
m = sim.getMoteWithID(root_id);
write(m, "rpl-set-root 1");
log.log("root set\n");
} else if(msg.contains("get ip addresses")) {
var motes = sim.getMotes();
for(var i in motes) {
write(motes[i], "ip-addr");
}
} else if(msg.contains("-- fd00::20")) {
ip_addresses.push(msg);
} else if(msg.startsWith("check ip addresses")) {
var motes = sim.getMotes();
var motes_found = [];
for(var i in motes) {
var ip_address = "fd00::" + (motes[i].getID() + 200);
for(var j in ip_addresses) {
if(ip_addresses[j].contains(ip_address)) {
motes_found.push(motes[i].getID());
break;
}
}
}
if(motes.length == motes_found.length) {
log.log("all motes are in rpl\n");
} else {
log.log("some motes is missing, found:\n" + motes_found + "\n");
if(!msg.contains("skip fail")) {
log.testFailed(); /* Report test failure and quit */
}
}
ip_addresses = [];
} else if(msg.startsWith("remove root")) {
//TODO: Use id from generated msg
m = sim.getMoteWithID(root_id);
sim.removeMote(m);
log.log("root removed\n");
//TODO: Save type and position, so it can be used in add
} else if(msg.startsWith("add root")) {
//TODO: Use id from generated msg
//TODO: Use saved type and position
m = sim.getMoteTypes()[0].generateMote(sim);
m.getInterfaces().getMoteID().setMoteID(root_id);
sim.addMote(m);
log.log("root added\n");
} else if(msg.equals("end test")) {
break;
}
}
log.testOK(); /* Report test success and quit */</script>
<active>true</active>
</plugin_config>
<width>617</width>
<z>2</z>
<height>785</height>
<location_x>1007</location_x>
<location_y>160</location_y>
</plugin>
</simconf>

View File

@ -0,0 +1,294 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<project EXPORT="discard">[APPS_DIR]/mrm</project>
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
<project EXPORT="discard">[APPS_DIR]/avrora</project>
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
<simulation>
<title>My simulation</title>
<speedlimit>10.0</speedlimit>
<randomseed>123456</randomseed>
<motedelay_us>1000000</motedelay_us>
<radiomedium>
org.contikios.cooja.radiomediums.UDGM
<transmitting_range>50.0</transmitting_range>
<interference_range>100.0</interference_range>
<success_ratio_tx>1.0</success_ratio_tx>
<success_ratio_rx>1.0</success_ratio_rx>
</radiomedium>
<events>
<logoutput>40000</logoutput>
</events>
<motetype>
org.contikios.cooja.contikimote.ContikiMoteType
<identifier>mtype512</identifier>
<description>mote</description>
<source>[CONTIKI_DIR]/examples/libs/shell/example.c</source>
<commands>make example.cooja TARGET=cooja MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC -j</commands>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
<moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiEEPROM</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
<symbols>false</symbols>
</motetype>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>50.0</x>
<y>0.0</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>3</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype512</motetype_identifier>
</mote>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>100.0</x>
<y>0.0</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>2</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype512</motetype_identifier>
</mote>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>150.0</x>
<y>0.0</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>1</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRS232
<history>ip-addr~;routes~;routing~;</history>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</eeprom>
</interface_config>
<motetype_identifier>mtype512</motetype_identifier>
</mote>
<mote>
<interface_config>
org.contikios.cooja.interfaces.Position
<x>0.0</x>
<y>0.0</y>
<z>0.0</z>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiMoteID
<id>4</id>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<interface_config>
org.contikios.cooja.contikimote.interfaces.ContikiEEPROM
<eeprom>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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</width>
<z>0</z>
<height>160</height>
<location_x>400</location_x>
<location_y>0</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.Visualizer
<plugin_config>
<moterelations>true</moterelations>
<skin>org.contikios.cooja.plugins.skins.IDVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.GridVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.TrafficVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<skin>org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin</skin>
<viewport>0.9090909090909091 0.0 0.0 0.9090909090909091 125.81818181818181 173.0</viewport>
</plugin_config>
<width>400</width>
<z>4</z>
<height>400</height>
<location_x>1</location_x>
<location_y>1</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.LogListener
<plugin_config>
<filter />
<formatted_time />
<coloring />
</plugin_config>
<width>604</width>
<z>3</z>
<height>784</height>
<location_x>400</location_x>
<location_y>160</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.Notes
<plugin_config>
<notes>Enter notes here</notes>
<decorations>true</decorations>
</plugin_config>
<width>944</width>
<z>1</z>
<height>160</height>
<location_x>680</location_x>
<location_y>0</location_y>
</plugin>
<plugin>
org.contikios.cooja.plugins.ScriptRunner
<plugin_config>
<script>var last_msg = 0;
var root_id = 4;
var ip_addresses = [];
var rpl_done = 60000; // 1 minute - expected time for all motes to be part of rpl instance
function MY_GENERATE_MSG(wait, string)
{
last_msg += wait;
GENERATE_MSG(last_msg, string);
}
/* All motes starts from scratch */
MY_GENERATE_MSG(1000, "set root");
MY_GENERATE_MSG(rpl_done, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Root restarts and acts as root before rejoining existing rpl instance */
MY_GENERATE_MSG(1000, "remove root " + root_id);
MY_GENERATE_MSG(1000, "add root " + root_id);
MY_GENERATE_MSG(1000, "set root");
MY_GENERATE_MSG(rpl_done, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Set root 2nd time should be ignored */
MY_GENERATE_MSG(100, "set root");
MY_GENERATE_MSG(1000, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Root restarts and rejoins existing rpl instance */
MY_GENERATE_MSG(1000, "remove root " + root_id);
MY_GENERATE_MSG(1000, "add root " + root_id);
MY_GENERATE_MSG(rpl_done, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Root starts acting as root again */
MY_GENERATE_MSG(1000, "set root");
MY_GENERATE_MSG(rpl_done, "get ip addresses");
MY_GENERATE_MSG(1000, "check ip addresses");
/* Sink test */
/* End test */
MY_GENERATE_MSG(1000, "end test");
while(true) {
YIELD();
if(msg.equals("set root")) {
m = sim.getMoteWithID(root_id);
write(m, "rpl-set-root 1");
log.log("root set\n");
} else if(msg.contains("get ip addresses")) {
var motes = sim.getMotes();
for(var i in motes) {
write(motes[i], "ip-addr");
}
} else if(msg.contains("-- fd00::20")) {
ip_addresses.push(msg);
} else if(msg.startsWith("check ip addresses")) {
var motes = sim.getMotes();
var motes_found = [];
for(var i in motes) {
var ip_address = "fd00::" + (motes[i].getID() + 200);
for(var j in ip_addresses) {
if(ip_addresses[j].contains(ip_address)) {
motes_found.push(motes[i].getID());
break;
}
}
}
if(motes.length == motes_found.length) {
log.log("all motes are in rpl\n");
} else {
log.log("some motes is missing, found:\n" + motes_found + "\n");
if(!msg.contains("skip fail")) {
log.testFailed(); /* Report test failure and quit */
}
}
ip_addresses = [];
} else if(msg.startsWith("remove root")) {
//TODO: Use id from generated msg
m = sim.getMoteWithID(root_id);
sim.removeMote(m);
log.log("root removed\n");
//TODO: Save type and position, so it can be used in add
} else if(msg.startsWith("add root")) {
//TODO: Use id from generated msg
//TODO: Use saved type and position
m = sim.getMoteTypes()[0].generateMote(sim);
m.getInterfaces().getMoteID().setMoteID(root_id);
sim.addMote(m);
log.log("root added\n");
} else if(msg.equals("end test")) {
break;
}
}
log.testOK(); /* Report test success and quit */</script>
<active>true</active>
</plugin_config>
<width>617</width>
<z>2</z>
<height>785</height>
<location_x>1007</location_x>
<location_y>160</location_y>
</plugin>
</simconf>

@ -1 +1 @@
Subproject commit 67b858437f7cf1e4e027d821c4c2ac15fdf2ab44
Subproject commit 3b23ca8d6a19d281b6330d3f24afc2e1bb14ddb7

View File

@ -856,14 +856,20 @@ fprintf(stderr," -s siodev Serial device (default /dev/ttyUSB0)\n");
fprintf(stderr," -M Interface MTU (default and min: 1280)\n");
fprintf(stderr," -T Make tap interface (default is tun interface)\n");
fprintf(stderr," -t tundev Name of interface (default tap0 or tun0)\n");
#ifdef __APPLE__
fprintf(stderr," -v level Verbosity level\n");
#else
fprintf(stderr," -v[level] Verbosity level\n");
#endif
fprintf(stderr," -v0 No messages\n");
fprintf(stderr," -v1 Encapsulated SLIP debug messages (default)\n");
fprintf(stderr," -v2 Printable strings after they are received\n");
fprintf(stderr," -v3 Printable strings and SLIP packet notifications\n");
fprintf(stderr," -v4 All printable characters as they are received\n");
fprintf(stderr," -v5 All SLIP packets in hex\n");
#ifndef __APPLE__
fprintf(stderr," -v Equivalent to -v3\n");
#endif
fprintf(stderr," -d[basedelay] Minimum delay between outgoing SLIP packets.\n");
fprintf(stderr," Actual delay is basedelay*(#6LowPAN fragments) milliseconds.\n");
fprintf(stderr," -d is equivalent to -d10.\n");