Unverified Commit 20c6bb8f authored by Simon Duquennoy's avatar Simon Duquennoy Committed by GitHub
Browse files

Merge pull request #1081 from contiki-ng/release-4.4

Release v4.4
parents a51f3d8c 6819ad02
......@@ -32,7 +32,7 @@ COOJA.testlog
*.jn516x
*.native
*.nrf52dk
*.openmote-cc2538
*.openmote
*.simplelink
*.sky
*.firmware
......@@ -45,7 +45,7 @@ COOJA.testlog
!Makefile.jn516x
!Makefile.native
!Makefile.nrf52dk
!Makefile.openmote-cc2538
!Makefile.openmote
!Makefile.sky
!Makefile.cc26x0-cc13x0
!Makefile.zoul
......
# Setup environment for Docker
language: generic
services: docker
dist: trusty
notifications:
email: false
......@@ -49,7 +50,7 @@ before_install:
# The test script for each build
script:
- docker run --privileged -v $OUT_OF_TREE_TEST_PATH:/home/user/out-of-tree-tests -v $CNG_HOST_PATH:/home/user/contiki-ng -ti $DOCKER_IMG bash --login -c "make -C tests/??-$TEST_NAME";
- docker run --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 -v $OUT_OF_TREE_TEST_PATH:/home/user/out-of-tree-tests -v $CNG_HOST_PATH:/home/user/contiki-ng -ti $DOCKER_IMG bash --login -c "make -C tests/??-$TEST_NAME";
# Check outcome of the test
- $CNG_HOST_PATH/tests/check-test.sh $CNG_HOST_PATH/tests/??-$TEST_NAME; exit $?;
......@@ -73,6 +74,7 @@ env:
- TEST_NAME='rpl-classic' BUILD_COOJA=true
- TEST_NAME='tun-rpl-br' BUILD_COOJA=true
- TEST_NAME='coap-lwm2m'
- TEST_NAME='script-base'
- TEST_NAME='simulation-base' BUILD_COOJA=true
- TEST_NAME='ieee802154' BUILD_COOJA=true
- TEST_NAME='compile-nxp-ports'
......@@ -82,3 +84,4 @@ env:
- TEST_NAME='ipv6' BUILD_COOJA=true
- TEST_NAME='ipv6-nbr' BUILD_COOJA=true
- TEST_NAME='out-of-tree-build'
- TEST_NAME='packet-parsing'
### This Makefile creates variables for all Contiki-NG directory locations
### Instead of storing them in the top-level Makefile.include, we store them
### in this separate Makefile here, which is included by Makefile.include
### This allows examples that wish to specify additional MODULES to include
### this Makefile and append to MODULES using the path variables defined here
# Variables for the various directories under os/
# Those are sometimes used relative to the top-level dir in which case we don't
# need to prepend $(CONTIKI), as well as relative to the example dir, in which
# case we do. So we define the variables to suit the former case and we will
# prepend $(CONTIKI) explicitly where needed.
CONTIKI_NG_OS_DIR = os
CONTIKI_NG_SYS_DIR = $(CONTIKI_NG_OS_DIR)/sys
CONTIKI_NG_NET_DIR = $(CONTIKI_NG_OS_DIR)/net
CONTIKI_NG_MAC_DIR = $(CONTIKI_NG_NET_DIR)/mac
CONTIKI_NG_ROUTING_DIR = $(CONTIKI_NG_NET_DIR)/routing
CONTIKI_NG_APP_LAYER_DIR = $(CONTIKI_NG_NET_DIR)/app-layer
CONTIKI_NG_SECURITY_DIR = $(CONTIKI_NG_NET_DIR)/security
CONTIKI_NG_DEV_DIR = $(CONTIKI_NG_OS_DIR)/dev
CONTIKI_NG_LIB_DIR = $(CONTIKI_NG_OS_DIR)/lib
CONTIKI_NG_SERVICES_DIR = $(CONTIKI_NG_OS_DIR)/services
CONTIKI_NG_STORAGE_DIR = $(CONTIKI_NG_OS_DIR)/storage
# Variables for directories under arch
#
# We maintain backwards compatibility with ARCH_PATH, which allows us to
# relocate arch/cpu and arch/platform to an out-of-tree location without
# relocating arch/dev.
#
# $(CONTIKI_NG_RELOC_CPU_DIR) and $(CONTIKI_NG_RELOC_PLATFORM_DIR) will always
# hold the path of the respective dir, relative to the example dir
#
# If ARCH_PATH is _not_ specified, then the cpu/ & platform/ path relative to
# the top-level dir is simply expressed as $(CONTIKI_NG_ARCH_CPU_DIR). This
# allows us to use this variable to append to $(MODULES)
#
# If however ARCH_PATH _is_ specified then paths relative to the top-level
# cannot be expressed since they are always assumed to be under $(CONTIKI)
# while $(ARCH_PATH) is outside it. This means that directories under a
# relocated cpu/ and/or platform/ dir cannot be used as MODULES. This reflects
# old behaviour
ARCH_PATH ?= $(CONTIKI)/arch
# Potentially relocated CPU/Platform dirs, relative to the example dir
CONTIKI_NG_RELOC_CPU_DIR = $(ARCH_PATH)/cpu
CONTIKI_NG_RELOC_PLATFORM_DIR = $(ARCH_PATH)/platform
# A variable representing the location of the non-relocated arch/ dir.
# Used to construct variables for:
# * everything under arch/dev and arch/cpu/arm
# * non-relocated arch/cpu and arch/platform
CONTIKI_NG_ARCH_DIR = arch
CONTIKI_NG_ARCH_CPU_DIR = $(CONTIKI_NG_ARCH_DIR)/cpu
CONTIKI_NG_ARCH_PLATFORM_DIR = $(CONTIKI_NG_ARCH_DIR)/platform
# Arm-related dirs relative to the top-level dir
CONTIKI_NG_ARM_DIR = $(CONTIKI_NG_ARCH_CPU_DIR)/arm
CONTIKI_NG_CORTEX_DIR = $(CONTIKI_NG_ARM_DIR)/cortex-m
CONTIKI_NG_CM3_DIR = $(CONTIKI_NG_CORTEX_DIR)/cm3
CONTIKI_NG_CM4_DIR = $(CONTIKI_NG_CORTEX_DIR)/cm4
# arch/dev is used exclusively as a MODULE so we do not prepend $(CONTIKI)
CONTIKI_NG_DRIVERS_DIR = $(CONTIKI_NG_ARCH_DIR)/dev
# tools/ is used exclusively to invoke commands therein and is always used in
# conjunction with $(CONTIKI)
CONTIKI_NG_TOOLS_DIR = $(CONTIKI)/tools
......@@ -38,7 +38,7 @@ login: $(SERIAL_DUMP_BIN)
###
### Targets using tools/motelist
###
CONTIKI_NG_MOTELIST_DIR = $(TOOLS_DIR)/motelist
CONTIKI_NG_MOTELIST_DIR = $(CONTIKI_NG_TOOLS_DIR)/motelist
CONTIKI_NG_MOTELIST = python $(CONTIKI_NG_MOTELIST_DIR)/motelist.py
.PHONY: motelist-all
......
......@@ -4,6 +4,10 @@ ifndef CONTIKI
${error CONTIKI not defined! You must specify where Contiki resides}
endif
### Include a helper Makefile that creates variables for all Contiki-NG path
### locations.
include $(CONTIKI)/Makefile.dir-variables
# Enable Werror by default. To disable from command line, use make WERROR=0.
# Setting this option is also important for tests on Cooja motes to check for warnings.
WERROR ?= 1
......@@ -62,15 +66,17 @@ ifeq ($(WERROR),1)
LDFLAGS += $(LDFLAGS_WERROR)
endif
MODULES += os os/sys os/dev os/lib os/services
MODULES += $(CONTIKI_NG_OS_DIR) $(CONTIKI_NG_ARCH_DIR)
MODULES += $(CONTIKI_NG_SYS_DIR) $(CONTIKI_NG_LIB_DIR) $(CONTIKI_NG_DEV_DIR)
MODULES += $(CONTIKI_NG_NET_DIR) $(CONTIKI_NG_ROUTING_DIR)
MODULES += $(CONTIKI_NG_MAC_DIR) $(CONTIKI_NG_MAC_DIR)/framer
MODULES += $(CONTIKI_NG_STORAGE_DIR) $(CONTIKI_NG_SERVICES_DIR)
# Automatically include project-conf.h if found
ifneq ("$(wildcard project-conf.h)","")
CFLAGS += -DPROJECT_CONF_PATH=\"project-conf.h\"
endif
MODULES += os/net os/net/mac os/net/mac/framer os/net/routing os/storage
define oname
${patsubst %.c,%.o, \
${patsubst %.S,%.o, \
......@@ -86,10 +92,8 @@ uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
### Include target makefile (TODO Unsafe?)
# Configurable arch path
ARCH_PATH ?= $(CONTIKI)/arch
target_makefile := $(wildcard $(ARCH_PATH)/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
target_makefile := $(wildcard $(CONTIKI_NG_RELOC_PLATFORM_DIR)/$(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)),)
......@@ -154,22 +158,22 @@ MAKE_MAC_OTHER = 4
MAKE_MAC ?= MAKE_MAC_CSMA
ifeq ($(MAKE_MAC),MAKE_MAC_NULLMAC)
MODULES+=os/net/mac/nullmac
MODULES += $(CONTIKI_NG_MAC_DIR)/nullmac
CFLAGS += -DMAC_CONF_WITH_NULLMAC=1
endif
ifeq ($(MAKE_MAC),MAKE_MAC_CSMA)
MODULES += os/net/mac/csma
MODULES += $(CONTIKI_NG_MAC_DIR)/csma
CFLAGS += -DMAC_CONF_WITH_CSMA=1
endif
ifeq ($(MAKE_MAC),MAKE_MAC_TSCH)
MODULES += os/net/mac/tsch
MODULES += $(CONTIKI_NG_MAC_DIR)/tsch
CFLAGS += -DMAC_CONF_WITH_TSCH=1
endif
ifeq ($(MAKE_MAC),MAKE_MAC_BLE)
MODULES += os/net/mac/ble
MODULES += $(CONTIKI_NG_MAC_DIR)/ble
CFLAGS += -DMAC_CONF_WITH_BLE=1
endif
......@@ -188,12 +192,12 @@ MAKE_NET ?= MAKE_NET_IPV6
ifeq ($(MAKE_NET),MAKE_NET_NULLNET)
CFLAGS += -DNETSTACK_CONF_WITH_NULLNET=1
MODULES += os/net/nullnet
MODULES += $(CONTIKI_NG_NET_DIR)/nullnet
endif
ifeq ($(MAKE_NET),MAKE_NET_IPV6)
CFLAGS += -DNETSTACK_CONF_WITH_IPV6=1
MODULES += os/net/ipv6
MODULES += $(CONTIKI_NG_NET_DIR)/ipv6
endif
ifeq ($(MAKE_NET),MAKE_NET_OTHER)
......@@ -201,7 +205,7 @@ ifeq ($(MAKE_NET),MAKE_NET_OTHER)
endif
ifeq ($(WITH_IP64),1)
MODULES += os/services/ip64
MODULES += $(CONTIKI_NG_SERVICES_DIR)/ip64
endif
# Configure Routing protocol
......@@ -218,13 +222,13 @@ endif
ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_CLASSIC)
CFLAGS += -DROUTING_CONF_RPL_CLASSIC=1
MODULES += os/net/routing/rpl-classic
MODULES += $(CONTIKI_NG_ROUTING_DIR)/rpl-classic
else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_LITE)
CFLAGS += -DROUTING_CONF_RPL_LITE=1
MODULES += os/net/routing/rpl-lite
MODULES += $(CONTIKI_NG_ROUTING_DIR)/rpl-lite
else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_NULLROUTING)
CFLAGS += -DROUTING_CONF_NULLROUTING=1
MODULES += os/net/routing/nullrouting
MODULES += $(CONTIKI_NG_ROUTING_DIR)/nullrouting
endif
MODULEDIRS = $(MODULES_REL) ${addprefix $(CONTIKI)/, $(MODULES)}
......@@ -287,10 +291,9 @@ CONTIKI_TARGET_DIRS_CONCAT = ${addprefix ${dir $(target_makefile)}, \
$(CONTIKI_TARGET_DIRS)}
CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI_CPU)/, \
$(CONTIKI_CPU_DIRS)}
CONTIKI_ARCH_DIRS = ${addprefix $(CONTIKI)/, arch}
SOURCEDIRS = . $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) $(CONTIKI_ARCH_DIRS) \
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(MODULEDIRS) $(EXTERNALDIRS)
SOURCEDIRS += . $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU_DIRS_CONCAT) $(MODULEDIRS) $(EXTERNALDIRS)
vpath %.c $(SOURCEDIRS)
vpath %.S $(SOURCEDIRS)
......@@ -340,13 +343,13 @@ clean:
@echo Target $(TARGET) cleaned
distclean:
@for TARG in `ls $(ARCH_PATH)/platform $(TARGETDIRS)`; do \
@for TARG in `ls $(CONTIKI_NG_RELOC_PLATFORM_DIR) $(TARGETDIRS)`; do \
echo Running: $(MAKE) TARGET=$$TARG clean; \
$(MAKE) TARGET=$$TARG clean; \
done
-$(Q)rm -rf $(BUILD_DIR)
-include $(ARCH_PATH)/platform/$(TARGET)/Makefile.customrules-$(TARGET)
-include $(CONTIKI_NG_RELOC_PLATFORM_DIR)/$(TARGET)/Makefile.customrules-$(TARGET)
ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
......@@ -428,7 +431,7 @@ endif
include $(CONTIKI)/Makefile.help
targets:
@ls $(ARCH_PATH)/platform $(TARGETDIRS)
@ls $(CONTIKI_NG_RELOC_PLATFORM_DIR) $(TARGETDIRS)
boards:
ifdef BOARD
......@@ -450,7 +453,7 @@ savedefines:
@echo "saving Makefile.$(TARGET).defines"
@echo >Makefile.$(TARGET).defines "DEFINES = $(DEFINES)"
VIEWCONF = $(CONTIKI)/tools/viewconf/viewconf.c
VIEWCONF = $(CONTIKI_NG_TOOLS_DIR)/viewconf/viewconf.c
viewconf:
@echo "----------------- Make variables: --------------"
@echo "##### \"TARGET\": ________________________________ $(TARGET)"
......
......@@ -2,8 +2,7 @@
# under the tools/ dir. For those dependencies, we use this makefile here to
# recursively invoke the respective build under tools/.
TOOLS_DIR = $(CONTIKI)/tools
SERIAL_IO_TOOL_DIR = $(TOOLS_DIR)/serial-io
SERIAL_IO_TOOL_DIR = $(CONTIKI_NG_TOOLS_DIR)/serial-io
SERIAL_IO_TOOL_DEPS = $(addprefix $(SERIAL_IO_TOOL_DIR)/, tools-utils.c tools-utils.h)
......
......@@ -3,6 +3,7 @@
# Contiki-NG: The OS for Next Generation IoT Devices
[![Build Status](https://travis-ci.org/contiki-ng/contiki-ng.svg?branch=master)](https://travis-ci.org/contiki-ng/contiki-ng/branches)
[![Documentation Status](https://readthedocs.org/projects/contiki-ng/badge/?version=master)](https://contiki-ng.readthedocs.io/en/master/?badge=master)
[![license](https://img.shields.io/badge/license-3--clause%20bsd-brightgreen.svg)](https://github.com/contiki-ng/contiki-ng/blob/master/LICENSE.md)
[![Latest release](https://img.shields.io/github/release/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/releases/latest)
[![GitHub Release Date](https://img.shields.io/github/release-date/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/releases/latest)
......@@ -23,6 +24,7 @@ Find out more:
* GitHub repository: https://github.com/contiki-ng/contiki-ng
* Documentation: https://github.com/contiki-ng/contiki-ng/wiki
* Web site: http://contiki-ng.org
* Nightly testbed runs: https://contiki-ng.github.io/testbed
Engage with the community:
......
# Security Policy
## Supported Versions
We will always apply vulnerability fixes on branch `develop` and include them
in the next release. Depending on the severity, we will consider hotfixing
the most recent release too. Older releases will not be hotfixed.
| Version | Supported |
| ------- | ------------------ |
| branch `develop` | :white_check_mark: |
| [latest release](https://github.com/contiki-ng/contiki-ng/releases/latest) | :question: |
| older releases | :x: |
## Reporting a Vulnerability
To report a vulnerability privately please email security@contiki-ng.org
We will try to confirm or decline your report ASAP by email. For accepted
vulnerability reports we will create an [advisory](https://github.com/contiki-ng/contiki-ng/security/advisories)
and, if you wish, invite you to the discussion.
......@@ -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 $(ARCH_PATH)/cpu/arm/Makefile.arm
include $(CONTIKI)/$(CONTIKI_NG_ARM_DIR)/Makefile.arm
......@@ -6,4 +6,4 @@ LDFLAGS += -mcpu=cortex-m3 -nostartfiles
TARGET_LIBFILES += -lm
include $(ARCH_PATH)/cpu/arm/cortex-m/Makefile.cortex-m
include $(CONTIKI)/$(CONTIKI_NG_CORTEX_DIR)/Makefile.cortex-m
......@@ -4,4 +4,4 @@ CFLAGS += -mcpu=cortex-m4
LDFLAGS += -mcpu=cortex-m4
include $(ARCH_PATH)/cpu/arm/cortex-m/Makefile.cortex-m
include $(CONTIKI)/$(CONTIKI_NG_CORTEX_DIR)/Makefile.cortex-m
......@@ -52,4 +52,4 @@ $(LDSCRIPT): $(SOURCE_LDSCRIPT) FORCE | $(OBJECTDIR)
$(TRACE_CC)
$(Q)$(CC) $(LDGENFLAGS) $< | grep -v '^\s*#\s*pragma\>' > $@
include $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3
include $(CONTIKI)/$(CONTIKI_NG_CM3_DIR)/Makefile.cm3
......@@ -263,11 +263,6 @@
#ifndef NETSTACK_CONF_RADIO
#define NETSTACK_CONF_RADIO cc2538_rf_driver
#endif
/**
* \brief Maximum packet size
*/
#define cc2538_rf_driver_max_payload_len 125
/** @} */
/*---------------------------------------------------------------------------*/
/**
......
......@@ -148,6 +148,13 @@ static radio_result_t get_value(radio_param_t param, radio_value_t *value);
#define OUTPUT_POWER_MIN (output_power[OUTPUT_CONFIG_COUNT - 1].power)
#define OUTPUT_POWER_MAX (output_power[0].power)
/*---------------------------------------------------------------------------*/
/*
* The maximum number of bytes this driver can accept from the MAC layer for
* transmission or will deliver to the MAC layer after reception. Includes
* the MAC header and payload, but not the FCS.
*/
#define MAX_PAYLOAD_LEN (CC2538_RF_MAX_PACKET_LEN - CHECKSUM_LEN)
/*---------------------------------------------------------------------------*/
PROCESS(cc2538_rf_process, "cc2538 RF driver");
/*---------------------------------------------------------------------------*/
/**
......@@ -600,7 +607,7 @@ prepare(const void *payload, unsigned short payload_len)
{
uint8_t i;
if(payload_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
if(payload_len > MAX_PAYLOAD_LEN) {
return RADIO_TX_ERR;
}
......@@ -665,7 +672,7 @@ transmit(unsigned short transmit_len)
LOG_INFO("Transmit\n");
if(transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
if(transmit_len > MAX_PAYLOAD_LEN) {
return RADIO_TX_ERR;
}
......@@ -934,6 +941,9 @@ get_value(radio_param_t param, radio_value_t *value)
case RADIO_CONST_DELAY_BEFORE_DETECT:
*value = (radio_value_t)CC2538_DELAY_BEFORE_DETECT;
return RADIO_RESULT_OK;
case RADIO_CONST_MAX_PAYLOAD_LEN:
*value = (radio_value_t)MAX_PAYLOAD_LEN;
return RADIO_RESULT_OK;
default:
return RADIO_RESULT_NOT_SUPPORTED;
}
......
CPU_ABS_PATH = arch/cpu/cc26x0-cc13x0
CPU_ABS_PATH = $(CONTIKI_NG_ARCH_CPU_DIR)/cc26x0-cc13x0
TI_XXWARE = $(CONTIKI_CPU)/$(TI_XXWARE_PATH)
ifeq (,$(wildcard $(TI_XXWARE)/*))
......@@ -57,7 +57,7 @@ ifdef PORT
BSL_FLAGS += -p $(PORT)
endif
BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py
BSL = $(CONTIKI_NG_TOOLS_DIR)/cc2538-bsl/cc2538-bsl.py
### Always re-build ieee-addr.o in case the command line passes a new NODEID
FORCE:
......@@ -82,7 +82,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 $(ARCH_PATH)/cpu/arm/cortex-m/cm3/Makefile.cm3
include $(CONTIKI)/$(CONTIKI_NG_CM3_DIR)/Makefile.cm3
ifeq ($(BOARD_SUPPORTS_BSL),1)
%.upload: $(OUT_BIN)
......
......@@ -104,14 +104,6 @@
#ifndef AES_128_CONF
#define AES_128_CONF cc26xx_aes_128_driver
#endif /* AES_128_CONF */
/* This is fixed */
#define ieee_mode_driver_max_payload_len 125
/* This maybe changed in the future, with software upgrade */
#define prop_mode_driver_max_payload_len 125
/* This is not used, but needs to be defined in order to compile */
#define ble_cc2650_driver_max_payload_len 125
/** @} */
/*---------------------------------------------------------------------------*/
/**
......
......@@ -49,10 +49,11 @@
#include <stdbool.h>
#include <stdint.h>
/*---------------------------------------------------------------------------*/
/* Watchdog timer interval, in milliseconds */
#ifdef CONTIKI_WATCHDOG_CONF_TIMER_TOP
#define CONTIKI_WATCHDOG_TIMER_TOP CONTIKI_WATCHDOG_CONF_TIMER_TOP
#else
#define CONTIKI_WATCHDOG_TIMER_TOP 0xFFFFF
#define CONTIKI_WATCHDOG_TIMER_TOP 1100
#endif
#ifdef CONTIKI_WATCHDOG_CONF_LOCK_CONFIG
......@@ -61,6 +62,9 @@
#define CONTIKI_WATCHDOG_LOCK_CONFIG 1
#endif
/* Convert timer interval from ms to ticks. Clock runs at 48 MHz / 32 */
#define WATCHDOG_TIMER_TOP_TICK ((48000 / 32) * CONTIKI_WATCHDOG_TIMER_TOP)
#define LOCK_INTERRUPTS_DISABLED 0x01
#define LOCK_REGISTERS_UNLOCKED 0x02
/*---------------------------------------------------------------------------*/
......@@ -107,7 +111,7 @@ lock_config(uint32_t status)
void
watchdog_init(void)
{
ti_lib_watchdog_reload_set(CONTIKI_WATCHDOG_TIMER_TOP);
ti_lib_watchdog_reload_set(WATCHDOG_TIMER_TOP_TICK);
lock_config(LOCK_REGISTERS_UNLOCKED);
}
/*---------------------------------------------------------------------------*/
......@@ -131,7 +135,7 @@ watchdog_start(void)
void
watchdog_periodic(void)
{
ti_lib_watchdog_reload_set(CONTIKI_WATCHDOG_TIMER_TOP);
ti_lib_watchdog_reload_set(WATCHDOG_TIMER_TOP_TICK);
ti_lib_watchdog_int_clear();
}
/*---------------------------------------------------------------------------*/
......
......@@ -65,12 +65,15 @@ LIST(modules_list);
* Don't consider standby mode if the next AON RTC event is scheduled to fire
* in less than STANDBY_MIN_DURATION rtimer ticks
*/
#define STANDBY_MIN_DURATION (RTIMER_SECOND / 100) /* 10.0 ms */
#define STANDBY_MIN_DURATION (RTIMER_SECOND / 100) /* 10.0 ms */
/* Wake up this much time earlier before the next rtimer */
#define SLEEP_GUARD_TIME (RTIMER_SECOND / 1000) /* 1.0 ms */
#define SLEEP_GUARD_TIME (RTIMER_SECOND / 1000) /* 1.0 ms */
/* Maximum allowed sleep-time, must be shorter than watchdog timeout */
#define MAX_SLEEP_TIME RTIMER_SECOND
/* Minimal safe sleep-time */
#define MIN_SAFE_SCHEDULE 8u
/*---------------------------------------------------------------------------*/
/* Prototype of a function in clock.c. Called every time we come out of DS */
......@@ -382,6 +385,9 @@ lpm_sleep(void)
ti_lib_prcm_sleep();
/* Kick watchdog to ensure a full interval is available after sleep */
watchdog_periodic();
ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
}
/*---------------------------------------------------------------------------*/
......
......@@ -181,6 +181,19 @@ static rfc_CMD_IEEE_MOD_FILT_t filter_cmd;
*/
static uint8_t cmd_ieee_rx_buf[RF_CMD_BUFFER_SIZE] CC_ALIGN(4);
/*---------------------------------------------------------------------------*/
/*
* The number of bytes appended at the end of an outgoing frame as a footer
* Currently fixed at 2 bytes for IEEE 802.15.4 compliance.
*/
#define CHECKSUM_LEN 2
/*
* The maximum number of bytes this driver can accept from the MAC layer for
* transmission or will deliver to the MAC layer after reception. Includes
* the MAC header and payload, but not the FCS.
*/
#define MAX_PAYLOAD_LEN (127 - CHECKSUM_LEN)
/*---------------------------------------------------------------------------*/
#define DATA_ENTRY_LENSZ_NONE 0
#define DATA_ENTRY_LENSZ_BYTE 1
#define DATA_ENTRY_LENSZ_WORD 2 /* 2 bytes */
......@@ -198,7 +211,7 @@ static uint8_t cmd_ieee_rx_buf[RF_CMD_BUFFER_SIZE] CC_ALIGN(4);
#define RX_BUF_DATA_OFFSET (RX_BUF_LENGTH_OFFSET + 1)
#define RX_BUF_SIZE (RX_BUF_DATA_OFFSET \
+ NETSTACK_RADIO_MAX_PAYLOAD_LEN \
+ MAX_PAYLOAD_LEN \
+ RX_BUF_METADATA_SIZE)
/* Four receive buffers entries with room for 1 IEEE802.15.4 frame in each */
......@@ -767,7 +780,7 @@ init(void)
static int
prepare(const void *payload, unsigned short payload_len)
{
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > MAX_PAYLOAD_LEN) {
return RADIO_TX_ERR;
}
......@@ -786,7 +799,7 @@ transmit(unsigned short transmit_len)
rtimer_clock_t t0;
volatile rfc_CMD_IEEE_TX_t cmd;
if(transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
if(transmit_len > MAX_PAYLOAD_LEN) {
PRINTF("transmit: too long\n");
return RADIO_TX_ERR;
}
......@@ -1283,6 +1296,9 @@ get_value(radio_param_t param, radio_value_t *value)
case RADIO_CONST_DELAY_BEFORE_DETECT:
*value = (radio_value_t)RADIO_DELAY_BEFORE_DETECT;
return RADIO_RESULT_OK;
case RADIO_CONST_MAX_PAYLOAD_LEN:
*value = (radio_value_t)MAX_PAYLOAD_LEN;
return RADIO_RESULT_OK;
default:
return RADIO_RESULT_NOT_SUPPORTED;
}
......
......@@ -156,6 +156,24 @@ static rfc_propRxOutput_t rx_stats;
#define DOT_4G_PHR_DW_BIT 0
#endif
/*---------------------------------------------------------------------------*/
/*
* The maximum number of bytes this driver can accept from the MAC layer for
* transmission or will deliver to the MAC layer after reception. Includes
* the MAC header and payload, but not the CRC.
*
* Unlike typical 2.4GHz radio drivers, this driver supports the .15.4g
* 32-bit CRC option.
*
* This radio hardware is perfectly happy to transmit frames longer than 127
* bytes, which is why it's OK to end up transmitting 125 payload bytes plus
* a 4-byte CRC.
*
* In the future we can change this to support transmission of long frames,
* for example as per .15.4g. the size of the TX and RX buffers would need
* adjusted accordingly.
*/
#define MAX_PAYLOAD_LEN 125
/*---------------------------------------------------------------------------*/
/* TX power table for the 431-527MHz band */
#ifdef PROP_MODE_CONF_TX_POWER_431_527
#define PROP_MODE_TX_POWER_431_527 PROP_MODE_CONF_TX_POWER_431_527
......@@ -217,7 +235,7 @@ static const prop_mode_tx_power_config_t *tx_power_current = &TX_POWER_DRIVER[1]
#define ALIGN_TO_4(size) (((size) + 3) & ~3)
#define RX_BUF_SIZE ALIGN_TO_4(RX_BUF_DATA_OFFSET \
+ NETSTACK_RADIO_MAX_PAYLOAD_LEN \
+ MAX_PAYLOAD_LEN \
+ RX_BUF_METADATA_SIZE)
/*
......@@ -661,7 +679,7 @@ init(void)
static int
prepare(const void *payload, unsigned short payload_len)
{
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
if(payload_len > TX_BUF_PAYLOAD_LEN || payload_len > MAX_PAYLOAD_LEN) {
return RADIO_TX_ERR;
}
......@@ -680,7 +698,7 @@ transmit(unsigned short transmit_len)
/* Length in .15.4g PHY HDR. Includes the CRC but not the HDR itself */
uint16_t total_length;
if(transmit_len > NETSTACK_RADIO_MAX_PAYLOAD_LEN) {
if(transmit_len > MAX_PAYLOAD_LEN) {
PRINTF("transmit: too long\n");
return RADIO_TX_ERR;
}
......@@ -817,10 +835,29 @@ static int
read_frame(void *buf, unsigned short buf_len)
{
rfc_dataEntryGeneral_t *entry = (rfc_dataEntryGeneral_t *)rx_read_entry;
uint8_t *data_ptr = &entry->data;
uint8_t *data_ptr;
int len = 0;
uint32_t rat_timestamp;
int is_found