Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/zoul-pm
Browse files Browse the repository at this point in the history
  • Loading branch information
g-oikonomou authored May 3, 2019
2 parents 2c2b017 + fc08d99 commit 11c03c4
Show file tree
Hide file tree
Showing 47 changed files with 2,728 additions and 67 deletions.
27 changes: 27 additions & 0 deletions Makefile.gcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- makefile -*-
#
# GCC specific definitions and actions
#

GCC_MAJOR_VERSION := $(shell $(CC) -v 2>&1 | grep "gcc version" | cut -b 13)
GCC_MINOR_VERSION := $(shell $(CC) -v 2>&1 | grep "gcc version" | cut -b 15)

# Warn if using version 6.3.x of arm-none-eabi-gcc
ifeq ("$(CC)","arm-none-eabi-gcc")
ifeq (6,$(GCC_MAJOR_VERSION))
ifeq (3,$(GCC_MINOR_VERSION))
$(warning Warning: you're using a version of $(CC) that may create broken Contiki-NG executables.)
$(warning We recommend to upgrade or downgrade your toolchain.)
endif
endif
endif

# Warn if using 4.6.x or older msp430-gcc
ifeq ("$(CC)","msp430-gcc")
ifeq ($(shell test $(GCC_MAJOR_VERSION) -lt 5; echo $$?),0)
ifeq ($(shell test $(GCC_MINOR_VERSION) -lt 7; echo $$?),0)
$(warning Warning: you're using an old version of $(CC).)
$(warning Upgrade to 4.7.x is recommended for extended memory support and bugfixes.)
endif
endif
endif
5 changes: 4 additions & 1 deletion Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI_CPU)/, \
CONTIKI_ARCH_DIRS = ${addprefix $(CONTIKI)/, arch}

SOURCEDIRS = . $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) $(CONTIKI_ARCH_DIRS) \
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(MODULEDIRS) $(EXTERNALDIRS) ${dir $(target_makefile)}
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(MODULEDIRS) $(EXTERNALDIRS)

vpath %.c $(SOURCEDIRS)
vpath %.S $(SOURCEDIRS)
Expand Down Expand Up @@ -469,6 +469,9 @@ ifeq ($(findstring $(TARGET),native cooja),)
include $(CONTIKI)/Makefile.embedded
endif

### Include Makefile.gcc for GCC specific definitions and actions
include $(CONTIKI)/Makefile.gcc

# Don't treat $(BUILD_DIR_BOARD)/%.$(TARGET) and $(TARGET) as intermediate
# files because for many platforms they are in fact the primary target.
.PRECIOUS: $(BUILD_DIR_BOARD)/%.$(TARGET) %.$(TARGET)
Expand Down
2 changes: 1 addition & 1 deletion arch/cpu/cc26x0-cc13x0/Makefile.cc26x0-cc13x0
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ else
endif

### For the login etc targets
BAUDRATE = 115200
BAUDRATE ?= 115200
43 changes: 40 additions & 3 deletions arch/cpu/cc26x0-cc13x0/rf-core/prop-mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@

static int8_t rssi_threshold = PROP_MODE_RSSI_THRESHOLD;
/*---------------------------------------------------------------------------*/
#if MAC_CONF_WITH_TSCH
static volatile uint8_t is_receiving_packet;
#endif
/*---------------------------------------------------------------------------*/
static int on(void);
static int off(void);
Expand Down Expand Up @@ -645,9 +647,6 @@ init(void)
return RF_CORE_CMD_ERROR;
}

/* Enable the "sync word seen" interrupt */
ti_lib_rfc_hw_int_enable(RFC_DBELL_RFHWIEN_MDMSOFT);

ENERGEST_ON(ENERGEST_TYPE_LISTEN);

rf_core_primary_mode_register(&mode_prop);
Expand Down Expand Up @@ -822,8 +821,10 @@ read_frame(void *buf, unsigned short buf_len)
while(entry->status == DATA_ENTRY_STATUS_BUSY
&& RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (RTIMER_SECOND / 50)));

