Merge branch 'develop' into wip/button-hal

This commit is contained in:
Joakim Eriksson 2018-03-21 07:19:51 +01:00 committed by GitHub
commit 0c31f4dd95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 140 additions and 8 deletions

View File

@ -116,7 +116,7 @@ set_rf_params(void)
{
uint8_t ext_addr[8];
#if MAKE_MAC == MAKE_MAC_BLE
#if MAC_CONF_WITH_BLE
ble_eui64_addr_cpy_to((uint8_t *)&ext_addr);
NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8);
#else
@ -189,7 +189,7 @@ platform_init_stage_two()
#endif
/* Populate linkaddr_node_addr */
#if MAKE_MAC == MAKE_MAC_BLE
#if MAC_CONF_WITH_BLE
uint8_t ext_addr[8];
ble_eui64_addr_cpy_to((uint8_t *)&ext_addr);
memcpy(&linkaddr_node_addr, &ext_addr[8 - LINKADDR_SIZE], LINKADDR_SIZE);

View File

@ -186,7 +186,7 @@ int
sixp_nbr_init(void)
{
sixp_nbr_t *nbr, *next_nbr;
if(nbr_table_is_register(sixp_nbrs) == 0) {
if(nbr_table_is_registered(sixp_nbrs) == 0) {
nbr_table_register(sixp_nbrs, NULL);
} else {
/* remove all the existing nbrs */

View File

@ -290,6 +290,13 @@ nbr_table_register(nbr_table_t *table, nbr_table_callback *callback)
ctimer_set(&periodic_timer, CLOCK_SECOND * 60, handle_periodic_timer, NULL);
}
#endif
if(nbr_table_is_registered(table)) {
/* Table already registered, just update callback */
table->callback = callback;
return 1;
}
if(num_tables < MAX_NUM_TABLES) {
table->index = num_tables++;
table->callback = callback;
@ -303,9 +310,10 @@ nbr_table_register(nbr_table_t *table, nbr_table_callback *callback)
/*---------------------------------------------------------------------------*/
/* Test whether a specified table has been registered or not */
int
nbr_table_is_register(nbr_table_t *table)
nbr_table_is_registered(nbr_table_t *table)
{
if(table != NULL && all_tables[table->index] == table) {
if(table != NULL && table->index >= 0 && table->index < MAX_NUM_TABLES
&& all_tables[table->index] == table) {
return 1;
}
return 0;
@ -490,4 +498,3 @@ handle_periodic_timer(void *ptr)
ctimer_reset(&periodic_timer);
}
#endif

View File

@ -92,7 +92,7 @@ typedef enum {
/** \name Neighbor tables: register and loop through table elements */
/** @{ */
int nbr_table_register(nbr_table_t *table, nbr_table_callback *callback);
int nbr_table_is_register(nbr_table_t *table);
int nbr_table_is_registered(nbr_table_t *table);
nbr_table_item_t *nbr_table_head(nbr_table_t *table);
nbr_table_item_t *nbr_table_next(nbr_table_t *table, nbr_table_item_t *item);
/** @} */

View File

@ -716,7 +716,6 @@ void
rpl_dag_init(void)
{
memset(&curr_instance, 0, sizeof(curr_instance));
rpl_neighbor_init();
}
/*---------------------------------------------------------------------------*/
/** @} */

1
tools/vagrant/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.vagrant

1
tools/vagrant/README.md Normal file
View File

@ -0,0 +1 @@
Instructions can be fonud at https://github.com/contiki-ng/contiki-ng/wiki/Vagrant

48
tools/vagrant/Vagrantfile vendored Normal file
View File

@ -0,0 +1,48 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "ubuntu/xenial64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "../../", "/home/vagrant/contiki-ng"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
end

76
tools/vagrant/bootstrap.sh Executable file
View File

@ -0,0 +1,76 @@
#!/usr/bin/env bash
# i386 binary support on x64 system
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y --no-install-recommends \
libc6:i386 libstdc++6:i386 libncurses5:i386 libz1:i386
# Tools
sudo apt-get install -y --no-install-recommends \
build-essential doxygen git wget unzip python-serial \
default-jdk ant srecord python-pip iputils-tracepath uncrustify python-magic
sudo apt-get clean
sudo python2 -m pip install intelhex
# Install ARM toolchain
wget https://launchpad.net/gcc-arm-embedded/5.0/5-2015-q4-major/+download/gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2
tar xjf gcc-arm-none-eabi-5_2-2015q4-20151219-linux.tar.bz2 -C /tmp/
sudo cp -f -r /tmp/gcc-arm-none-eabi-5_2-2015q4/* /usr/local/
rm -rf /tmp/gcc-arm-none-eabi-* gcc-arm-none-eabi-*-linux.tar.bz2
# Install msp430 toolchain
wget http://simonduq.github.io/resources/mspgcc-4.7.2-compiled.tar.bz2
tar xjf mspgcc*.tar.bz2 -C /tmp/
sudo cp -f -r /tmp/msp430/* /usr/local/
rm -rf /tmp/msp430 mspgcc*.tar.bz2
# Install NXP toolchain (partial, with binaries excluded. Download from nxp.com)
wget http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part1.tar.bz2
wget http://simonduq.github.io/resources/ba-elf-gcc-4.7.4-part2.tar.bz2
wget http://simonduq.github.io/resources/jn516x-sdk-4163-1416.tar.bz2
mkdir -p /tmp/jn516x-sdk /tmp/ba-elf-gcc
tar xjf jn516x-sdk-*.tar.bz2 -C /tmp/jn516x-sdk
tar xjf ba-elf-gcc-*part1.tar.bz2 -C /tmp/ba-elf-gcc
tar xjf ba-elf-gcc-*part2.tar.bz2 -C /tmp/ba-elf-gcc
sudo cp -f -r /tmp/jn516x-sdk /usr/
sudo cp -f -r /tmp/ba-elf-gcc /usr/
rm -rf jn516x*.bz2 ba-elf-gcc*.bz2 /tmp/ba-elf-gcc* /tmp/jn516x-sdk*
echo 'export PATH="/usr/ba-elf-gcc/bin:${PATH}"' >> ${HOME}/.bashrc
## Install nRF52 SDK
wget https://developer.nordicsemi.com/nRF5_IoT_SDK/nRF5_IoT_SDK_v0.9.x/nrf5_iot_sdk_3288530.zip
sudo mkdir -p /usr/nrf52-sdk
sudo unzip nrf5_iot_sdk_3288530.zip -d /usr/nrf52-sdk
rm nrf5_iot_sdk_3288530.zip
echo "export NRF52_SDK_ROOT=/usr/nrf52-sdk" >> ${HOME}/.bashrc
sudo usermod -aG dialout vagrant
# Environment variables
echo "export JAVA_HOME=/usr/lib/jvm/default-java" >> ${HOME}/.bashrc
echo "export CONTIKI_NG=${HOME}/contiki-ng" >> ${HOME}/.bashrc
echo "export COOJA=${CONTIKI_NG}/tools/cooja" >> ${HOME}/.bashrc
echo "export PATH=${HOME}:${PATH}" >> ${HOME}/.bashrc
echo "export WORKDIR=${HOME}" >> ${HOME}/.bashrc
source ${HOME}/.bashrc
# Create Cooja shortcut
echo "#!/bin/bash\nant -Dbasedir=${COOJA} -f ${COOJA}/build.xml run" > ${HOME}/cooja && chmod +x ${HOME}/cooja
# Install coap-cli
sudo apt-get install -y npm
sudo apt-get clean
sudo npm install coap-cli -g
sudo ln -s /usr/bin/nodejs /usr/bin/node
# Docker
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker vagrant
# Docker image "Contiker" alias
echo 'alias contiker="docker run --privileged --mount type=bind,source=$CONTIKI_NG,destination=/home/user/contiki-ng -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -ti simonduq/contiki-ng"' >> /home/vagrant/.bashrc
source ${HOME}/.bashrc