diff --git a/Makefile.include b/Makefile.include index 672c7f4c1..2e5a31d1a 100644 --- a/Makefile.include +++ b/Makefile.include @@ -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 diff --git a/arch/cpu/arm/cortex-m/Makefile.cortex-m b/arch/cpu/arm/cortex-m/Makefile.cortex-m index 0ca1d54ff..3f14ead41 100644 --- a/arch/cpu/arm/cortex-m/Makefile.cortex-m +++ b/arch/cpu/arm/cortex-m/Makefile.cortex-m @@ -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 diff --git a/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 b/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 index b4bf612da..35051a0f7 100644 --- a/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 +++ b/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 @@ -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 diff --git a/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 b/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 index 7443681ea..dc470601f 100644 --- a/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 +++ b/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 @@ -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 diff --git a/arch/cpu/cc2538/Makefile.cc2538 b/arch/cpu/cc2538/Makefile.cc2538 index 51a5c40c7..85f435320 100644 --- a/arch/cpu/cc2538/Makefile.cc2538 +++ b/arch/cpu/cc2538/Makefile.cc2538 @@ -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 diff --git a/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 b/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 index c7fb7b95e..c0fb8eeed 100644 --- a/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 +++ b/arch/cpu/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 @@ -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) diff --git a/arch/cpu/msp430/Makefile.msp430 b/arch/cpu/msp430/Makefile.msp430 index 841e11285..7927002b6 100644 --- a/arch/cpu/msp430/Makefile.msp430 +++ b/arch/cpu/msp430/Makefile.msp430 @@ -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 diff --git a/arch/cpu/nrf52832/Makefile.nrf52832 b/arch/cpu/nrf52832/Makefile.nrf52832 index 098033ce4..c72fa6f5f 100644 --- a/arch/cpu/nrf52832/Makefile.nrf52832 +++ b/arch/cpu/nrf52832/Makefile.nrf52832 @@ -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 diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/Makefile.cc13xx-cc26xx b/arch/cpu/simplelink-cc13xx-cc26xx/Makefile.cc13xx-cc26xx index 263c92b1b..bb7bf82f5 100644 --- a/arch/cpu/simplelink-cc13xx-cc26xx/Makefile.cc13xx-cc26xx +++ b/arch/cpu/simplelink-cc13xx-cc26xx/Makefile.cc13xx-cc26xx @@ -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 diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/Makefile.cc13x0-cc26x0 b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/Makefile.cc13x0-cc26x0 index 9aa7c5be2..9be4ad6ab 100644 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/Makefile.cc13x0-cc26x0 +++ b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/Makefile.cc13x0-cc26x0 @@ -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 diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.lds b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.lds index 26930dea8..2bc8ec8cc 100644 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.lds +++ b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x0-cc26x0/cc13x0-cc26x0.lds @@ -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 diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/Makefile.cc13x2-cc26x2 b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/Makefile.cc13x2-cc26x2 index 52333f47d..afe0ae429 100644 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/Makefile.cc13x2-cc26x2 +++ b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/Makefile.cc13x2-cc26x2 @@ -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 diff --git a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.lds b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.lds index 9c2211cb8..dc1a608be 100644 --- a/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.lds +++ b/arch/cpu/simplelink-cc13xx-cc26xx/cc13x2-cc26x2/cc13x2-cc26x2.lds @@ -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 diff --git a/arch/platform/cc2538dk/Makefile.cc2538dk b/arch/platform/cc2538dk/Makefile.cc2538dk index 148c6e837..bdbc7598f 100644 --- a/arch/platform/cc2538dk/Makefile.cc2538dk +++ b/arch/platform/cc2538dk/Makefile.cc2538dk @@ -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 diff --git a/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 b/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 index 43cc7ea3f..622445dd4 100644 --- a/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 +++ b/arch/platform/cc26x0-cc13x0/Makefile.cc26x0-cc13x0 @@ -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) diff --git a/arch/platform/cooja/Makefile.cooja b/arch/platform/cooja/Makefile.cooja index 6a6a9d49e..6fdb6f0ca 100644 --- a/arch/platform/cooja/Makefile.cooja +++ b/arch/platform/cooja/Makefile.cooja @@ -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 diff --git a/arch/platform/native/Makefile.native b/arch/platform/native/Makefile.native index afeddd22f..51681284e 100644 --- a/arch/platform/native/Makefile.native +++ b/arch/platform/native/Makefile.native @@ -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 diff --git a/arch/platform/nrf52dk/Makefile.nrf52dk b/arch/platform/nrf52dk/Makefile.nrf52dk index e1d56c090..ff554b35c 100644 --- a/arch/platform/nrf52dk/Makefile.nrf52dk +++ b/arch/platform/nrf52dk/Makefile.nrf52dk @@ -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 diff --git a/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 b/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 index 8b25b0bfe..f720a9ae8 100644 --- a/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 +++ b/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 @@ -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 diff --git a/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx b/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx index 9f2dbe45b..39a3fc504 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx +++ b/arch/platform/simplelink/cc13xx-cc26xx/Makefile.cc13xx-cc26xx @@ -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 diff --git a/arch/platform/sky/Makefile.common b/arch/platform/sky/Makefile.common index 5018da3da..b72f92ed8 100644 --- a/arch/platform/sky/Makefile.common +++ b/arch/platform/sky/Makefile.common @@ -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 diff --git a/arch/platform/sky/Makefile.sky b/arch/platform/sky/Makefile.sky index 0398486b0..ec2324085 100644 --- a/arch/platform/sky/Makefile.sky +++ b/arch/platform/sky/Makefile.sky @@ -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 diff --git a/arch/platform/zoul/Makefile.zoul b/arch/platform/zoul/Makefile.zoul index e43f84744..e65290b42 100644 --- a/arch/platform/zoul/Makefile.zoul +++ b/arch/platform/zoul/Makefile.zoul @@ -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 diff --git a/examples/benchmarks/rpl-req-resp/node.c b/examples/benchmarks/rpl-req-resp/node.c index 4b92415f9..bc7552797 100644 --- a/examples/benchmarks/rpl-req-resp/node.c +++ b/examples/benchmarks/rpl-req-resp/node.c @@ -42,6 +42,8 @@ #include "contiki-net.h" #include "services/deployment/deployment.h" +#include + /* Log configuration */ #include "sys/log.h" #define LOG_MODULE "App" diff --git a/examples/benchmarks/rpl-req-resp/parse.py b/examples/benchmarks/rpl-req-resp/parse.py index a15b9c49b..dd36ef4c9 100644 --- a/examples/benchmarks/rpl-req-resp/parse.py +++ b/examples/benchmarks/rpl-req-resp/parse.py @@ -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") diff --git a/examples/lwm2m-ipso-objects/example-ipso-objects.c b/examples/lwm2m-ipso-objects/example-ipso-objects.c index 51bd84040..60ca4bdb9 100644 --- a/examples/lwm2m-ipso-objects/example-ipso-objects.c +++ b/examples/lwm2m-ipso-objects/example-ipso-objects.c @@ -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) diff --git a/examples/sensniff/pool/cc2530-cc2531-io.h b/examples/sensniff/pool/cc2530-cc2531-io.h deleted file mode 100644 index cfed98f1d..000000000 --- a/examples/sensniff/pool/cc2530-cc2531-io.h +++ /dev/null @@ -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_ */ -/*---------------------------------------------------------------------------*/ diff --git a/os/net/mac/tsch/tsch-adaptive-timesync.c b/os/net/mac/tsch/tsch-adaptive-timesync.c index cf10e9cf1..2745abca2 100644 --- a/os/net/mac/tsch/tsch-adaptive-timesync.c +++ b/os/net/mac/tsch/tsch-adaptive-timesync.c @@ -45,6 +45,7 @@ #include "net/mac/tsch/tsch.h" #include +#include #if TSCH_ADAPTIVE_TIMESYNC diff --git a/os/net/routing/rpl-classic/rpl-dag.c b/os/net/routing/rpl-classic/rpl-dag.c index 58f758048..83a85792b 100644 --- a/os/net/routing/rpl-classic/rpl-dag.c +++ b/os/net/routing/rpl-classic/rpl-dag.c @@ -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); } } } diff --git a/os/services/lwm2m/lwm2m-rd-client.c b/os/services/lwm2m/lwm2m-rd-client.c index 4b4b11528..6bb58f91a 100644 --- a/os/services/lwm2m/lwm2m-rd-client.c +++ b/os/services/lwm2m/lwm2m-rd-client.c @@ -54,6 +54,7 @@ #include "coap-endpoint.h" #include "coap-callback-api.h" #include "lwm2m-security.h" +#include "lib/list.h" #include #include #include @@ -76,18 +77,11 @@ #define LWM2M_DEFAULT_CLIENT_LIFETIME 30 /* sec */ #endif -#define MAX_RD_UPDATE_WAIT 5000 - #define REMOTE_PORT UIP_HTONS(COAP_DEFAULT_PORT) #define BS_REMOTE_PORT UIP_HTONS(5685) #define STATE_MACHINE_UPDATE_INTERVAL 500 -static struct lwm2m_session_info session_info; -static coap_callback_request_state_t rd_request_state; - -static coap_message_t request[1]; /* This way the message can be treated as pointer as usual. */ - /* The states for the RD client state machine */ /* When node is unregistered it ends up in UNREGISTERED and this is going to be there until use X or Y kicks it @@ -114,38 +108,32 @@ static coap_message_t request[1]; /* This way the message can be treated as #define FLAG_RD_DATA_UPDATE_TRIGGERED 0x02 #define FLAG_RD_DATA_UPDATE_ON_DIRTY 0x10 -static uint8_t rd_state = 0; -static uint8_t rd_flags = FLAG_RD_DATA_UPDATE_ON_DIRTY; -static uint64_t wait_until_network_check = 0; -static uint64_t last_update; +LIST(session_info_list); +/* Shared by all sessions, used by only one at a time in the FSM */ static char query_data[64]; /* allocate some data for queries and updates */ static uint8_t rd_data[128]; /* allocate some data for the RD */ -static uint32_t rd_block1; -static uint8_t rd_more; -static coap_timer_t rd_timer; -static void (*rd_callback)(coap_callback_request_state_t *callback_state); - -static coap_timer_t block1_timer; +static coap_timer_t rd_timer; /* Timer to tick the FSM periodically */ +static char default_ep[20]; #if LWM2M_QUEUE_MODE_ENABLED -static coap_timer_t queue_mode_client_awake_timer; /* Timer to control the client's - * awake time - */ -static uint8_t queue_mode_client_awake; /* 1 - client is awake, - * 0 - client is sleeping - */ +static coap_timer_t queue_mode_client_awake_timer; /* Timer to control the client's + * awake time + */ +static uint8_t queue_mode_client_awake; /* 1 - client is awake, + * 0 - client is sleeping + */ static uint16_t queue_mode_client_awake_time; /* The time to be awake */ /* Callback for the client awake timer */ -static void queue_mode_awake_timer_callback(coap_timer_t *timer); +static void queue_mode_awake_timer_callback(coap_timer_t *timer); #endif static void check_periodic_observations(); static void update_callback(coap_callback_request_state_t *callback_state); - +/*---------------------------------------------------------------------------*/ static int -set_rd_data(coap_message_t *request) +set_rd_data(lwm2m_session_info_t *session_info) { lwm2m_buffer_t outbuf; @@ -155,31 +143,31 @@ set_rd_data(coap_message_t *request) outbuf.len = 0; /* this will also set the request payload */ - rd_more = lwm2m_engine_set_rd_data(&outbuf, 0); - coap_set_payload(request, rd_data, outbuf.len); + session_info->rd_more = lwm2m_engine_set_rd_data(&outbuf, 0); + coap_set_payload(session_info->request, rd_data, outbuf.len); - if(rd_more) { + if(session_info->rd_more) { /* set the first block here */ LOG_DBG("Setting block1 in request\n"); - coap_set_header_block1(request, 0, 1, sizeof(rd_data)); + coap_set_header_block1(session_info->request, 0, 1, sizeof(rd_data)); } return outbuf.len; } /*---------------------------------------------------------------------------*/ static void -prepare_update(coap_message_t *request, int triggered) +prepare_update(lwm2m_session_info_t *session_info, int triggered) { - coap_init_message(request, COAP_TYPE_CON, COAP_POST, 0); - coap_set_header_uri_path(request, session_info.assigned_ep); + coap_init_message(session_info->request, COAP_TYPE_CON, COAP_POST, 0); + coap_set_header_uri_path(session_info->request, session_info->assigned_ep); - snprintf(query_data, sizeof(query_data) - 1, "?lt=%d&b=%s", session_info.lifetime, session_info.binding); - LOG_DBG("UPDATE:%s %s\n", session_info.assigned_ep, query_data); - coap_set_header_uri_query(request, query_data); + snprintf(query_data, sizeof(query_data) - 1, "?lt=%d&b=%s", session_info->lifetime, session_info->binding); + LOG_DBG("UPDATE:%s %s\n", session_info->assigned_ep, query_data); + coap_set_header_uri_query(session_info->request, query_data); - if((triggered || rd_flags & FLAG_RD_DATA_UPDATE_ON_DIRTY) && (rd_flags & FLAG_RD_DATA_DIRTY)) { - rd_flags &= ~FLAG_RD_DATA_DIRTY; - set_rd_data(request); - rd_callback = update_callback; + if((triggered || session_info->rd_flags & FLAG_RD_DATA_UPDATE_ON_DIRTY) && (session_info->rd_flags & FLAG_RD_DATA_DIRTY)) { + session_info->rd_flags &= ~FLAG_RD_DATA_DIRTY; + set_rd_data(session_info); + session_info->rd_callback = update_callback; } } /*---------------------------------------------------------------------------*/ @@ -198,164 +186,152 @@ has_network_access(void) } /*---------------------------------------------------------------------------*/ int -lwm2m_rd_client_is_registered(void) +lwm2m_rd_client_is_registered(lwm2m_session_info_t *session_info) { - return rd_state == REGISTRATION_DONE || rd_state == UPDATE_SENT; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_use_bootstrap_server(int use) -{ - session_info.use_bootstrap = use != 0; - if(session_info.use_bootstrap) { - rd_state = INIT; - } + return session_info->rd_state == REGISTRATION_DONE || session_info->rd_state == UPDATE_SENT; } /*---------------------------------------------------------------------------*/ /* will take another argument when we support multiple sessions */ void -lwm2m_rd_client_set_session_callback(session_callback_t cb) +lwm2m_rd_client_set_session_callback(lwm2m_session_info_t *session_info, session_callback_t cb) { - session_info.callback = cb; + session_info->callback = cb; } /*---------------------------------------------------------------------------*/ static void -perform_session_callback(int state) +perform_session_callback(lwm2m_session_info_t *session_info, int state) { - if(session_info.callback != NULL) { + if(session_info->callback != NULL) { LOG_DBG("Performing session callback: %d cb:%p\n", - state, session_info.callback); - session_info.callback(&session_info, state); - } -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_use_registration_server(int use) -{ - session_info.use_registration = use != 0; - if(session_info.use_registration) { - rd_state = INIT; + state, session_info->callback); + session_info->callback(session_info, state); } } /*---------------------------------------------------------------------------*/ uint16_t -lwm2m_rd_client_get_lifetime(void) +lwm2m_rd_client_get_lifetime(lwm2m_session_info_t *session_info) { - return session_info.lifetime; + return session_info->lifetime; } /*---------------------------------------------------------------------------*/ void -lwm2m_rd_client_set_lifetime(uint16_t lifetime) +lwm2m_rd_client_set_lifetime(lwm2m_session_info_t *session_info, uint16_t lifetime) { if(lifetime > 0) { - session_info.lifetime = lifetime; + session_info->lifetime = lifetime; } else { - session_info.lifetime = LWM2M_DEFAULT_CLIENT_LIFETIME; + session_info->lifetime = LWM2M_DEFAULT_CLIENT_LIFETIME; } } /*---------------------------------------------------------------------------*/ void +lwm2m_rd_client_set_endpoint_name(lwm2m_session_info_t *session_info, const char *endpoint) +{ + if(endpoint != NULL) { + session_info->ep = endpoint; + } +} +/*---------------------------------------------------------------------------*/ +void +lwm2m_rd_client_set_default_endpoint_name(const char *endpoint) +{ + strncpy(default_ep, endpoint, sizeof(default_ep) - 1); + default_ep[sizeof(default_ep) - 1] = '\0'; +} +/*---------------------------------------------------------------------------*/ +void lwm2m_rd_client_set_update_rd(void) { - rd_flags |= FLAG_RD_DATA_DIRTY; + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); + while(session_info != NULL) { + session_info->rd_flags |= FLAG_RD_DATA_DIRTY; + session_info = session_info->next; + } } /*---------------------------------------------------------------------------*/ void -lwm2m_rd_client_set_automatic_update(int update) +lwm2m_rd_client_set_automatic_update(lwm2m_session_info_t *session_info, int update) { - rd_flags = (rd_flags & ~FLAG_RD_DATA_UPDATE_ON_DIRTY) | + session_info->rd_flags = (session_info->rd_flags & ~FLAG_RD_DATA_UPDATE_ON_DIRTY) | (update != 0 ? FLAG_RD_DATA_UPDATE_ON_DIRTY : 0); } /*---------------------------------------------------------------------------*/ void -lwm2m_rd_client_register_with_server(const coap_endpoint_t *server) +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) { - coap_endpoint_copy(&session_info.server_ep, server); - session_info.has_registration_server_info = 1; - session_info.registered = 0; - if(session_info.use_registration) { - rd_state = INIT; + if(session_info->ep == NULL) { + session_info->ep = default_ep; } -} -/*---------------------------------------------------------------------------*/ -static int -update_registration_server(void) -{ - if(session_info.has_registration_server_info) { - return 1; + /* default binding U = UDP, UQ = UDP Q-mode*/ +#if LWM2M_QUEUE_MODE_CONF_ENABLED + session_info->binding = "UQ"; + /* Enough margin to ensure that the client is not unregistered (we + * do not know the time it can stay awake) + */ + session_info->lifetime = (LWM2M_QUEUE_MODE_DEFAULT_CLIENT_SLEEP_TIME / 1000) * 2; +#else + session_info->binding = "U"; + if(session_info->lifetime == 0) { + session_info->lifetime = LWM2M_DEFAULT_CLIENT_LIFETIME; + } +#endif /* LWM2M_QUEUE_MODE_CONF_ENABLED */ + + session_info->rd_flags = FLAG_RD_DATA_UPDATE_ON_DIRTY; + session_info->has_bs_server_info = 0; + session_info->has_registration_server_info = 0; + session_info->wait_until_network_check = 0; + session_info->last_update = 0; + session_info->last_rd_progress = 0; + session_info->bootstrapped = 0; + session_info->rd_state = INIT; + + if(server_type == LWM2M_RD_CLIENT_BOOTSTRAP_SERVER) { + coap_endpoint_copy(&session_info->bs_server_ep, server); + session_info->has_bs_server_info = 1; + session_info->use_server_type = LWM2M_RD_CLIENT_BOOTSTRAP_SERVER; + } else { + coap_endpoint_copy(&session_info->server_ep, server); + session_info->use_server_type = LWM2M_RD_CLIENT_LWM2M_SERVER; + session_info->has_registration_server_info = 1; } -#if UIP_CONF_IPV6_RPL - { - rpl_dag_t *dag; - - /* Use the DAG id as server address if no other has been specified */ - dag = rpl_get_any_dag(); - if(dag != NULL) { - /* create coap-endpoint? */ - /* uip_ipaddr_copy(&server_ipaddr, &dag->dag_id); */ - /* server_port = REMOTE_PORT; */ - return 1; - } - } -#endif /* UIP_CONF_IPV6_RPL */ - - return 0; -} -/*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_register_with_bootstrap_server(const coap_endpoint_t *server) -{ - coap_endpoint_copy(&session_info.bs_server_ep, server); - session_info.has_bs_server_info = 1; - session_info.bootstrapped = 0; - session_info.registered = 0; - if(session_info.use_bootstrap) { - rd_state = INIT; - } + list_add(session_info_list, session_info); /* Add to the list of sessions */ } /*---------------------------------------------------------------------------*/ int -lwm2m_rd_client_deregister(void) +lwm2m_rd_client_deregister(lwm2m_session_info_t *session_info) { - if(lwm2m_rd_client_is_registered()) { - rd_state = DEREGISTER; + if(lwm2m_rd_client_is_registered(session_info)) { + session_info->rd_state = DEREGISTER; return 1; } /* Not registered */ return 0; } /*---------------------------------------------------------------------------*/ -void -lwm2m_rd_client_update_triggered(void) +static lwm2m_session_info_t * +get_session_info_from_server_ep(const coap_endpoint_t *server_ep) { - rd_flags |= FLAG_RD_DATA_UPDATE_TRIGGERED; - /* Here we need to do an CoAP timer poll - to get a quick request transmission! */ + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); + while(session_info != NULL) { + if(coap_endpoint_cmp(&session_info->server_ep, server_ep)) { + return session_info; + } + session_info = session_info->next; + } + return NULL; } /*---------------------------------------------------------------------------*/ -static int -update_bootstrap_server(void) +void +lwm2m_rd_client_update_triggered(const coap_endpoint_t *server_ep) { - if(session_info.has_bs_server_info) { - return 1; + lwm2m_session_info_t *session_info = get_session_info_from_server_ep(server_ep); + if(session_info) { + session_info->rd_flags |= FLAG_RD_DATA_UPDATE_TRIGGERED; } - -#if UIP_CONF_IPV6_RPL - { - rpl_dag_t *dag; - - /* Use the DAG id as server address if no other has been specified */ - dag = rpl_get_any_dag(); - if(dag != NULL) { - /* create coap endpoint */ - /* uip_ipaddr_copy(&bs_server_ipaddr, &dag->dag_id); */ - /* bs_server_port = REMOTE_PORT; */ - return 1; - } - } -#endif /* UIP_CONF_IPV6_RPL */ - - return 0; + /* Here we need to do an CoAP timer poll - to get a quick request transmission! */ } /*---------------------------------------------------------------------------*/ /* @@ -373,29 +349,32 @@ bootstrap_callback(coap_callback_request_state_t *callback_state) { coap_request_state_t *state = &callback_state->state; LOG_DBG("Bootstrap callback Response: %d, ", state->response != NULL); + + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)state->user_data; + if(state->status == COAP_REQUEST_STATUS_RESPONSE) { if(CHANGED_2_04 == state->response->code) { LOG_DBG_("Considered done!\n"); - rd_state = BOOTSTRAP_DONE; + session_info->rd_state = BOOTSTRAP_DONE; return; } /* Possible error response codes are 4.00 Bad request & 4.15 Unsupported content format */ LOG_DBG_("Failed with code %d. Retrying\n", state->response->code); /* TODO Application callback? */ - rd_state = INIT; - } else if(state->status == COAP_REQUEST_STATUS_TIMEOUT) { + session_info->rd_state = INIT; + } else if(state->status == COAP_REQUEST_STATUS_TIMEOUT) { LOG_DBG_("Server not responding! Retry?"); - rd_state = DO_BOOTSTRAP; + session_info->rd_state = DO_BOOTSTRAP; } else if(state->status == COAP_REQUEST_STATUS_FINISHED) { LOG_DBG_("Request finished. Ignore\n"); } else { LOG_DBG_("Unexpected error! Retry?"); - rd_state = DO_BOOTSTRAP; + session_info->rd_state = DO_BOOTSTRAP; } } /*---------------------------------------------------------------------------*/ static void -produce_more_rd(void) +produce_more_rd(lwm2m_session_info_t *session_info) { lwm2m_buffer_t outbuf; @@ -406,23 +385,23 @@ produce_more_rd(void) outbuf.size = sizeof(rd_data); outbuf.len = 0; - rd_block1++; + session_info->rd_block1++; /* this will also set the request payload */ - rd_more = lwm2m_engine_set_rd_data(&outbuf, rd_block1); - coap_set_payload(request, rd_data, outbuf.len); + session_info->rd_more = lwm2m_engine_set_rd_data(&outbuf, session_info->rd_block1); + coap_set_payload(session_info->request, rd_data, outbuf.len); LOG_DBG("Setting block1 in request - block: %d more: %d\n", - (int)rd_block1, (int)rd_more); - coap_set_header_block1(request, rd_block1, rd_more, sizeof(rd_data)); + (int)session_info->rd_block1, (int)session_info->rd_more); + coap_set_header_block1(session_info->request, session_info->rd_block1, session_info->rd_more, sizeof(rd_data)); - coap_send_request(&rd_request_state, &session_info.server_ep, request, rd_callback); + coap_send_request(&session_info->rd_request_state, &session_info->server_ep, session_info->request, session_info->rd_callback); } /*---------------------------------------------------------------------------*/ static void block1_rd_callback(coap_timer_t *timer) { - produce_more_rd(); + produce_more_rd((lwm2m_session_info_t *)timer->user_data); } /*---------------------------------------------------------------------------*/ /* @@ -433,20 +412,24 @@ registration_callback(coap_callback_request_state_t *callback_state) { coap_request_state_t *state = &callback_state->state; LOG_DBG("Registration callback. Status: %d. Response: %d, ", state->status, state->response != NULL); + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)state->user_data; + if(state->status == COAP_REQUEST_STATUS_RESPONSE) { /* check state and possibly set registration to done */ /* If we get a continue - we need to call the rd generator one more time */ + if(CONTINUE_2_31 == state->response->code) { /* We assume that size never change?! */ - coap_get_header_block1(state->response, &rd_block1, NULL, NULL, NULL); - coap_timer_set_callback(&block1_timer, block1_rd_callback); - coap_timer_set(&block1_timer, 1); /* delay 1 ms */ + coap_get_header_block1(state->response, &session_info->rd_block1, NULL, NULL, NULL); + coap_timer_set_user_data(&session_info->block1_timer, (void *)session_info); + coap_timer_set_callback(&session_info->block1_timer, block1_rd_callback); + coap_timer_set(&session_info->block1_timer, 1); /* delay 1 ms */ LOG_DBG_("Continue\n"); } else if(CREATED_2_01 == state->response->code) { if(state->response->location_path_len < LWM2M_RD_CLIENT_ASSIGNED_ENDPOINT_MAX_LEN) { - memcpy(session_info.assigned_ep, state->response->location_path, + memcpy(session_info->assigned_ep, state->response->location_path, state->response->location_path_len); - session_info.assigned_ep[state->response->location_path_len] = 0; + session_info->assigned_ep[state->response->location_path_len] = 0; /* if we decide to not pass the lt-argument on registration, we should force an initial "update" to register lifetime with server */ #if LWM2M_QUEUE_MODE_ENABLED #if LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION @@ -454,14 +437,14 @@ registration_callback(coap_callback_request_state_t *callback_state) lwm2m_queue_mode_set_first_request(); } #endif - lwm2m_rd_client_fsm_execute_queue_mode_awake(); /* Avoid 500 ms delay and move directly to the state*/ + lwm2m_rd_client_fsm_execute_queue_mode_awake(session_info); /* Avoid 500 ms delay and move directly to the state*/ #else - rd_state = REGISTRATION_DONE; + session_info->rd_state = REGISTRATION_DONE; #endif /* remember the last reg time */ - last_update = coap_timer_uptime(); - LOG_DBG_("Done (assigned EP='%s')!\n", session_info.assigned_ep); - perform_session_callback(LWM2M_RD_CLIENT_REGISTERED); + session_info->last_update = coap_timer_uptime(); + LOG_DBG_("Done (assigned EP='%s')!\n", session_info->assigned_ep); + perform_session_callback(session_info, LWM2M_RD_CLIENT_REGISTERED); return; } @@ -474,15 +457,15 @@ registration_callback(coap_callback_request_state_t *callback_state) LOG_DBG_("failed with code %d. Re-init network\n", state->response->code); } /* TODO Application callback? */ - rd_state = INIT; + session_info->rd_state = INIT; } else if(state->status == COAP_REQUEST_STATUS_TIMEOUT) { LOG_DBG_("Server not responding, trying to reconnect\n"); - rd_state = INIT; - } else if(state->status == COAP_REQUEST_STATUS_FINISHED){ + session_info->rd_state = INIT; + } else if(state->status == COAP_REQUEST_STATUS_FINISHED) { LOG_DBG_("Request finished. Ignore\n"); } else { LOG_DBG_("Unexpected error, trying to reconnect\n"); - rd_state = INIT; + session_info->rd_state = INIT; } } /*---------------------------------------------------------------------------*/ @@ -495,18 +478,20 @@ update_callback(coap_callback_request_state_t *callback_state) coap_request_state_t *state = &callback_state->state; LOG_DBG("Update callback. Status: %d. Response: %d, ", state->status, state->response != NULL); + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)state->user_data; + if(state->status == COAP_REQUEST_STATUS_RESPONSE) { /* If we get a continue - we need to call the rd generator one more time */ if(CONTINUE_2_31 == state->response->code) { /* We assume that size never change?! */ LOG_DBG_("Continue\n"); - coap_get_header_block1(state->response, &rd_block1, NULL, NULL, NULL); - coap_timer_set_callback(&block1_timer, block1_rd_callback); - coap_timer_set(&block1_timer, 1); /* delay 1 ms */ + coap_get_header_block1(state->response, &session_info->rd_block1, NULL, NULL, NULL); + coap_timer_set_callback(&session_info->block1_timer, block1_rd_callback); + coap_timer_set(&session_info->block1_timer, 1); /* delay 1 ms */ } else if(CHANGED_2_04 == state->response->code) { LOG_DBG_("Done!\n"); /* remember the last reg time */ - last_update = coap_timer_uptime(); + session_info->last_update = coap_timer_uptime(); #if LWM2M_QUEUE_MODE_ENABLED /* If it has been waked up by a notification, send the stored notifications in queue */ if(lwm2m_queue_mode_is_waked_up_by_notification()) { @@ -519,25 +504,26 @@ update_callback(coap_callback_request_state_t *callback_state) lwm2m_queue_mode_set_first_request(); } #endif /* LWM2M_QUEUE_MODE_INCLUDE_DYNAMIC_ADAPTATION */ - lwm2m_rd_client_fsm_execute_queue_mode_awake(); /* Avoid 500 ms delay and move directly to the state*/ + lwm2m_rd_client_fsm_execute_queue_mode_awake(session_info); /* Avoid 500 ms delay and move directly to the state*/ #else - rd_state = REGISTRATION_DONE; - rd_flags &= ~FLAG_RD_DATA_UPDATE_TRIGGERED; -#endif /* LWM2M_QUEUE_MODE_ENABLED */ + + session_info->rd_state = REGISTRATION_DONE; + session_info->rd_flags &= ~FLAG_RD_DATA_UPDATE_TRIGGERED; +#endif /* LWM2M_QUEUE_MODE_DEFAULT_CLIENT_SLEEP_TIME */ } else { /* Possible error response codes are 4.00 Bad request & 4.04 Not Found */ LOG_DBG_("Failed with code %d. Retrying registration\n", state->response->code); - rd_state = DO_REGISTRATION; + session_info->rd_state = DO_REGISTRATION; } } else if(state->status == COAP_REQUEST_STATUS_TIMEOUT) { LOG_DBG_("Server not responding, trying to reconnect\n"); - rd_state = INIT; - } else if(state->status == COAP_REQUEST_STATUS_FINISHED){ + session_info->rd_state = INIT; + } else if(state->status == COAP_REQUEST_STATUS_FINISHED) { LOG_DBG_("Request finished. Ignore\n"); } else { LOG_DBG_("Unexpected error, trying to reconnect\n"); - rd_state = INIT; + session_info->rd_state = INIT; } } /*---------------------------------------------------------------------------*/ @@ -549,19 +535,49 @@ deregister_callback(coap_callback_request_state_t *callback_state) state->status, state->response != NULL ? state->response->code : 0); + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)state->user_data; + if(state->status == COAP_REQUEST_STATUS_RESPONSE && (DELETED_2_02 == state->response->code)) { LOG_DBG("Deregistration success\n"); - rd_state = DEREGISTERED; - perform_session_callback(LWM2M_RD_CLIENT_DEREGISTERED); + session_info->rd_state = DEREGISTERED; + perform_session_callback(session_info, LWM2M_RD_CLIENT_DEREGISTERED); } else { LOG_DBG("Deregistration failed\n"); - if(rd_state == DEREGISTER_SENT) { - rd_state = DEREGISTER_FAILED; - perform_session_callback(LWM2M_RD_CLIENT_DEREGISTER_FAILED); + if(session_info->rd_state == DEREGISTER_SENT) { + session_info->rd_state = DEREGISTER_FAILED; + perform_session_callback(session_info, LWM2M_RD_CLIENT_DEREGISTER_FAILED); } } } /*---------------------------------------------------------------------------*/ +#if LWM2M_QUEUE_MODE_ENABLED +static int +all_sessions_in_queue_mode_state(void) +{ + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); + while(session_info != NULL) { + if(((session_info->rd_state & 0xF) != 0xE)) { + return 0; + } + session_info = session_info->next; + } + return 1; +} +/*---------------------------------------------------------------------------*/ +static int +all_sessions_in_queue_mode_awake(void) +{ + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); + while(session_info != NULL) { + if(session_info->rd_state != QUEUE_MODE_AWAKE) { + return 0; + } + session_info = session_info->next; + } + return 1; +} +#endif /* LWM2M_QUEUE_MODE_ENABLED */ +/*---------------------------------------------------------------------------*/ /* CoAP timer callback */ static void periodic_process(coap_timer_t *timer) @@ -571,7 +587,7 @@ periodic_process(coap_timer_t *timer) /* reschedule the CoAP timer */ #if LWM2M_QUEUE_MODE_ENABLED /* In Queue Mode, the machine is not executed periodically, but with the awake/sleeping times */ - if(!((rd_state & 0xF) == 0xE)) { + if(!all_sessions_in_queue_mode_state()) { coap_timer_reset(&rd_timer, STATE_MACHINE_UPDATE_INTERVAL); } #else @@ -580,233 +596,243 @@ periodic_process(coap_timer_t *timer) now = coap_timer_uptime(); - LOG_DBG("RD Client - state: %d, ms: %lu\n", rd_state, - (unsigned long)coap_timer_uptime()); + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); + while(session_info != NULL) { - switch(rd_state) { - case INIT: - LOG_DBG("RD Client started with endpoint '%s' and client lifetime %d\n", session_info.ep, session_info.lifetime); - rd_state = WAIT_NETWORK; - break; - case WAIT_NETWORK: - if(now > wait_until_network_check) { - /* check each 10 seconds before next check */ - LOG_DBG("Checking for network... %lu\n", - (unsigned long)wait_until_network_check); - wait_until_network_check = now + 10000; - if(has_network_access()) { - /* Either do bootstrap then registration */ - if(session_info.use_bootstrap) { - rd_state = DO_BOOTSTRAP; - } else { - rd_state = DO_REGISTRATION; - } - } - /* Otherwise wait until for a network to join */ - } - break; - case DO_BOOTSTRAP: - if(session_info.use_bootstrap && session_info.bootstrapped == 0) { - if(update_bootstrap_server()) { - /* prepare request, TID is set by COAP_BLOCKING_REQUEST() */ - coap_init_message(request, COAP_TYPE_CON, COAP_POST, 0); - coap_set_header_uri_path(request, "/bs"); + LOG_DBG("RD Client with assigned ep: %s - state: %d, ms: %lu\n", session_info->assigned_ep, session_info->rd_state, + (unsigned long)coap_timer_uptime()); - snprintf(query_data, sizeof(query_data) - 1, "?ep=%s", session_info.ep); - coap_set_header_uri_query(request, query_data); - LOG_INFO("Registering ID with bootstrap server ["); - LOG_INFO_COAP_EP(&session_info.bs_server_ep); - LOG_INFO_("] as '%s'\n", query_data); - - if(coap_send_request(&rd_request_state, &session_info.bs_server_ep, - request, bootstrap_callback)) { - rd_state = BOOTSTRAP_SENT; - } - } - } - break; - case BOOTSTRAP_SENT: - /* Just wait for bootstrap to be done... */ - break; - case BOOTSTRAP_DONE: - /* check that we should still use bootstrap */ - if(session_info.use_bootstrap) { - lwm2m_security_server_t *security; - LOG_DBG("*** Bootstrap - checking for server info...\n"); - /* get the security object - ignore bootstrap servers */ - for(security = lwm2m_security_get_first(); - security != NULL; - security = lwm2m_security_get_next(security)) { - if(security->bootstrap == 0) { - break; - } - } - - if(security != NULL) { - /* get the server URI */ - if(security->server_uri_len > 0) { - uint8_t secure = 0; - - LOG_DBG("**** Found security instance using: "); - LOG_DBG_COAP_STRING((const char *)security->server_uri, - security->server_uri_len); - LOG_DBG_(" (len %d) \n", security->server_uri_len); - /* TODO Should verify it is a URI */ - /* Check if secure */ - secure = strncmp((const char *)security->server_uri, - "coaps:", 6) == 0; - - if(!coap_endpoint_parse((const char *)security->server_uri, - security->server_uri_len, - &session_info.server_ep)) { - LOG_DBG("Failed to parse server URI!\n"); + switch(session_info->rd_state) { + case INIT: + LOG_DBG("RD Client started with endpoint '%s' and client lifetime %d\n", session_info->ep, session_info->lifetime); + session_info->rd_state = WAIT_NETWORK; + break; + case WAIT_NETWORK: + if(now > session_info->wait_until_network_check) { + /* check each 10 seconds before next check */ + LOG_DBG("Checking for network... %lu\n", + (unsigned long)session_info->wait_until_network_check); + session_info->wait_until_network_check = now + 10000; + if(has_network_access()) { + /* Either do bootstrap then registration */ + if(session_info->use_server_type == LWM2M_RD_CLIENT_BOOTSTRAP_SERVER) { + session_info->rd_state = DO_BOOTSTRAP; } else { - LOG_DBG("Server address:"); - LOG_DBG_COAP_EP(&session_info.server_ep); - LOG_DBG_("\n"); - if(secure) { - LOG_DBG("Secure CoAP requested but not supported - can not bootstrap\n"); - } else { - lwm2m_rd_client_register_with_server(&session_info.server_ep); - session_info.bootstrapped++; - } + session_info->rd_state = DO_REGISTRATION; } - } else { - LOG_DBG("** failed to parse URI "); - LOG_DBG_COAP_STRING((const char *)security->server_uri, - security->server_uri_len); - LOG_DBG_("\n"); + } + /* Otherwise wait until for a network to join */ + } + break; + case DO_BOOTSTRAP: + if(session_info->use_server_type == LWM2M_RD_CLIENT_BOOTSTRAP_SERVER && + session_info->bootstrapped == 0 && + session_info->has_bs_server_info) { + + /* prepare request, TID is set by COAP_BLOCKING_REQUEST() */ + coap_init_message(session_info->request, COAP_TYPE_CON, COAP_POST, 0); + coap_set_header_uri_path(session_info->request, "/bs"); + + snprintf(query_data, sizeof(query_data) - 1, "?ep=%s", session_info->ep); + coap_set_header_uri_query(session_info->request, query_data); + LOG_INFO("Registering ID with bootstrap server ["); + LOG_INFO_COAP_EP(&session_info->bs_server_ep); + LOG_INFO_("] as '%s'\n", query_data); + /* Add session info as user data to use it in the callbacks */ + session_info->rd_request_state.state.user_data = (void *)session_info; + if(coap_send_request(&session_info->rd_request_state, &session_info->bs_server_ep, + session_info->request, bootstrap_callback)) { + session_info->rd_state = BOOTSTRAP_SENT; } } + break; + case BOOTSTRAP_SENT: + /* Just wait for bootstrap to be done... */ + break; + case BOOTSTRAP_DONE: + /* check that we should still use bootstrap */ + if(session_info->use_server_type == LWM2M_RD_CLIENT_BOOTSTRAP_SERVER) { + lwm2m_security_server_t *security; + LOG_DBG("*** Bootstrap - checking for server info...\n"); + /* get the security object - ignore bootstrap servers */ + for(security = lwm2m_security_get_first(); + security != NULL; + security = lwm2m_security_get_next(security)) { + if(security->bootstrap == 0) { + break; + } + } - /* if we did not register above - then fail this and restart... */ - if(session_info.bootstrapped == 0) { - /* Not ready. Lets retry with the bootstrap server again */ - rd_state = DO_BOOTSTRAP; - } else { - rd_state = DO_REGISTRATION; + if(security != NULL) { + /* get the server URI */ + if(security->server_uri_len > 0) { + uint8_t secure = 0; + + LOG_DBG("**** Found security instance using: "); + LOG_DBG_COAP_STRING((const char *)security->server_uri, + security->server_uri_len); + LOG_DBG_(" (len %d) \n", security->server_uri_len); + /* TODO Should verify it is a URI */ + /* Check if secure */ + secure = strncmp((const char *)security->server_uri, + "coaps:", 6) == 0; + + if(!coap_endpoint_parse((const char *)security->server_uri, + security->server_uri_len, + &session_info->server_ep)) { + LOG_DBG("Failed to parse server URI!\n"); + } else { + LOG_DBG("Server address:"); + LOG_DBG_COAP_EP(&session_info->server_ep); + LOG_DBG_("\n"); + if(secure) { + LOG_DBG("Secure CoAP requested but not supported - can not bootstrap\n"); + } else { + lwm2m_rd_client_register_with_server(session_info, &session_info->server_ep, LWM2M_RD_CLIENT_LWM2M_SERVER); + session_info->bootstrapped++; + } + } + } else { + LOG_DBG("** failed to parse URI "); + LOG_DBG_COAP_STRING((const char *)security->server_uri, + security->server_uri_len); + LOG_DBG_("\n"); + } + } + + /* if we did not register above - then fail this and restart... */ + if(session_info->bootstrapped == 0) { + /* Not ready. Lets retry with the bootstrap server again */ + session_info->rd_state = DO_BOOTSTRAP; + } else { + session_info->rd_state = DO_REGISTRATION; + } } - } - break; - case DO_REGISTRATION: - if(!coap_endpoint_is_connected(&session_info.server_ep)) { - /* Not connected... wait a bit... and retry connection */ - coap_endpoint_connect(&session_info.server_ep); - LOG_DBG("Wait until connected... \n"); - return; - } - if(session_info.use_registration && !session_info.registered && - update_registration_server()) { - int len; - - /* prepare request, TID was set by COAP_BLOCKING_REQUEST() */ - coap_init_message(request, COAP_TYPE_CON, COAP_POST, 0); - coap_set_header_uri_path(request, "/rd"); - - snprintf(query_data, sizeof(query_data) - 1, "?ep=%s<=%d&b=%s", session_info.ep, session_info.lifetime, session_info.binding); - coap_set_header_uri_query(request, query_data); - - len = set_rd_data(request); - rd_callback = registration_callback; - - LOG_INFO("Registering with ["); - LOG_INFO_COAP_EP(&session_info.server_ep); - LOG_INFO_("] lwm2m endpoint '%s': '", query_data); - if(len) { - LOG_INFO_COAP_STRING((const char *)rd_data, len); + break; + case DO_REGISTRATION: + if(!coap_endpoint_is_connected(&session_info->server_ep)) { + /* Not connected... wait a bit... and retry connection */ + coap_endpoint_connect(&session_info->server_ep); + LOG_DBG("Wait until connected... \n"); + return; } - LOG_INFO_("' More:%d\n", rd_more); - if(coap_send_request(&rd_request_state, &session_info.server_ep, - request, registration_callback)){ - rd_state = REGISTRATION_SENT; + if(session_info->use_server_type == LWM2M_RD_CLIENT_LWM2M_SERVER && + !lwm2m_rd_client_is_registered(session_info) && + session_info->has_registration_server_info) { + int len; + + /* prepare request, TID was set by COAP_BLOCKING_REQUEST() */ + coap_init_message(session_info->request, COAP_TYPE_CON, COAP_POST, 0); + coap_set_header_uri_path(session_info->request, "/rd"); + + snprintf(query_data, sizeof(query_data) - 1, "?ep=%s<=%d&b=%s", session_info->ep, session_info->lifetime, session_info->binding); + coap_set_header_uri_query(session_info->request, query_data); + + len = set_rd_data(session_info); + session_info->rd_callback = registration_callback; + + LOG_INFO("Registering with ["); + LOG_INFO_COAP_EP(&session_info->server_ep); + LOG_INFO_("] lwm2m endpoint '%s': '", query_data); + if(len) { + LOG_INFO_COAP_STRING((const char *)rd_data, len); + } + LOG_INFO_("' More:%d\n", session_info->rd_more); + + /* Add session info as user data to use it in the callbacks */ + session_info->rd_request_state.state.user_data = (void *)session_info; + if(coap_send_request(&session_info->rd_request_state, &session_info->server_ep, + session_info->request, registration_callback)) { + + session_info->rd_state = REGISTRATION_SENT; + } + session_info->last_rd_progress = coap_timer_uptime(); } - } - break; - case REGISTRATION_SENT: - /* just wait until the callback kicks us to the next state... */ - break; - case REGISTRATION_DONE: - /* All is done! */ + break; + case REGISTRATION_SENT: + /* just wait until the callback kicks us to the next state... */ + break; + case REGISTRATION_DONE: + /* All is done! */ - check_periodic_observations(); /* TODO: manage periodic observations */ + check_periodic_observations(); /* TODO: manage periodic observations */ - /* check if it is time for the next update */ - if((rd_flags & FLAG_RD_DATA_UPDATE_TRIGGERED) || - ((uint32_t)session_info.lifetime * 500) <= now - last_update) { - /* triggered or time to send an update to the server, at half-time! sec vs ms */ - prepare_update(request, rd_flags & FLAG_RD_DATA_UPDATE_TRIGGERED); - if(coap_send_request(&rd_request_state, &session_info.server_ep, request, - update_callback)) { - rd_state = UPDATE_SENT; + /* check if it is time for the next update */ + if((session_info->rd_flags & FLAG_RD_DATA_UPDATE_TRIGGERED) || + ((uint32_t)session_info->lifetime * 500) <= now - session_info->last_update) { + /* triggered or time to send an update to the server, at half-time! sec vs ms */ + prepare_update(session_info, session_info->rd_flags & FLAG_RD_DATA_UPDATE_TRIGGERED); + + /* Add session info as user data to use it in the callbacks */ + session_info->rd_request_state.state.user_data = (void *)session_info; + if(coap_send_request(&session_info->rd_request_state, &session_info->server_ep, session_info->request, + update_callback)) { + session_info->rd_state = UPDATE_SENT; + } + session_info->last_rd_progress = coap_timer_uptime(); } - } - break; + break; + #if LWM2M_QUEUE_MODE_ENABLED - case QUEUE_MODE_AWAKE: - LOG_DBG("Queue Mode: Client is AWAKE at %lu\n", (unsigned long)coap_timer_uptime()); - queue_mode_client_awake = 1; - queue_mode_client_awake_time = lwm2m_queue_mode_get_awake_time(); - coap_timer_set(&queue_mode_client_awake_timer, queue_mode_client_awake_time); - break; - case QUEUE_MODE_SEND_UPDATE: -/* Define this macro to make the necessary actions for waking up, - * depending on the platform - */ + case QUEUE_MODE_AWAKE: + LOG_DBG("Queue Mode: Client is AWAKE at %lu\n", (unsigned long)coap_timer_uptime()); + if((queue_mode_client_awake = all_sessions_in_queue_mode_awake())) { + queue_mode_client_awake_time = lwm2m_queue_mode_get_awake_time(); + coap_timer_set(&queue_mode_client_awake_timer, queue_mode_client_awake_time); + } + break; + case QUEUE_MODE_SEND_UPDATE: + /* Define this macro to make the necessary actions for waking up, + * depending on the platform + */ #ifdef LWM2M_QUEUE_MODE_WAKE_UP - LWM2M_QUEUE_MODE_WAKE_UP(); + LWM2M_QUEUE_MODE_WAKE_UP(); #endif /* LWM2M_QUEUE_MODE_WAKE_UP */ - prepare_update(request, rd_flags & FLAG_RD_DATA_UPDATE_TRIGGERED); - if(coap_send_request(&rd_request_state, &session_info.server_ep, request, - update_callback)) { - rd_state = UPDATE_SENT; - } - break; + prepare_update(session_info, session_info->rd_flags & FLAG_RD_DATA_UPDATE_TRIGGERED); + /* Add session info as user data to use it in the callbacks */ + session_info->rd_request_state.state.user_data = (void *)session_info; + if(coap_send_request(&session_info->rd_request_state, &session_info->server_ep, session_info->request, + update_callback)) { + session_info->rd_state = UPDATE_SENT; + } + session_info->last_rd_progress = coap_timer_uptime(); + break; #endif /* LWM2M_QUEUE_MODE_ENABLED */ - case UPDATE_SENT: - /* just wait until the callback kicks us to the next state... */ - break; - case DEREGISTER: - LOG_INFO("DEREGISTER %s\n", session_info.assigned_ep); - coap_init_message(request, COAP_TYPE_CON, COAP_DELETE, 0); - coap_set_header_uri_path(request, session_info.assigned_ep); - if(coap_send_request(&rd_request_state, &session_info.server_ep, request, - deregister_callback)) { - rd_state = DEREGISTER_SENT; - } - break; - case DEREGISTER_SENT: - break; - case DEREGISTER_FAILED: - break; - case DEREGISTERED: - break; + case UPDATE_SENT: + /* just wait until the callback kicks us to the next state... */ + break; + case DEREGISTER: + LOG_INFO("DEREGISTER %s\n", session_info->assigned_ep); + coap_init_message(session_info->request, COAP_TYPE_CON, COAP_DELETE, 0); + coap_set_header_uri_path(session_info->request, session_info->assigned_ep); - default: - LOG_WARN("Unhandled state: %d\n", rd_state); + /* Add session info as user data to use it in the callbacks */ + session_info->rd_request_state.state.user_data = (void *)session_info; + if(coap_send_request(&session_info->rd_request_state, &session_info->server_ep, session_info->request, + deregister_callback)) { + session_info->rd_state = DEREGISTER_SENT; + } + break; + case DEREGISTER_SENT: + break; + case DEREGISTER_FAILED: + break; + case DEREGISTERED: + break; + + default: + LOG_WARN("Unhandled state: %d\n", session_info->rd_state); + } + session_info = session_info->next; } } /*---------------------------------------------------------------------------*/ void lwm2m_rd_client_init(const char *ep) { - session_info.ep = ep; - /* default binding U = UDP, UQ = UDP Q-mode*/ -#if LWM2M_QUEUE_MODE_ENABLED - session_info.binding = "UQ"; - /* Enough margin to ensure that the client is not unregistered (we - * do not know the time it can stay awake) - */ - session_info.lifetime = (LWM2M_QUEUE_MODE_DEFAULT_CLIENT_SLEEP_TIME / 1000) * 2; -#else - session_info.binding = "U"; - if(session_info.lifetime == 0) { - session_info.lifetime = LWM2M_DEFAULT_CLIENT_LIFETIME; - } -#endif - - rd_state = INIT; + lwm2m_rd_client_set_default_endpoint_name(ep); /* call the RD client periodically */ coap_timer_set_callback(&rd_timer, periodic_process); @@ -823,7 +849,7 @@ check_periodic_observations(void) } /*---------------------------------------------------------------------------*/ /* - *Queue Mode Support + * Queue Mode Support */ #if LWM2M_QUEUE_MODE_ENABLED /*---------------------------------------------------------------------------*/ @@ -846,27 +872,31 @@ queue_mode_awake_timer_callback(coap_timer_t *timer) LOG_DBG("Queue Mode: Client is SLEEPING at %lu\n", (unsigned long)coap_timer_uptime()); queue_mode_client_awake = 0; -/* Define this macro to enter sleep mode depending on the platform */ + lwm2m_session_info_t *session_info = (lwm2m_session_info_t *)list_head(session_info_list); + while(session_info != NULL) { + session_info->rd_state = QUEUE_MODE_SEND_UPDATE; + session_info = session_info->next; + } + coap_timer_set(&rd_timer, lwm2m_queue_mode_get_sleep_time()); + /* Define this macro to enter sleep mode depending on the platform */ #ifdef LWM2M_QUEUE_MODE_SLEEP_MS LWM2M_QUEUE_MODE_SLEEP_MS(lwm2m_queue_mode_get_sleep_time()); #endif /* LWM2M_QUEUE_MODE_SLEEP_MS */ - rd_state = QUEUE_MODE_SEND_UPDATE; - coap_timer_set(&rd_timer, lwm2m_queue_mode_get_sleep_time()); } /*---------------------------------------------------------------------------*/ void -lwm2m_rd_client_fsm_execute_queue_mode_awake() +lwm2m_rd_client_fsm_execute_queue_mode_awake(lwm2m_session_info_t *session_info) { coap_timer_stop(&rd_timer); - rd_state = QUEUE_MODE_AWAKE; + session_info->rd_state = QUEUE_MODE_AWAKE; periodic_process(&rd_timer); } /*---------------------------------------------------------------------------*/ void -lwm2m_rd_client_fsm_execute_queue_mode_update() +lwm2m_rd_client_fsm_execute_queue_mode_update(lwm2m_session_info_t *session_info) { coap_timer_stop(&rd_timer); - rd_state = QUEUE_MODE_SEND_UPDATE; + session_info->rd_state = QUEUE_MODE_SEND_UPDATE; periodic_process(&rd_timer); } /*---------------------------------------------------------------------------*/ diff --git a/os/services/lwm2m/lwm2m-rd-client.h b/os/services/lwm2m/lwm2m-rd-client.h index cfc5c549d..58fa0a8c2 100644 --- a/os/services/lwm2m/lwm2m-rd-client.h +++ b/os/services/lwm2m/lwm2m-rd-client.h @@ -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_ */ /** @} */ diff --git a/os/services/lwm2m/lwm2m-server.c b/os/services/lwm2m/lwm2m-server.c index bf0398b4f..b777d72d6 100644 --- a/os/services/lwm2m/lwm2m-server.c +++ b/os/services/lwm2m/lwm2m-server.c @@ -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 { diff --git a/os/services/rpl-border-router/native/slip-config.c b/os/services/rpl-border-router/native/slip-config.c index a8e17f22c..7797a129f 100644 --- a/os/services/rpl-border-router/native/slip-config.c +++ b/os/services/rpl-border-router/native/slip-config.c @@ -142,14 +142,20 @@ slip_config_handle_arguments(int argc, char **argv) fprintf(stderr, " -a host Connect via TCP to server at \n"); fprintf(stderr, " -p port Connect via TCP to server at :\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"); diff --git a/tests/14-rpl-lite/02-rpl-root-reboot-2.csc b/tests/14-rpl-lite/02-rpl-root-reboot-2.csc new file mode 100644 index 000000000..50b3153dd --- /dev/null +++ b/tests/14-rpl-lite/02-rpl-root-reboot-2.csc @@ -0,0 +1,294 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/powertracker + + My simulation + 10.0 + 123456 + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + 40000 + + + org.contikios.cooja.contikimote.ContikiMoteType + mtype34 + mote + [CONTIKI_DIR]/examples/libs/shell/example.c + make example.cooja TARGET=cooja MAKE_ROUTING=MAKE_ROUTING_RPL_LITE -j + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.Battery + org.contikios.cooja.contikimote.interfaces.ContikiVib + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + org.contikios.cooja.contikimote.interfaces.ContikiRS232 + org.contikios.cooja.contikimote.interfaces.ContikiBeeper + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.contikimote.interfaces.ContikiIPAddress + org.contikios.cooja.contikimote.interfaces.ContikiRadio + org.contikios.cooja.contikimote.interfaces.ContikiButton + org.contikios.cooja.contikimote.interfaces.ContikiPIR + org.contikios.cooja.contikimote.interfaces.ContikiClock + org.contikios.cooja.contikimote.interfaces.ContikiLED + org.contikios.cooja.contikimote.interfaces.ContikiCFS + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + false + + + + org.contikios.cooja.interfaces.Position + 50.0 + 0.0 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + mtype34 + + + + org.contikios.cooja.interfaces.Position + 100.0 + 0.0 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + mtype34 + + + + org.contikios.cooja.interfaces.Position + 150.0 + 0.0 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + org.contikios.cooja.contikimote.interfaces.ContikiRS232 + ip-addr~;routes~;routing~; + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + mtype34 + + + + org.contikios.cooja.interfaces.Position + 0.0 + 0.0 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + mtype34 + + + + org.contikios.cooja.plugins.SimControl + 280 + 0 + 160 + 400 + 0 + + + org.contikios.cooja.plugins.Visualizer + + true + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.GridVisualizerSkin + org.contikios.cooja.plugins.skins.TrafficVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin + 0.9090909090909091 0.0 0.0 0.9090909090909091 125.81818181818181 173.0 + + 400 + 4 + 400 + 1 + 1 + + + org.contikios.cooja.plugins.LogListener + + + + + + 604 + 3 + 784 + 400 + 160 + + + org.contikios.cooja.plugins.Notes + + Enter notes here + true + + 944 + 1 + 160 + 680 + 0 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 617 + 2 + 785 + 1007 + 160 + + + diff --git a/tests/15-rpl-classic/02-rpl-root-reboot-2.csc b/tests/15-rpl-classic/02-rpl-root-reboot-2.csc new file mode 100644 index 000000000..6de8e9583 --- /dev/null +++ b/tests/15-rpl-classic/02-rpl-root-reboot-2.csc @@ -0,0 +1,294 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/powertracker + + My simulation + 10.0 + 123456 + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + 40000 + + + org.contikios.cooja.contikimote.ContikiMoteType + mtype512 + mote + [CONTIKI_DIR]/examples/libs/shell/example.c + make example.cooja TARGET=cooja MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC -j + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.Battery + org.contikios.cooja.contikimote.interfaces.ContikiVib + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + org.contikios.cooja.contikimote.interfaces.ContikiRS232 + org.contikios.cooja.contikimote.interfaces.ContikiBeeper + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.contikimote.interfaces.ContikiIPAddress + org.contikios.cooja.contikimote.interfaces.ContikiRadio + org.contikios.cooja.contikimote.interfaces.ContikiButton + org.contikios.cooja.contikimote.interfaces.ContikiPIR + org.contikios.cooja.contikimote.interfaces.ContikiClock + org.contikios.cooja.contikimote.interfaces.ContikiLED + org.contikios.cooja.contikimote.interfaces.ContikiCFS + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + false + + + + org.contikios.cooja.interfaces.Position + 50.0 + 0.0 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + mtype512 + + + + org.contikios.cooja.interfaces.Position + 100.0 + 0.0 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + mtype512 + + + + org.contikios.cooja.interfaces.Position + 150.0 + 0.0 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + org.contikios.cooja.contikimote.interfaces.ContikiRS232 + ip-addr~;routes~;routing~; + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + mtype512 + + + + org.contikios.cooja.interfaces.Position + 0.0 + 0.0 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiEEPROM + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== + + mtype512 + + + + org.contikios.cooja.plugins.SimControl + 280 + 0 + 160 + 400 + 0 + + + org.contikios.cooja.plugins.Visualizer + + true + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.GridVisualizerSkin + org.contikios.cooja.plugins.skins.TrafficVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin + 0.9090909090909091 0.0 0.0 0.9090909090909091 125.81818181818181 173.0 + + 400 + 4 + 400 + 1 + 1 + + + org.contikios.cooja.plugins.LogListener + + + + + + 604 + 3 + 784 + 400 + 160 + + + org.contikios.cooja.plugins.Notes + + Enter notes here + true + + 944 + 1 + 160 + 680 + 0 + + + org.contikios.cooja.plugins.ScriptRunner + + + true + + 617 + 2 + 785 + 1007 + 160 + + + diff --git a/tests/18-coap-lwm2m/example-lwm2m-standalone b/tests/18-coap-lwm2m/example-lwm2m-standalone index 67b858437..3b23ca8d6 160000 --- a/tests/18-coap-lwm2m/example-lwm2m-standalone +++ b/tests/18-coap-lwm2m/example-lwm2m-standalone @@ -1 +1 @@ -Subproject commit 67b858437f7cf1e4e027d821c4c2ac15fdf2ab44 +Subproject commit 3b23ca8d6a19d281b6330d3f24afc2e1bb14ddb7 diff --git a/tools/serial-io/tunslip6.c b/tools/serial-io/tunslip6.c index 48b0ecd0f..61013c30c 100644 --- a/tools/serial-io/tunslip6.c +++ b/tools/serial-io/tunslip6.c @@ -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");