#if MAC_CONF_WITH_TSCH
/* Make sure the flag is reset */
is_receiving_packet = 0;
#endif

if(entry->status != DATA_ENTRY_STATUS_FINISHED) {
/* No available data */
Expand Down Expand Up @@ -937,6 +938,14 @@ receiving_packet(void)
return 0;
}

#if MAC_CONF_WITH_TSCH
/*
* Under TSCH operation, we rely on "hints" from the MDMSOFT interrupt
* flag. This flag is set by the radio upon sync word detection, but it is
* not cleared automatically by hardware. We store state in a variable after
* first call. The assumption is that the TSCH code will keep calling us
* until frame reception has completed, at which point we can clear MDMSOFT.
*/
if(!is_receiving_packet) {
/* Look for the modem synchronization word detection interrupt flag.
* This flag is raised when the synchronization word is received.
Expand All @@ -954,6 +963,34 @@ receiving_packet(void)
}

return is_receiving_packet;
#else
/*
* Under CSMA operation, there is no immediately straightforward logic as to
* when it's OK to clear the MDMSOFT interrupt flag:
*
* - We cannot re-use the same logic as above, since CSMA may bail out of
* frame TX immediately after a single call this function here. In this
* scenario, is_receiving_packet would remain equal to one and we would
* therefore erroneously signal ongoing RX in subsequent calls to this
* function here, even _after_ reception has completed.
* - We can neither clear inside read_frame() nor inside the RX frame
* interrupt handler (remember, we are not in poll mode under CSMA),
* since we risk clearing MDMSOFT after we have seen a sync word for the
* _next_ frame. If this happens, this function here would incorrectly
* return 0 during RX of this next frame.
*
* So to avoid a very convoluted logic of how to handle MDMSOFT, we simply
* perform a clear channel assessment here: We interpret channel activity
* as frame reception.
*/

if(channel_clear() == RF_CORE_CCA_CLEAR) {
return 0;
}

return 1;

#endif
}
/*---------------------------------------------------------------------------*/
static int
Expand Down
2 changes: 1 addition & 1 deletion arch/platform/cc26x0-cc13x0/launchpad/board-buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup launchpad-cc26xx-peripherals
* \addtogroup launchpad-peripherals
* @{
*
* \file
Expand Down
4 changes: 2 additions & 2 deletions arch/platform/zoul/Makefile.zoul
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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)
CONTIKI_TARGET_DIRS += $(BOARD)
PLATFORM_ROOT_DIR = $(ARCH_PATH)/platform/$(TARGET)

### Include the board dir if one exists
Expand Down Expand Up @@ -86,5 +86,5 @@ zoul-motes:
@echo $(MOTES)

### For the login etc targets
BAUDRATE = 115200
BAUDRATE ?= 115200
PORT = $(USBDEVPREFIX)$(firstword $(MOTES))
3 changes: 2 additions & 1 deletion examples/libs/stack-check/example-stack-check.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@
#include <stdio.h>
#include <string.h>
#include <alloca.h>
#include <inttypes.h>
/*---------------------------------------------------------------------------*/
PROCESS(example_process, "Stack check example");
AUTOSTART_PROCESSES(&example_process);
/*---------------------------------------------------------------------------*/
static void
nested_function(void)
{
printf("stack usage: %u permitted: %u\n",
printf("stack usage: %" PRId32 " permitted: %" PRId32 "\n",
stack_check_get_usage(), stack_check_get_reserved_size());
}
/*---------------------------------------------------------------------------*/
Expand Down
4 changes: 3 additions & 1 deletion examples/multicast/project-conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@

/* Change this to switch engines. Engine codes in uip-mcast6-engines.h */
#ifndef UIP_MCAST6_CONF_ENGINE
#define UIP_MCAST6_CONF_ENGINE UIP_MCAST6_ENGINE_ROLL_TM
#define UIP_MCAST6_CONF_ENGINE UIP_MCAST6_ENGINE_MPL
#endif

/* For Imin: Use 16 over CSMA, 64 over Contiki MAC */
#define ROLL_TM_CONF_IMIN_1 64
#define MPL_CONF_DATA_MESSAGE_IMIN 64
#define MPL_CONF_CONTROL_MESSAGE_IMIN 64

#define UIP_MCAST6_ROUTE_CONF_ROUTES 1

Expand Down
8 changes: 8 additions & 0 deletions examples/multicast/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,19 @@ prepare_mcast(void)
{
uip_ipaddr_t ipaddr;

#if UIP_MCAST6_CONF_ENGINE == UIP_MCAST6_ENGINE_MPL
/*
* MPL defines a well-known MPL domain, MPL_ALL_FORWARDERS, which
* MPL nodes are automatically members of. Send to that domain.
*/
uip_ip6addr(&ipaddr, 0xFF03,0,0,0,0,0,0,0xFC);
#else
/*
* IPHC will use stateless multicast compression for this destination
* (M=1, DAC=0), with 32 inline bits (1E 89 AB CD)
*/
uip_ip6addr(&ipaddr, 0xFF1E,0,0,0,0,0,0x89,0xABCD);
#endif
mcast_conn = udp_new(&ipaddr, UIP_HTONS(MCAST_SINK_UDP_PORT), NULL);
}
/*---------------------------------------------------------------------------*/
Expand Down
8 changes: 8 additions & 0 deletions examples/multicast/sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ tcpip_handler(void)
return;
}
/*---------------------------------------------------------------------------*/
#if UIP_MCAST6_CONF_ENGINE != UIP_MCAST6_ENGINE_MPL
static uip_ds6_maddr_t *
join_mcast_group(void)
{
Expand All @@ -101,17 +102,24 @@ join_mcast_group(void)
}
return rv;
}
#endif
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(mcast_sink_process, ev, data)
{
PROCESS_BEGIN();

PRINTF("Multicast Engine: '%s'\n", UIP_MCAST6.name);

/*
* MPL nodes are automatically configured to subscribe to the ALL_MPL_FORWARDERS
* well-known address, so this isn't needed.
*/
#if UIP_MCAST6_CONF_ENGINE != UIP_MCAST6_ENGINE_MPL
if(join_mcast_group() == NULL) {
PRINTF("Failed to join multicast group\n");
PROCESS_EXIT();
}
#endif

count = 0;

Expand Down
6 changes: 5 additions & 1 deletion examples/sensniff/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ include $(CONTIKI)/Makefile.identify-target

all: $(CONTIKI_PROJECT)

# Disable all networking layer 3 upwards
MAKE_NET=MAKE_NET_NULLNET

# use a custom MAC driver: sensniff_mac_driver
MAKE_MAC = MAKE_MAC_OTHER
include $(CONTIKI)/Makefile.include

PYTHON ?= python
SENSNIFF = $(CONTIKI)/tools/sensniff/sensniff.py
Expand All @@ -27,6 +29,8 @@ ifneq ($(PORT),)
SENSNIFF_FLAGS += -d $(PORT)
endif

include $(CONTIKI)/Makefile.include

sniff:
ifeq ($(wildcard $(SENSNIFF)), )
$(error Could not find the sensniff script. Did you run 'git submodule update --init' ?")
Expand Down
9 changes: 8 additions & 1 deletion examples/sensniff/sensniff-mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,19 @@ init(void)
on();
}
/*---------------------------------------------------------------------------*/
static int
max_payload(void)
{
return 0;
}
/*---------------------------------------------------------------------------*/
const struct mac_driver sensniff_mac_driver = {
"sensniff-rdc",
init,
send,
input,
on,
off
off,
max_payload,
};
/*---------------------------------------------------------------------------*/
Loading

0 comments on commit 11c03c4

Please sign in to comment.