From 1eb728806eaa4f96034f5e76973e8d62778788e8 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 15 Nov 2017 13:38:15 -0800 Subject: [PATCH 01/31] Added Dockerfile --- tools/docker/Dockerfile | 83 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 tools/docker/Dockerfile diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile new file mode 100644 index 000000000..2a3a08fa1 --- /dev/null +++ b/tools/docker/Dockerfile @@ -0,0 +1,83 @@ +FROM 32bit/ubuntu:16.04 + +# Tools +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + build-essential doxygen git wget unzip \ + default-jdk ant srecord iputils-tracepath && \ + apt-get clean + +# Install ARM toolchain +RUN 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/ && \ + 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 +RUN wget http://simonduq.github.io/resources/mspgcc-4.7.2-compiled.tar.bz2 && \ + tar xjf mspgcc*.tar.bz2 -C /tmp/ && \ + 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) +RUN 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 /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 && \ + cp -f -r /tmp/jn516x-sdk /usr/ && \ + cp -f -r /tmp/ba-elf-gcc /usr/ && \ + rm -rf jn516x*.bz2 ba-elf-gcc*.bz2 /tmp/ba-elf-gcc* /tmp/jn516x-sdk* + +ENV PATH="/usr/ba-elf-gcc/bin:${PATH}" + +## Install nRF52 SDK +RUN wget https://developer.nordicsemi.com/nRF5_IoT_SDK/nRF5_IoT_SDK_v0.9.x/nrf5_iot_sdk_3288530.zip && \ + mkdir /usr/nrf52-sdk && \ + unzip nrf5_iot_sdk_3288530.zip -d /usr/nrf52-sdk && \ + rm nrf5_iot_sdk_3288530.zip + +ENV NRF52_SDK_ROOT /usr/nrf52-sdk + +# Create user and enable X forwarding. Docker run option: +# -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix +RUN export uid=1000 gid=1000 && \ + mkdir -p /home/user && \ + echo "user:x:${uid}:${gid}:user,,,:/home/user:/bin/bash" >> /etc/passwd && \ + echo "user:x:${uid}:" >> /etc/group && \ + echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers && \ + chmod 0440 /etc/sudoers && \ + chown ${uid}:${gid} -R /home/user + +# Set user for what comes next +USER user + +# Environment variables +ENV JAVA_HOME /usr/lib/jvm/default-java +ENV HOME /home/user +ENV CONTIKI_NG ${HOME}/contiki-ng +ENV COOJA ${CONTIKI_NG}/tools/cooja +ENV PATH="${HOME}:${PATH}" +WORKDIR ${HOME} + +# Create Cooja shortcut +RUN echo "#!/bin/bash\nant -Dbasedir=${COOJA} -f ${COOJA}/build.xml run" > ${HOME}/cooja && \ + chmod +x ${HOME}/cooja + +# Optional: download Contiki-NG and pre-compile Cooja. +# Else, use a Docker bind mount to share the repo with the host. +# Docker run option: +# -v :/home/user/contiki-ng +#RUN git clone --recursive https://github.com/contiki-ng/contiki-ng.git ${CONTIKI_NG} +#RUN ant -q -f ${CONTIKI_NG}/tools/cooja/build.xml jar + +# Enable IPv6 -- must be done at runtime, not in Dockerfile +#RUN sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 + +# Working directory +WORKDIR ${CONTIKI_NG} + +# Start a bash +CMD bash From bf27636c6c42fb15f4d02eabbf8958003dc162d7 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 15 Nov 2017 14:00:13 -0800 Subject: [PATCH 02/31] Travis.yml: switch to Docker --- .travis.yml | 114 +++++++++++++--------------------------------------- 1 file changed, 27 insertions(+), 87 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb01368c9..9094189c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,93 +1,33 @@ -# Workaround for the issue found in the stable image promoted on Dec 1, 2016. -# See https://github.com/travis-ci/travis-ci/issues/6928#issuecomment-264227708 -group: deprecated - -before_install: - - sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 +# Setup environment for Docker +language: generic +services: docker notifications: - email: false -language: c #NOTE: this will set CC=gcc which might cause trouble -before_script: - - WGET="travis_retry wget --continue --tries=20 --waitretry=10 --retry-connrefused --no-dns-cache --timeout 300" - - sudo apt-get -qq update + - email: false - ## Support building a binary that is identical to the CI - - echo -n "Contiki-NG will be compiled with RELSTR=" ; git --git-dir .git describe --tags --always +before_install: + # Environment setup before test script + - export CNG_HOST_PATH=`pwd` + - export DOCKER_IMG='simonduq/contiki-ng:latest' + - sudo chgrp -hR 1000 $CNG_HOST_PATH + - docker pull $DOCKER_IMG + - ant -q -f $CNG_HOST_PATH/tools/cooja/build.xml jar - ## Install 32-bit compatibility libraries - - sudo apt-get -qq install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 - libstdc++5:i386 libstdc++6:i386 lib32z1 - - ## Install doxygen - - if [ ${BUILD_CATEGORY:-0} = doxygen ] ; then - sudo add-apt-repository ppa:libreoffice/ppa -y && sudo apt-get -qq update && - sudo apt-get --no-install-suggests --no-install-recommends -qq install doxygen && - doxygen --version ; - fi - - ## Install msp430 toolchain - - if [ ${BUILD_ARCH:-0} = msp430 ] ; then - $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 && - msp430-gcc --version ; - fi - - ## Install mainline ARM toolchain, srecord and nRF52 SDK - - if [ ${BUILD_ARCH:-0} = arm-aapcs ] ; then - sudo apt-get -qq install srecord && - $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 && - arm-none-eabi-gcc --version && - $WGET https://developer.nordicsemi.com/nRF5_IoT_SDK/nRF5_IoT_SDK_v0.9.x/nrf5_iot_sdk_3288530.zip && - mkdir /tmp/nrf52-sdk && - unzip nrf5_iot_sdk_3288530.zip -d /tmp/nrf52-sdk && - export NRF52_SDK_ROOT=/tmp/nrf52-sdk ; - fi - - ## Install NXP toolchain - - if [ ${BUILD_ARCH:-0} = jn516x ] ; then - $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 /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/ && - export PATH=/usr/ba-elf-gcc/bin:$PATH && - rm -rf /tmp/ba-elf-gcc* /tmp/jn516x-sdk* && - ba-elf-gcc --version ; - fi - - ## Compile cooja.jar only when it's going to be needed - - if [ ${BUILD_CATEGORY:-0} = sim ] ; then - java -version && - ant -q -f tools/cooja/build.xml jar && - sudo java -Xshare:dump -version ; - fi - -script: - ## tests/Makefile handles most of generic logic - - "make -C tests/??-$BUILD_TYPE" - - "tests/check-test.sh tests/??-$BUILD_TYPE; exit $?" +script: # The test script for each build. + - docker run --privileged -v $CNG_HOST_PATH:/home/user/contiki-ng -ti $DOCKER_IMG bash -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 $?; env: - ## This magically kick-off parallel jobs for each of the for the sets - ## of environment variable defined below - - BUILD_TYPE='compile-base' BUILD_CATEGORY='compile' BUILD_ARCH='msp430' - - BUILD_TYPE='compile-arm-ports-01' BUILD_CATEGORY='compile' BUILD_ARCH='arm-aapcs' - - BUILD_TYPE='compile-arm-ports-02' BUILD_CATEGORY='compile' BUILD_ARCH='arm-aapcs' - - BUILD_TYPE='compile-nxp-ports' BUILD_CATEGORY='compile' BUILD_ARCH='jn516x' - - BUILD_TYPE='compile-tools' BUILD_CATEGORY='compile' - - BUILD_TYPE='rpl-lite' BUILD_CATEGORY='sim' - - BUILD_TYPE='rpl-classic' BUILD_CATEGORY='sim' - - BUILD_TYPE='tun-rpl-br' BUILD_CATEGORY='sim' BUILD_ARCH='msp430' - - BUILD_TYPE='simulation-base' BUILD_CATEGORY='sim' BUILD_ARCH='msp430' - - BUILD_TYPE='ieee802154' BUILD_CATEGORY='sim' - - BUILD_TYPE='doxygen' BUILD_CATEGORY='doxygen' + # Parallel builds + - TEST_NAME='compile-base' + - TEST_NAME='compile-arm-ports-01' + - TEST_NAME='compile-arm-ports-02' + - TEST_NAME='rpl-lite' + - TEST_NAME='rpl-classic' + - TEST_NAME='tun-rpl-br' + - TEST_NAME='simulation-base' + - TEST_NAME='ieee802154' + - TEST_NAME='compile-nxp-ports' + - TEST_NAME='doxygen' + - TEST_NAME='compile-tools' From acb80082d4f990100bb3c4dcecd5b44d09e90f0a Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 23 Nov 2017 01:31:56 -0800 Subject: [PATCH 03/31] Dockerfile: enable node programming from container --- tools/docker/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 2a3a08fa1..ac3e975cb 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -3,7 +3,7 @@ FROM 32bit/ubuntu:16.04 # Tools RUN apt-get update && \ apt-get install -y --no-install-recommends \ - build-essential doxygen git wget unzip \ + build-essential doxygen git wget unzip python-serial \ default-jdk ant srecord iputils-tracepath && \ apt-get clean @@ -41,7 +41,7 @@ RUN wget https://developer.nordicsemi.com/nRF5_IoT_SDK/nRF5_IoT_SDK_v0.9.x/nrf5_ ENV NRF52_SDK_ROOT /usr/nrf52-sdk -# Create user and enable X forwarding. Docker run option: +# Create user, enable X forwarding, add to group dialout # -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix RUN export uid=1000 gid=1000 && \ mkdir -p /home/user && \ @@ -49,7 +49,8 @@ RUN export uid=1000 gid=1000 && \ echo "user:x:${uid}:" >> /etc/group && \ echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers && \ chmod 0440 /etc/sudoers && \ - chown ${uid}:${gid} -R /home/user + chown ${uid}:${gid} -R /home/user && \ + usermod -aG dialout user # Set user for what comes next USER user From a24a05f2699119801644c1eeea19c7743ac7ba9f Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 29 Nov 2017 08:39:10 -0800 Subject: [PATCH 04/31] Fix CoAP bug with option parsing --- os/net/app-layer/coap/coap.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/os/net/app-layer/coap/coap.c b/os/net/app-layer/coap/coap.c index da466e6d7..bcec49cee 100644 --- a/os/net/app-layer/coap/coap.c +++ b/os/net/app-layer/coap/coap.c @@ -544,8 +544,6 @@ coap_parse_message(void *packet, uint8_t *data, uint16_t data_len) return BAD_REQUEST_4_00; } - option_number += option_delta; - PRINTF("OPTION %u (delta %u, len %zu): ", option_number, option_delta, option_length); From 1cc148c4b4b6c287c3fd022510195f9cec765752 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 29 Nov 2017 08:39:23 -0800 Subject: [PATCH 05/31] Dockerfile: install coap-cli --- tools/docker/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index ac3e975cb..14c1636ae 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -77,6 +77,12 @@ RUN echo "#!/bin/bash\nant -Dbasedir=${COOJA} -f ${COOJA}/build.xml run" > ${HOM # Enable IPv6 -- must be done at runtime, not in Dockerfile #RUN sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 +# Install coap-cli +RUN 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 + # Working directory WORKDIR ${CONTIKI_NG} From 01d06c30df32cc52d4e231506bb2894e4f92da0b Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 29 Nov 2017 09:16:04 -0800 Subject: [PATCH 06/31] Added CI test for CoAP --- tests/17-tun-rpl-br/06-native-coap.sh | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 tests/17-tun-rpl-br/06-native-coap.sh diff --git a/tests/17-tun-rpl-br/06-native-coap.sh b/tests/17-tun-rpl-br/06-native-coap.sh new file mode 100755 index 000000000..a42424ee4 --- /dev/null +++ b/tests/17-tun-rpl-br/06-native-coap.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# Contiki directory +CONTIKI=$1 +# Test basename +BASENAME=06-native-coap + +IPADDR=fd00::302:304:506:708 + +declare -i OKCOUNT=0 +declare -i TESTCOUNT=0 + +echo "Enabling IPv6" +sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 + +# Starting Contiki-NG native node +echo "Starting native CoAP server" +make -C $CONTIKI/examples/coap > make.log 2> make.err +sudo $CONTIKI/examples/coap/coap-example-server.native > node.log 2> node.err & +CPID=$! +sleep 2 + +# Send CoAP requests +echo "Sending CoAP requests" + +rm -f $BASENAME.log +for TARGET in .well-known/core test/push; do + echo "Get $TARGET" | tee -a $BASENAME.log + coap get coap://[$IPADDR]/$TARGET 2>&1 | tee coap.log + cat coap.log >> $BASENAME.log + # Fetch coap status code (not $? because this is piped) + SUCCESS=`grep -c '(2.05)' coap.log` + if [ $SUCCESS == 1 ]; then + printf "> OK\n" + OKCOUNT+=1 + else + printf "> FAIL\n" + fi + TESTCOUNT+=1 +done + +echo "Closing native node" +sleep 2 +pgrep hello-world | sudo xargs kill -9 + +if [ $TESTCOUNT -eq $OKCOUNT ] ; then + printf "%-40s TEST OK %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" > $BASENAME.testlog; +else + echo "==== make.log ====" ; cat make.log; + echo "==== make.err ====" ; cat make.err; + echo "==== node.log ====" ; cat node.log; + echo "==== node.err ====" ; cat node.err; + echo "==== $BASENAME.log ====" ; cat $BASENAME.log; + + printf "%-32s TEST FAIL %3d/%d\n" "$BASENAME" "$OKCOUNT" "$TESTCOUNT" > $BASENAME.testlog; +fi + +rm -f make.log make.err node.log node.err coap.log + +# We do not want Make to stop -> Return 0 +# The Makefile will check if a log contains FAIL at the end +exit 0 From 11b50009e99e81617ffbc812209a20f0ea72aeff Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Thu, 30 Nov 2017 15:20:52 +0100 Subject: [PATCH 07/31] Extend the logging module to support custom module prefix --- os/sys/log-conf.h | 7 +++++++ os/sys/log.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/os/sys/log-conf.h b/os/sys/log-conf.h index 209d3d1ad..72570fe66 100644 --- a/os/sys/log-conf.h +++ b/os/sys/log-conf.h @@ -81,6 +81,13 @@ #define LOG_OUTPUT(...) printf(__VA_ARGS__) #endif /* LOG_CONF_OUTPUT */ +/* Custom log prefix output function -- default is LOG_OUTPUT */ +#ifdef LOG_CONF_OUTPUT_PREFIX +#define LOG_OUTPUT_PREFIX(level, levelstr, module) LOG_CONF_OUTPUT_PREFIX(level, levelstr, module) +#else /* LOG_CONF_OUTPUT_PREFIX */ +#define LOG_OUTPUT_PREFIX(level, levelstr, module) LOG_OUTPUT("[%-4s: %-10s] ", levelstr, module) +#endif /* LOG_CONF_OUTPUT_PREFIX */ + /******************************************************************************/ /********************* A list of currently supported modules ******************/ /******************************************************************************/ diff --git a/os/sys/log.h b/os/sys/log.h index d638bee7d..b0624bbc7 100644 --- a/os/sys/log.h +++ b/os/sys/log.h @@ -101,7 +101,7 @@ extern struct log_module all_modules[]; if(level <= (LOG_LEVEL)) { \ if(newline) { \ if(LOG_WITH_MODULE_PREFIX) { \ - LOG_OUTPUT("[%-4s: %-10s] ", levelstr, LOG_MODULE); \ + LOG_OUTPUT_PREFIX(level, levelstr, LOG_MODULE); \ } \ if(LOG_WITH_LOC) { \ LOG_OUTPUT("[%s: %d] ", __FILE__, __LINE__); \ From 91e3fa37d778a592c942e680db63df31b576746e Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Thu, 30 Nov 2017 22:40:07 +0100 Subject: [PATCH 08/31] Added comment to the custom module prefix function in the logging module. --- os/sys/log-conf.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/os/sys/log-conf.h b/os/sys/log-conf.h index 72570fe66..d52765c31 100644 --- a/os/sys/log-conf.h +++ b/os/sys/log-conf.h @@ -81,7 +81,16 @@ #define LOG_OUTPUT(...) printf(__VA_ARGS__) #endif /* LOG_CONF_OUTPUT */ -/* Custom log prefix output function -- default is LOG_OUTPUT */ +/* + * Custom output function to prefix logs with level and module. + * + * This will only be called when LOG_CONF_WITH_MODULE_PREFIX is enabled and + * all implementations should be based on LOG_OUTPUT. + * + * \param level The log level + * \param levelstr The log level as string + * \param module The module string descriptor + */ #ifdef LOG_CONF_OUTPUT_PREFIX #define LOG_OUTPUT_PREFIX(level, levelstr, module) LOG_CONF_OUTPUT_PREFIX(level, levelstr, module) #else /* LOG_CONF_OUTPUT_PREFIX */ From 8cefc3ea397590c94c39706644164649283c6c2f Mon Sep 17 00:00:00 2001 From: Joakim Eriksson Date: Fri, 1 Dec 2017 23:34:16 +0100 Subject: [PATCH 09/31] added some missing NRF52 scripts for flashing and fixed baudrate to be 115200 --- arch/cpu/nrf52832/erase.jlink | 2 ++ arch/cpu/nrf52832/flash.jlink | 4 ++++ arch/platform/nrf52dk/config/nrf_drv_config.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 arch/cpu/nrf52832/erase.jlink create mode 100644 arch/cpu/nrf52832/flash.jlink diff --git a/arch/cpu/nrf52832/erase.jlink b/arch/cpu/nrf52832/erase.jlink new file mode 100644 index 000000000..5f08d8d86 --- /dev/null +++ b/arch/cpu/nrf52832/erase.jlink @@ -0,0 +1,2 @@ +erase +q \ No newline at end of file diff --git a/arch/cpu/nrf52832/flash.jlink b/arch/cpu/nrf52832/flash.jlink new file mode 100644 index 000000000..787670d55 --- /dev/null +++ b/arch/cpu/nrf52832/flash.jlink @@ -0,0 +1,4 @@ +loadfile #OUTPUT_FILENAME# +r +g +q \ No newline at end of file diff --git a/arch/platform/nrf52dk/config/nrf_drv_config.h b/arch/platform/nrf52dk/config/nrf_drv_config.h index cfc3595b2..dd9e9b5de 100644 --- a/arch/platform/nrf52dk/config/nrf_drv_config.h +++ b/arch/platform/nrf52dk/config/nrf_drv_config.h @@ -195,7 +195,7 @@ #if (UART0_ENABLED == 1) #define UART0_CONFIG_HWFC NRF_UART_HWFC_DISABLED #define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED -#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_38400 +#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_115200 #define UART0_CONFIG_PSEL_TXD 6 #define UART0_CONFIG_PSEL_RXD 8 #define UART0_CONFIG_PSEL_CTS 7 From 0b345d28461cfcb3adae8cef3848da5b7401c317 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 22:38:18 +0000 Subject: [PATCH 10/31] Separate CPU and Device driver doxygen groups --- tools/doxygen/modules.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/doxygen/modules.txt b/tools/doxygen/modules.txt index 7ece82e8b..246258678 100644 --- a/tools/doxygen/modules.txt +++ b/tools/doxygen/modules.txt @@ -89,7 +89,12 @@ Core system components such as processes and timers */ /** -\defgroup dev CPUs and Device driver +\defgroup cpu CPUs +\ingroup arch +*/ + +/** +\defgroup dev Device Drivers \ingroup arch */ From e84eb8247b04df18b52418d3585b8980f797f4e6 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 22:45:04 +0000 Subject: [PATCH 11/31] Remove doxygen groups for obsolete CPUs and platforms --- arch/cpu/arm/arm.txt | 15 --------------- tools/doxygen/modules.txt | 5 ----- 2 files changed, 20 deletions(-) diff --git a/arch/cpu/arm/arm.txt b/arch/cpu/arm/arm.txt index 526486662..340cd6cb1 100644 --- a/arch/cpu/arm/arm.txt +++ b/arch/cpu/arm/arm.txt @@ -2,18 +2,3 @@ * \defgroup cmsis CMSIS (Cortex Microcontroller Software Interface Standard) * \ingroup arm */ - -/** - * \defgroup aducrf101 ADUCRF101 - * \ingroup arm - */ - -/** - * \defgroup at91sam7s AT91SAM7S - * \ingroup arm - */ - -/** - * \defgroup stm32f103 STM32F103 - * \ingroup arm - */ diff --git a/tools/doxygen/modules.txt b/tools/doxygen/modules.txt index 246258678..c74b8f9e9 100644 --- a/tools/doxygen/modules.txt +++ b/tools/doxygen/modules.txt @@ -18,11 +18,6 @@ CPU, device drivers and platform code * \ingroup platform */ -/** - * \addtogroup exp5438 MSP430F5438 Experimenter Board - * \ingroup platform - */ - /** * \addtogroup jn516x The JN516x Board * \ingroup platform From 1b87b86f2e1638c1a7fe1988f1523519d149051c Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 22:46:20 +0000 Subject: [PATCH 12/31] Create doxygen group for ARM CPUs --- arch/cpu/arm/doxygen-group.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 arch/cpu/arm/doxygen-group.txt diff --git a/arch/cpu/arm/doxygen-group.txt b/arch/cpu/arm/doxygen-group.txt new file mode 100644 index 000000000..8e6f29468 --- /dev/null +++ b/arch/cpu/arm/doxygen-group.txt @@ -0,0 +1,4 @@ +/** + * \defgroup arm Support for Arm CPUs + * \ingroup cpu + */ From c8ecd201f51e3e7815108f562a486a7fec17a36f Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 22:51:00 +0000 Subject: [PATCH 13/31] Tidy-up CMSIS documentation Define the group within the CMSIS dir and rename a doxygen group that was not displaying correctly in the built docs --- arch/cpu/arm/arm.txt | 4 ---- arch/cpu/arm/common/CMSIS/core_cm0plus.h | 2 +- arch/cpu/arm/common/CMSIS/{core.txt => doxygen-group.txt} | 7 ++++++- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 arch/cpu/arm/arm.txt rename arch/cpu/arm/common/CMSIS/{core.txt => doxygen-group.txt} (84%) diff --git a/arch/cpu/arm/arm.txt b/arch/cpu/arm/arm.txt deleted file mode 100644 index 340cd6cb1..000000000 --- a/arch/cpu/arm/arm.txt +++ /dev/null @@ -1,4 +0,0 @@ -/** - * \defgroup cmsis CMSIS (Cortex Microcontroller Software Interface Standard) - * \ingroup arm - */ diff --git a/arch/cpu/arm/common/CMSIS/core_cm0plus.h b/arch/cpu/arm/common/CMSIS/core_cm0plus.h index ee5eec184..773eec6ee 100644 --- a/arch/cpu/arm/common/CMSIS/core_cm0plus.h +++ b/arch/cpu/arm/common/CMSIS/core_cm0plus.h @@ -66,7 +66,7 @@ * CMSIS definitions ******************************************************************************/ /** - \ingroup Cortex-M0+ + \ingroup Cortex_M0_plus @{ */ diff --git a/arch/cpu/arm/common/CMSIS/core.txt b/arch/cpu/arm/common/CMSIS/doxygen-group.txt similarity index 84% rename from arch/cpu/arm/common/CMSIS/core.txt rename to arch/cpu/arm/common/CMSIS/doxygen-group.txt index 1426a8a6a..4b4bdd0eb 100644 --- a/arch/cpu/arm/common/CMSIS/core.txt +++ b/arch/cpu/arm/common/CMSIS/doxygen-group.txt @@ -1,3 +1,8 @@ +/** + * \defgroup cmsis CMSIS (Cortex Microcontroller Software Interface Standard) + * \ingroup arm + */ + /** * \addtogroup CMSIS_Core_FunctionInterface * \ingroup cmsis @@ -39,7 +44,7 @@ */ /** - * \defgroup Cortex-M0+ Cortex-M0+ + * \defgroup Cortex_M0_plus Cortex-M0+ * \ingroup cmsis */ From 9df8b9aee530f8024ac77104d470e43e50c0b27f Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 22:53:14 +0000 Subject: [PATCH 14/31] Don't define doxygen groups for CPUs and platforms in the modules.txt These will be define in new doxygen-group.txt files within the respective platform/CPU dir. --- tools/doxygen/modules.txt | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/tools/doxygen/modules.txt b/tools/doxygen/modules.txt index c74b8f9e9..635bbe148 100644 --- a/tools/doxygen/modules.txt +++ b/tools/doxygen/modules.txt @@ -8,31 +8,6 @@ CPU, device drivers and platform code * \ingroup arch */ -/** - * \addtogroup cc2538dk The cc2538 Development Kit platform - * \ingroup platform - */ - -/** - * \addtogroup cooja COOJA network simulator node - * \ingroup platform - */ - -/** - * \addtogroup jn516x The JN516x Board - * \ingroup platform - */ - -/** - * \addtogroup native_platform Native platform - * \ingroup platform - */ - -/** - * \addtogroup nrf52dk nRF52 Development Kit - * \ingroup platform - */ - /** \defgroup net IoT networking The communication protocols @@ -93,16 +68,6 @@ Core system components such as processes and timers \ingroup arch */ -/** -* \defgroup arm ARM CPUs -* \ingroup dev -*/ - -/** -* \addtogroup nrf52832 nrf52832 SoC -* \ingroup dev -*/ - /** * \defgroup apps Application-layer protocols and profiles * \ingroup net From f25318b60d9d4cbe7bcb1bc8d72162da1cb4480b Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 22:54:39 +0000 Subject: [PATCH 15/31] Create doxygen groups for CPUs * CC2538 * CC13xx-CC26xx * nrf52832 --- arch/cpu/cc2538/doxygen-group.txt | 14 ++++++++++++++ arch/cpu/cc26xx-cc13xx/doxygen-group.txt | 16 ++++++++++++++++ arch/cpu/nrf52832/doxygen-group.txt | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 arch/cpu/cc2538/doxygen-group.txt create mode 100644 arch/cpu/cc26xx-cc13xx/doxygen-group.txt create mode 100644 arch/cpu/nrf52832/doxygen-group.txt diff --git a/arch/cpu/cc2538/doxygen-group.txt b/arch/cpu/cc2538/doxygen-group.txt new file mode 100644 index 000000000..6e88228b1 --- /dev/null +++ b/arch/cpu/cc2538/doxygen-group.txt @@ -0,0 +1,14 @@ +/** + * \defgroup cc2538 The TI CC2538 System-on-Chip + * + * CPU-Specific functionality - available to all cc2538-based platforms + * + * \ingroup cpu + */ + +/** + * \defgroup cc2538-platforms TI CC2538-powered platforms + * + * Documentation for all platforms powered by the TI cc2538 System-on-Chip + * \ingroup platform + */ diff --git a/arch/cpu/cc26xx-cc13xx/doxygen-group.txt b/arch/cpu/cc26xx-cc13xx/doxygen-group.txt new file mode 100644 index 000000000..6dd3cd1f0 --- /dev/null +++ b/arch/cpu/cc26xx-cc13xx/doxygen-group.txt @@ -0,0 +1,16 @@ +/** + * \defgroup cc26xx The TI CC13xx and CC26xx Systems-on-Chip + * + * This group documents the TI CC26xx and CC13xx CPUs. The two CPU families are + * very similar, with the main difference being related to radio capability. + * + * Documentation in this group should be considered to be applicable to both + * families, unless explicitly stated otherwise. + * + * \ingroup cpu + */ + +/** + * \defgroup cc26xx-platforms TI CC26xx-powered platforms + * \ingroup platform + */ diff --git a/arch/cpu/nrf52832/doxygen-group.txt b/arch/cpu/nrf52832/doxygen-group.txt new file mode 100644 index 000000000..fad2067d6 --- /dev/null +++ b/arch/cpu/nrf52832/doxygen-group.txt @@ -0,0 +1,4 @@ +/** + * \defgroup nrf52832 nrf52832 SoC + * \ingroup cpu + */ From d4680c656ab5d668ac59f3a5fc65ed7f51ae8fe3 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 22:57:26 +0000 Subject: [PATCH 16/31] Create doxygen groups for platforms * Cooja * Native * jn516x * nrf52dk --- arch/platform/cooja/doxygen-group.txt | 4 ++++ arch/platform/jn516x/doxygen-group.txt | 4 ++++ arch/platform/native/doxygen-group.txt | 4 ++++ arch/platform/nrf52dk/doxygen-group.txt | 4 ++++ 4 files changed, 16 insertions(+) create mode 100644 arch/platform/cooja/doxygen-group.txt create mode 100644 arch/platform/jn516x/doxygen-group.txt create mode 100644 arch/platform/native/doxygen-group.txt create mode 100644 arch/platform/nrf52dk/doxygen-group.txt diff --git a/arch/platform/cooja/doxygen-group.txt b/arch/platform/cooja/doxygen-group.txt new file mode 100644 index 000000000..ce6c60b0d --- /dev/null +++ b/arch/platform/cooja/doxygen-group.txt @@ -0,0 +1,4 @@ +/** + * \defgroup cooja COOJA network simulator node + * \ingroup platform + */ diff --git a/arch/platform/jn516x/doxygen-group.txt b/arch/platform/jn516x/doxygen-group.txt new file mode 100644 index 000000000..11e5a702c --- /dev/null +++ b/arch/platform/jn516x/doxygen-group.txt @@ -0,0 +1,4 @@ +/** + * \defgroup jn516x The JN516x Board + * \ingroup platform + */ diff --git a/arch/platform/native/doxygen-group.txt b/arch/platform/native/doxygen-group.txt new file mode 100644 index 000000000..705d2b8fa --- /dev/null +++ b/arch/platform/native/doxygen-group.txt @@ -0,0 +1,4 @@ +/** + * \defgroup native_platform Native platform + * \ingroup platform + */ diff --git a/arch/platform/nrf52dk/doxygen-group.txt b/arch/platform/nrf52dk/doxygen-group.txt new file mode 100644 index 000000000..e1f2c25e8 --- /dev/null +++ b/arch/platform/nrf52dk/doxygen-group.txt @@ -0,0 +1,4 @@ +/** + * \defgroup nrf52dk nRF52 Development Kit + * \ingroup platform + */ From c316f4afbd69001f50bd96d1a2c318b85a8e24be Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 22:59:15 +0000 Subject: [PATCH 17/31] Re-structure zoul documentation --- arch/platform/zoul/contiki-conf.h | 2 +- arch/platform/zoul/doxygen-group.txt | 4 ++++ arch/platform/zoul/platform.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 arch/platform/zoul/doxygen-group.txt diff --git a/arch/platform/zoul/contiki-conf.h b/arch/platform/zoul/contiki-conf.h index 42f6661e1..35d4ebc6d 100644 --- a/arch/platform/zoul/contiki-conf.h +++ b/arch/platform/zoul/contiki-conf.h @@ -29,7 +29,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ /** - * \addtogroup platform + * \addtogroup zoul-core * @{ * * \defgroup zoul-platforms Zolertia Zoul platforms diff --git a/arch/platform/zoul/doxygen-group.txt b/arch/platform/zoul/doxygen-group.txt new file mode 100644 index 000000000..9090c2390 --- /dev/null +++ b/arch/platform/zoul/doxygen-group.txt @@ -0,0 +1,4 @@ +/** + * \defgroup zoul-core Zolertia Zoul-based platforms + * \ingroup cc2538-platforms + */ diff --git a/arch/platform/zoul/platform.c b/arch/platform/zoul/platform.c index d428decbb..f570b377a 100644 --- a/arch/platform/zoul/platform.c +++ b/arch/platform/zoul/platform.c @@ -30,7 +30,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ /** - * \addtogroup platform + * \addtogroup zoul-core * @{ * * \defgroup zoul Zolertia Zoul core module From 4324bce6b087598eb096f0c4b955dbb3880d6b2d Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 23:01:35 +0000 Subject: [PATCH 18/31] Re-structure OpenMote-CC2538 documentation --- arch/platform/openmote-cc2538/contiki-conf.h | 3 ++- arch/platform/openmote-cc2538/platform.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/platform/openmote-cc2538/contiki-conf.h b/arch/platform/openmote-cc2538/contiki-conf.h index 8458afbc9..4cc9d9dce 100644 --- a/arch/platform/openmote-cc2538/contiki-conf.h +++ b/arch/platform/openmote-cc2538/contiki-conf.h @@ -40,6 +40,7 @@ * is comercialized by OpenMote Technologies since 2014. It is the first * commercial platform based on the powerful TI CC2538 SoC. It uses a * XBee form-factor to ease prototyping. + * @{ * * \file * Configuration for the OpenMote-CC2538 platform @@ -412,7 +413,7 @@ typedef uint32_t rtimer_clock_t; #ifndef CCM_STAR_CONF #define CCM_STAR_CONF cc2538_ccm_star_driver /**< AES-CCM* driver */ #endif - +/** @} */ /*---------------------------------------------------------------------------*/ #endif /* CONTIKI_CONF_H_ */ /*---------------------------------------------------------------------------*/ diff --git a/arch/platform/openmote-cc2538/platform.c b/arch/platform/openmote-cc2538/platform.c index 584f5a292..01cc4f744 100644 --- a/arch/platform/openmote-cc2538/platform.c +++ b/arch/platform/openmote-cc2538/platform.c @@ -32,7 +32,7 @@ */ /*---------------------------------------------------------------------------*/ /** - * \addtogroup platform + * \addtogroup cc2538-platforms * @{ * * \defgroup openmote-cc2538 OpenMote-CC2538 platform From 618ca50fe758b9c874224f43df0dc6facd40c8de Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 23:18:50 +0000 Subject: [PATCH 19/31] Restructure docs for the CC2538 CPU --- arch/cpu/cc2538/cpu.h | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/arch/cpu/cc2538/cpu.h b/arch/cpu/cc2538/cpu.h index eb86e6655..4ed9aa56f 100644 --- a/arch/cpu/cc2538/cpu.h +++ b/arch/cpu/cc2538/cpu.h @@ -29,16 +29,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ /** - * \addtogroup platform - * @{ - * - * \defgroup cc2538-platforms TI cc2538-powered platforms - * - * Documentation for all platforms powered by the TI cc2538 System-on-Chip - * @{ - * - * \defgroup cc2538 The TI cc2538 System-on-Chip - * CPU-Specific functionality - available to all cc2538-based platforms + * \addtogroup cc2538 * @{ * * \defgroup cc2538-cpu cc2538 CPU @@ -65,8 +56,6 @@ #endif /* CPU_H_ */ /** - * @} - * @} * @} * @} */ From bb18bd4a484f7c9aafb68fb0d6913764a7de9b90 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 23:19:02 +0000 Subject: [PATCH 20/31] Restructure docs for the CC13xx/CC26xx CPUs --- arch/cpu/cc26xx-cc13xx/clock.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/arch/cpu/cc26xx-cc13xx/clock.c b/arch/cpu/cc26xx-cc13xx/clock.c index 98d18e653..981bbb4b2 100644 --- a/arch/cpu/cc26xx-cc13xx/clock.c +++ b/arch/cpu/cc26xx-cc13xx/clock.c @@ -29,22 +29,6 @@ */ /*---------------------------------------------------------------------------*/ /** - * \addtogroup platform - * @{ - * - * \defgroup cc26xx-platforms TI CC26xx-powered platforms - * @{ - * - * \defgroup cc26xx The TI CC26xx and CC13xx CPUs - * - * This group documents the TI CC26xx and CC13xx CPUs. The two CPU families are - * very similar, with the main difference being related to radio capability. - * - * Documentation in this group should be considered to be applicable to both - * families, unless explicitly stated otherwise. - * - * @{ - * * \addtogroup cc26xx-clocks * @{ * @@ -228,9 +212,6 @@ clock_delay(unsigned int i) } /*---------------------------------------------------------------------------*/ /** - * @} - * @} - * @} * @} * @} */ From 0870ade05568cb04b64b0f8338a0340370a2cf7d Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:11:17 +0000 Subject: [PATCH 21/31] Restructure docs for the nrf52832 --- arch/cpu/nrf52832/ble/ble-core.c | 14 ++------------ arch/cpu/nrf52832/ble/ble-core.h | 6 +----- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/arch/cpu/nrf52832/ble/ble-core.c b/arch/cpu/nrf52832/ble/ble-core.c index 8466cf8ab..9f1acdfc2 100644 --- a/arch/cpu/nrf52832/ble/ble-core.c +++ b/arch/cpu/nrf52832/ble/ble-core.c @@ -28,13 +28,7 @@ * */ /** - * \addtogroup dev - * @{ - * - * \addtogroup nrf52832 - * @{ - * - * \addtogroup nrf52832-ble Bluetooth Low Energy drivers + * \addtogroup nrf52832-ble * @{ * * \file @@ -231,8 +225,4 @@ ble_evt_dispatch(ble_evt_t *p_ble_evt) on_ble_evt(p_ble_evt); } /*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */ +/** @} */ diff --git a/arch/cpu/nrf52832/ble/ble-core.h b/arch/cpu/nrf52832/ble/ble-core.h index 12c678d42..1e7b6127c 100644 --- a/arch/cpu/nrf52832/ble/ble-core.h +++ b/arch/cpu/nrf52832/ble/ble-core.h @@ -28,13 +28,10 @@ * */ /** - * \addtogroup dev - * @{ - * * \addtogroup nrf52832 * @{ * - * \addtogroup nrf52832-ble Bluetooth Low Energy drivers + * \defgroup nrf52832-ble Bluetooth Low Energy drivers * @{ * * \file @@ -55,7 +52,6 @@ void ble_get_mac(uint8_t addr[8]); #endif /* DEV_BLE_H_ */ /** - * @} * @} * @} */ From e6915a25ee957bf5ed354f1da2cd9d854fbbe34a Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sat, 2 Dec 2017 23:05:36 +0000 Subject: [PATCH 22/31] Add missing copyright header --- arch/platform/cc2538dk/contiki-conf.h | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/arch/platform/cc2538dk/contiki-conf.h b/arch/platform/cc2538dk/contiki-conf.h index 0c956efff..4f7f6dc0a 100644 --- a/arch/platform/cc2538dk/contiki-conf.h +++ b/arch/platform/cc2538dk/contiki-conf.h @@ -1,3 +1,34 @@ +/* + * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ + * 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. + */ +/*---------------------------------------------------------------------------*/ /** * \addtogroup cc2538dk * @{ From 9aa9a05b936ba20ce96d49f7a359e6f87040b519 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Tue, 28 Nov 2017 15:55:07 +0000 Subject: [PATCH 23/31] Add Makefile for all Arm CPUs --- arch/cpu/arm/Makefile.arm | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 arch/cpu/arm/Makefile.arm diff --git a/arch/cpu/arm/Makefile.arm b/arch/cpu/arm/Makefile.arm new file mode 100644 index 000000000..ba93b82a0 --- /dev/null +++ b/arch/cpu/arm/Makefile.arm @@ -0,0 +1,54 @@ +CC = arm-none-eabi-gcc +CPP = arm-none-eabi-cpp +LD = arm-none-eabi-gcc +AR = arm-none-eabi-ar +OBJCOPY = arm-none-eabi-objcopy +OBJDUMP = arm-none-eabi-objdump +NM = arm-none-eabi-nm +SIZE = arm-none-eabi-size +SREC_CAT = srec_cat + +CFLAGS += -mthumb -mabi=aapcs -mlittle-endian +CFLAGS += -Werror -Wall +CFLAGS += -std=c99 +CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing +CFLAGS += -fshort-enums -fomit-frame-pointer -fno-builtin + +LDFLAGS += -mthumb -mlittle-endian + +OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb + +### Are we building with code size optimisations? +SMALL ?= 1 +ifeq ($(SMALL),1) + CFLAGS += -Os +else + CFLAGS += -O2 +endif + +### Use CMSIS and the existing dbg-io from arch/cpu/arm/common +CONTIKI_ARM_DIRS += . common/dbg-io +CONTIKI_CPU_DIRS += $(addprefix ../arm/, $(CONTIKI_ARM_DIRS)) + +### CPU-dependent cleanup files +CLEAN += *.d *.elf *.hex + +### Don't treat the following files as intermediate +.PRECIOUS: %.elf %.hex %.bin + +%.i16hex: %.elf + $(OBJCOPY) -O ihex $< $@ + +%.hex: %.i16hex + $(SREC_CAT) $< -intel -o $@ -intel + +%.bin: %.elf + $(OBJCOPY) -O binary $(OBJCOPY_FLAGS) $< $@ + +%.lst: %.elf + $(OBJDUMP) $(OBJDUMP_FLAGS) $< > $@ + +### We don't really need the .hex and .bin for the .$(TARGET) but let's make +### sure they get built +%.$(TARGET): %.elf %.hex %.bin + cp $< $@ From 6333e3b8f7f70b102c636a707d810635527a6314 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 14:59:45 +0000 Subject: [PATCH 24/31] Move CMSIS arm/cortex-m and add Makefile --- arch/cpu/arm/{common => cortex-m}/CMSIS/cmsis_armcc.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/cmsis_armcc_V6.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/cmsis_gcc.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm0.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm0plus.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm3.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm4.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm7.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_cmFunc.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_cmInstr.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_cmSimd.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_sc000.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/core_sc300.h | 0 arch/cpu/arm/{common => cortex-m}/CMSIS/doxygen-group.txt | 0 arch/cpu/arm/cortex-m/Makefile.cortex-m | 3 +++ 15 files changed, 3 insertions(+) rename arch/cpu/arm/{common => cortex-m}/CMSIS/cmsis_armcc.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/cmsis_armcc_V6.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/cmsis_gcc.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm0.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm0plus.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm3.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm4.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_cm7.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_cmFunc.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_cmInstr.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_cmSimd.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_sc000.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/core_sc300.h (100%) rename arch/cpu/arm/{common => cortex-m}/CMSIS/doxygen-group.txt (100%) create mode 100644 arch/cpu/arm/cortex-m/Makefile.cortex-m diff --git a/arch/cpu/arm/common/CMSIS/cmsis_armcc.h b/arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/cmsis_armcc.h rename to arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc.h diff --git a/arch/cpu/arm/common/CMSIS/cmsis_armcc_V6.h b/arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc_V6.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/cmsis_armcc_V6.h rename to arch/cpu/arm/cortex-m/CMSIS/cmsis_armcc_V6.h diff --git a/arch/cpu/arm/common/CMSIS/cmsis_gcc.h b/arch/cpu/arm/cortex-m/CMSIS/cmsis_gcc.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/cmsis_gcc.h rename to arch/cpu/arm/cortex-m/CMSIS/cmsis_gcc.h diff --git a/arch/cpu/arm/common/CMSIS/core_cm0.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm0.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_cm0.h rename to arch/cpu/arm/cortex-m/CMSIS/core_cm0.h diff --git a/arch/cpu/arm/common/CMSIS/core_cm0plus.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm0plus.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_cm0plus.h rename to arch/cpu/arm/cortex-m/CMSIS/core_cm0plus.h diff --git a/arch/cpu/arm/common/CMSIS/core_cm3.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm3.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_cm3.h rename to arch/cpu/arm/cortex-m/CMSIS/core_cm3.h diff --git a/arch/cpu/arm/common/CMSIS/core_cm4.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm4.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_cm4.h rename to arch/cpu/arm/cortex-m/CMSIS/core_cm4.h diff --git a/arch/cpu/arm/common/CMSIS/core_cm7.h b/arch/cpu/arm/cortex-m/CMSIS/core_cm7.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_cm7.h rename to arch/cpu/arm/cortex-m/CMSIS/core_cm7.h diff --git a/arch/cpu/arm/common/CMSIS/core_cmFunc.h b/arch/cpu/arm/cortex-m/CMSIS/core_cmFunc.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_cmFunc.h rename to arch/cpu/arm/cortex-m/CMSIS/core_cmFunc.h diff --git a/arch/cpu/arm/common/CMSIS/core_cmInstr.h b/arch/cpu/arm/cortex-m/CMSIS/core_cmInstr.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_cmInstr.h rename to arch/cpu/arm/cortex-m/CMSIS/core_cmInstr.h diff --git a/arch/cpu/arm/common/CMSIS/core_cmSimd.h b/arch/cpu/arm/cortex-m/CMSIS/core_cmSimd.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_cmSimd.h rename to arch/cpu/arm/cortex-m/CMSIS/core_cmSimd.h diff --git a/arch/cpu/arm/common/CMSIS/core_sc000.h b/arch/cpu/arm/cortex-m/CMSIS/core_sc000.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_sc000.h rename to arch/cpu/arm/cortex-m/CMSIS/core_sc000.h diff --git a/arch/cpu/arm/common/CMSIS/core_sc300.h b/arch/cpu/arm/cortex-m/CMSIS/core_sc300.h similarity index 100% rename from arch/cpu/arm/common/CMSIS/core_sc300.h rename to arch/cpu/arm/cortex-m/CMSIS/core_sc300.h diff --git a/arch/cpu/arm/common/CMSIS/doxygen-group.txt b/arch/cpu/arm/cortex-m/CMSIS/doxygen-group.txt similarity index 100% rename from arch/cpu/arm/common/CMSIS/doxygen-group.txt rename to arch/cpu/arm/cortex-m/CMSIS/doxygen-group.txt diff --git a/arch/cpu/arm/cortex-m/Makefile.cortex-m b/arch/cpu/arm/cortex-m/Makefile.cortex-m new file mode 100644 index 000000000..444df05cd --- /dev/null +++ b/arch/cpu/arm/cortex-m/Makefile.cortex-m @@ -0,0 +1,3 @@ +CONTIKI_ARM_DIRS += cortex-m cortex-m/CMSIS + +include $(CONTIKI)/arch/cpu/arm/Makefile.arm From 92c572bf769d0e9b0ef922aacab45f23550cdc69 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Wed, 29 Nov 2017 14:46:01 +0000 Subject: [PATCH 25/31] Add Makefile for all CM4 CPUs --- arch/cpu/arm/cortex-m/cm4/Makefile.cm4 | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 arch/cpu/arm/cortex-m/cm4/Makefile.cm4 diff --git a/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 b/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 new file mode 100644 index 000000000..ca79428f1 --- /dev/null +++ b/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 @@ -0,0 +1,13 @@ +CONTIKI_ARM_DIRS += cortex-m/cm4 + +CFLAGS += -mcpu=cortex-m4 +LDFLAGS += -mcpu=cortex-m4 + +### Compilation rules +CUSTOM_RULE_LINK=1 + +%.elf: $(TARGET_STARTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(TARGET_LIBS) + $(TRACE_LD) + $(Q)$(CC) $(LDFLAGS) ${filter %o %.co %.a,$^} -o $@ + +include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m From 1e18f090accf800c44c0c743f000e373ece0e61b Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Wed, 29 Nov 2017 14:46:26 +0000 Subject: [PATCH 26/31] Add Makefile for all CM3 CPUs --- arch/cpu/arm/cortex-m/cm3/Makefile.cm3 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 arch/cpu/arm/cortex-m/cm3/Makefile.cm3 diff --git a/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 b/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 new file mode 100644 index 000000000..8baf1651d --- /dev/null +++ b/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 @@ -0,0 +1,24 @@ +CONTIKI_ARM_DIRS += cortex-m/cm3 + +CFLAGS += -mcpu=cortex-m3 + +LDFLAGS += -mcpu=cortex-m3 -nostartfiles +LDFLAGS += -T $(LDSCRIPT) +LDFLAGS += -Wl,--gc-sections,--sort-section=alignment +LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch + +OBJCOPY_FLAGS += --gap-fill 0xff + +### Build syscalls for newlib +MODULES += os/lib/newlib + +CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES)}} + +### Compilation rules +CUSTOM_RULE_LINK = 1 + +%.elf: $(CPU_STARTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(LDSCRIPT) + $(TRACE_LD) + $(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -lm -o $@ + +include $(CONTIKI)/arch/cpu/arm/cortex-m/Makefile.cortex-m From e45824020020409fee2800c266dbef6ec2c81b77 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 26 Nov 2017 21:23:05 +0000 Subject: [PATCH 27/31] Change asm() to __asm() This is required in order to compile with -std=c99 --- arch/cpu/cc2538/lpm.c | 2 +- arch/platform/cc2538dk/platform.c | 4 ++-- arch/platform/openmote-cc2538/platform.c | 4 ++-- arch/platform/zoul/platform.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/cpu/cc2538/lpm.c b/arch/cpu/cc2538/lpm.c index 7892ff204..68cb42ae4 100644 --- a/arch/cpu/cc2538/lpm.c +++ b/arch/cpu/cc2538/lpm.c @@ -61,7 +61,7 @@ #define DEEP_SLEEP_PM1_THRESHOLD 10 #define DEEP_SLEEP_PM2_THRESHOLD 100 /*---------------------------------------------------------------------------*/ -#define assert_wfi() do { asm("wfi"::); } while(0) +#define assert_wfi() do { __asm("wfi"::); } while(0) /*---------------------------------------------------------------------------*/ #if LPM_CONF_STATS rtimer_clock_t lpm_stats[3]; diff --git a/arch/platform/cc2538dk/platform.c b/arch/platform/cc2538dk/platform.c index 3a504c315..3897c6292 100644 --- a/arch/platform/cc2538dk/platform.c +++ b/arch/platform/cc2538dk/platform.c @@ -83,11 +83,11 @@ fade(unsigned char l) leds_on(l); for(i = 0; i < j; ++i) { - asm("nop"); + __asm("nop"); } leds_off(l); for(i = 0; i < 400 - j; ++i) { - asm("nop"); + __asm("nop"); } } } diff --git a/arch/platform/openmote-cc2538/platform.c b/arch/platform/openmote-cc2538/platform.c index 01cc4f744..df1d74a47 100644 --- a/arch/platform/openmote-cc2538/platform.c +++ b/arch/platform/openmote-cc2538/platform.c @@ -91,11 +91,11 @@ fade(unsigned char l) leds_on(l); for(i = 0; i < j; ++i) { - asm("nop"); + __asm("nop"); } leds_off(l); for(i = 0; i < 400 - j; ++i) { - asm("nop"); + __asm("nop"); } } } diff --git a/arch/platform/zoul/platform.c b/arch/platform/zoul/platform.c index f570b377a..f71c9e46a 100644 --- a/arch/platform/zoul/platform.c +++ b/arch/platform/zoul/platform.c @@ -90,11 +90,11 @@ fade(unsigned char l) leds_on(l); for(i = 0; i < j; ++i) { - asm("nop"); + __asm("nop"); } leds_off(l); for(i = 0; i < 400 - j; ++i) { - asm("nop"); + __asm("nop"); } } } From 64c310bf2a6322b896896f699c80bdcad03d7f68 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 26 Nov 2017 21:15:05 +0000 Subject: [PATCH 28/31] Use the CM3 common Makefile to build CC2538-based platforms --- arch/cpu/cc2538/Makefile.cc2538 | 74 +++------------------------------ 1 file changed, 5 insertions(+), 69 deletions(-) diff --git a/arch/cpu/cc2538/Makefile.cc2538 b/arch/cpu/cc2538/Makefile.cc2538 index e1b522443..f4c77c15d 100644 --- a/arch/cpu/cc2538/Makefile.cc2538 +++ b/arch/cpu/cc2538/Makefile.cc2538 @@ -1,52 +1,17 @@ -CC = arm-none-eabi-gcc -CPP = arm-none-eabi-cpp -LD = arm-none-eabi-gcc -AR = arm-none-eabi-ar -OBJCOPY = arm-none-eabi-objcopy -OBJDUMP = arm-none-eabi-objdump -NM = arm-none-eabi-nm - ifndef SOURCE_LDSCRIPT SOURCE_LDSCRIPT = $(CONTIKI_CPU)/cc2538.lds endif LDSCRIPT = $(OBJECTDIR)/cc2538.ld -CFLAGS += -mcpu=cortex-m3 -mthumb -mlittle-endian -CFLAGS += -ffunction-sections -fdata-sections -CFLAGS += -fshort-enums -fomit-frame-pointer -fno-strict-aliasing -CFLAGS += -Wall -DCMSIS_DEV_HDR=\"cc2538_cm3.h\" -LDFLAGS += -mcpu=cortex-m3 -mthumb -nostartfiles -LDFLAGS += -T $(LDSCRIPT) -LDFLAGS += -Wl,--gc-sections,--sort-section=alignment -LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch -OBJCOPY_FLAGS += -O binary --gap-fill 0xff -OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb - -ifeq ($(WERROR),1) -CFLAGS += -Werror -endif - -### Are we building with code size optimisations? -SMALL ?= 1 -ifeq ($(SMALL),1) - CFLAGS += -Os -else - CFLAGS += -O2 -endif +CFLAGS += -DCMSIS_DEV_HDR=\"cc2538_cm3.h\" ### If the user-specified a Node ID, pass a define ifdef NODEID CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID) endif -### CPU-dependent cleanup files -CLEAN += *.d *.elf *.hex - ### CPU-dependent directories -CONTIKI_CPU_DIRS = ../arm/common/CMSIS . dev usb usb/common usb/common/cdc-acm - -### Use the existing debug I/O in arch/cpu/arm/common -CONTIKI_CPU_DIRS += ../arm/common/dbg-io +CONTIKI_CPU_DIRS = . dev usb usb/common usb/common/cdc-acm ### CPU-dependent source files CONTIKI_CPU_SOURCEFILES += soc.c clock.c rtimer-arch.c uart.c watchdog.c @@ -66,23 +31,13 @@ DEBUG_IO_SOURCEFILES += dbg-printf.c dbg-snprintf.c dbg-sprintf.c strformat.c USB_SOURCEFILES += usb-core.c cdc-acm.c usb-arch.c usb-serial.c cdc-acm-descriptors.c -ifneq ($(TARGET_START_SOURCEFILES),) - CPU_START_SOURCEFILES = TARGET_START_SOURCEFILES -else - CPU_START_SOURCEFILES = startup-gcc.c -endif -CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES)}} +CPU_START_SOURCEFILES = startup-gcc.c CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES) CONTIKI_SOURCEFILES += $(USB_SOURCEFILES) -MODULES += os/lib/newlib - .SECONDEXPANSION: -### Don't treat the .elf as intermediate -.PRECIOUS: %.elf %.hex %.bin - ### Always re-build ieee-addr.o in case the command line passes a new NODEID FORCE: @@ -90,27 +45,6 @@ $(OBJECTDIR)/ieee-addr.o: ieee-addr.c FORCE | $(OBJECTDIR) $(TRACE_CC) $(Q)$(CC) $(CFLAGS) -c $< -o $@ -### Compilation rules -CUSTOM_RULE_LINK=1 - -%.elf: $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(LDSCRIPT) - $(TRACE_LD) - $(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ - -%.hex: %.elf - $(OBJCOPY) -O ihex $< $@ - -%.bin: %.elf - $(OBJCOPY) $(OBJCOPY_FLAGS) $< $@ - -%.lst: %.elf - $(OBJDUMP) $(OBJDUMP_FLAGS) $< > $@ - -### We don't really need the .hex and .bin for the .$(TARGET) but let's make -### sure they get built -%.$(TARGET): %.elf %.hex %.bin - cp $< $@ - ### This rule is used to generate the correct linker script LDGENFLAGS += $(CFLAGS) LDGENFLAGS += -imacros "contiki-conf.h" -imacros "dev/cc2538-dev.h" @@ -121,3 +55,5 @@ LDGENFLAGS += -x c -P -E $(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 From 238962d528974d2d4ae670bbe63fc262077a68dc Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 26 Nov 2017 21:15:14 +0000 Subject: [PATCH 29/31] Use the CM3 common Makefile to build CC13xx/CC26xx-based platforms --- arch/cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx | 72 +------------------ 1 file changed, 3 insertions(+), 69 deletions(-) diff --git a/arch/cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx b/arch/cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx index 8a3efd07f..48c08235d 100644 --- a/arch/cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx +++ b/arch/cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx @@ -1,13 +1,3 @@ -CC = arm-none-eabi-gcc -CPP = arm-none-eabi-cpp -LD = arm-none-eabi-gcc -AR = arm-none-eabi-ar -OBJCOPY = arm-none-eabi-objcopy -OBJDUMP = arm-none-eabi-objdump -NM = arm-none-eabi-nm -SIZE = arm-none-eabi-size -SREC_CAT = srec_cat - CPU_ABS_PATH = arch/cpu/cc26xx-cc13xx TI_XXWARE = $(CONTIKI_CPU)/$(TI_XXWARE_PATH) @@ -29,44 +19,14 @@ MODULES += $(TI_XXWARE_SRC) LDSCRIPT = $(CONTIKI_CPU)/cc26xx.ld -CFLAGS += -mcpu=cortex-m3 -mthumb -mlittle-endian -CFLAGS += -ffunction-sections -fdata-sections -CFLAGS += -fshort-enums -fomit-frame-pointer -fno-strict-aliasing -CFLAGS += -Wall -std=c99 -DCMSIS_DEV_HDR=\"cc13x0-cc26x0-cm3.h\" - -LDFLAGS += -mcpu=cortex-m3 -mthumb -mlittle-endian -nostartfiles -LDFLAGS += -T $(LDSCRIPT) -LDFLAGS += -Wl,--gc-sections,--sort-section=alignment -LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch -OBJCOPY_FLAGS += -O binary --gap-fill 0xff -OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb - -ifeq ($(WERROR),1) -CFLAGS += -Werror -endif - -### Are we building with code size optimisations? -SMALL ?= 1 -ifeq ($(SMALL),1) - CFLAGS += -Os -else - CFLAGS += -O2 -endif - ### If the user-specified a Node ID, pass a define ifdef NODEID CFLAGS += -DIEEE_ADDR_NODE_ID=$(NODEID) endif -### CPU-dependent cleanup files -CLEAN += *.d *.elf *.hex - ### CPU-dependent directories CONTIKI_CPU_DIRS += . dev rf-core rf-core/api $(TI_XXWARE_STARTUP_DIR) -### Use CMSIS and the existing debug I/O in arch/cpu/arm/common -CONTIKI_CPU_DIRS += ../arm/common/dbg-io ../arm/common/CMSIS - ### CPU-dependent source files CONTIKI_CPU_SOURCEFILES += clock.c rtimer-arch.c soc-rtc.c uart.c CONTIKI_CPU_SOURCEFILES += contiki-watchdog.c aux-ctrl.c @@ -80,8 +40,7 @@ DEBUG_IO_SOURCEFILES += dbg-printf.c dbg-snprintf.c dbg-sprintf.c strformat.c CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES) -TARGET_START_SOURCEFILES += fault-handlers.c $(TI_XXWARE_STARTUP_SRCS) -TARGET_STARTFILES = $(addprefix $(OBJECTDIR)/,$(call oname, $(TARGET_START_SOURCEFILES))) +CPU_START_SOURCEFILES += fault-handlers.c $(TI_XXWARE_STARTUP_SRCS) PYTHON = python BSL_FLAGS += -e -w -v @@ -92,9 +51,6 @@ endif BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py -### Don't treat the .elf as intermediate -.PRECIOUS: %.elf %.hex %.bin - ### Always re-build ieee-addr.o in case the command line passes a new NODEID FORCE: @@ -108,30 +64,6 @@ $(OBJECTDIR)/ccfg.o: ccfg.c FORCE | $(OBJECTDIR) $(TRACE_CC) $(Q)$(CC) $(CFLAGS) -include "ccxxware-conf.h" -c $< -o $@ -### Compilation rules -CUSTOM_RULE_LINK=1 - -%.elf: $(TARGET_STARTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(LDSCRIPT) - $(TRACE_LD) - $(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -lm -o $@ - -%.i16hex: %.elf - $(OBJCOPY) -O ihex $< $@ - -%.hex: %.i16hex - $(SREC_CAT) $< -intel -o $@ -intel - -%.bin: %.elf - $(OBJCOPY) $(OBJCOPY_FLAGS) $< $@ - -%.lst: %.elf - $(OBJDUMP) $(OBJDUMP_FLAGS) $< > $@ - -### We don't really need the .hex and .bin for the .$(TARGET) but let's make -### sure they get built -%.$(TARGET): %.elf %.hex %.bin - cp $< $@ - # a target that gives a user-friendly memory profile, taking into account the RAM # that is statically occupied by the stack as defined in the linker script # see $(LDSCRIPT) @@ -170,3 +102,5 @@ UART_BAUDRATE = 115200 login: $(SERIALDUMP) -b$(UART_BAUDRATE) $(PORT) + +include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 From fdb4d8f24ae34c7c4de46a4fa1d21d6f01dce33b Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Tue, 28 Nov 2017 15:56:54 +0000 Subject: [PATCH 30/31] Use the CM4 common build instrastructure for nrf52832 --- arch/cpu/nrf52832/Makefile.nrf52832 | 63 ++--------------------------- 1 file changed, 3 insertions(+), 60 deletions(-) diff --git a/arch/cpu/nrf52832/Makefile.nrf52832 b/arch/cpu/nrf52832/Makefile.nrf52832 index f6752ef8c..6f35abcd5 100644 --- a/arch/cpu/nrf52832/Makefile.nrf52832 +++ b/arch/cpu/nrf52832/Makefile.nrf52832 @@ -46,19 +46,6 @@ OBJECT_DIRECTORY = $(OBJECTDIR) LISTING_DIRECTORY := $(OBJECTDIR) OUTPUT_BINARY_DIRECTORY := bin_$(TARGET) -MK := mkdir -RM := rm -rf - -# Toolchain commands -CC := arm-none-eabi-gcc -AS := arm-none-eabi-as -AR := arm-none-eabi-ar -LD := arm-none-eabi-ld -NM := arm-none-eabi-nm -OBJDUMP := arm-none-eabi-objdump -OBJCOPY := arm-none-eabi-objcopy -SIZE := arm-none-eabi-size - # JLink JLINK := $(NRF52_JLINK_PATH)/JLinkExe JLINK_OPTS = -Device NRF52 -if swd -speed 1000 @@ -141,44 +128,24 @@ EXTERNALDIRS += $(addprefix $(NRF52_SDK_ROOT)/, $(INC_PATHS)) # Sorting removes duplicates BUILD_DIRECTORIES := $(sort $(OUTPUT_BINARY_DIRECTORY) $(LISTING_DIRECTORY)) -# Clean files and directories -CLEAN += bin_$(TARGET) lst_$(TARGET) nrf52832.a *.elf *.hex - #flags common to all targets ifneq ($(NRF52_WITHOUT_SOFTDEVICE),1) CFLAGS += -DSOFTDEVICE_PRESENT CFLAGS += -DS132 endif -SMALL ?= 1 -ifeq ($(SMALL),1) -CFLAGS += -Os -else -CFLAGS += -O2 -endif - CFLAGS += -DNRF52 CFLAGS += -DBOARD_$(shell echo $(NRF52_DK_REVISION) | tr a-z A-Z) CFLAGS += -D__HEAP_SIZE=512 CFLAGS += -DSWI_DISABLE0 CFLAGS += -DCONFIG_GPIO_AS_PINRESET CFLAGS += -DBLE_STACK_SUPPORT_REQD -CFLAGS += -mcpu=cortex-m4 -CFLAGS += -mthumb -mabi=aapcs --std=gnu99 -CFLAGS += -Wall -ifeq ($(WERROR),1) -CFLAGS += -Werror -endif CFLAGS += -ggdb CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -# keep every function in separate section. This will allow linker to dump unused functions -CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing -CFLAGS += -fno-builtin --short-enums # keep every function in separate section. This will allow linker to dump unused functions LDFLAGS += -Xlinker -Map=$(LISTING_DIRECTORY)/$(OUTPUT_FILENAME).map -LDFLAGS += -mthumb -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) -LDFLAGS += -mcpu=cortex-m4 +LDFLAGS += -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 # let linker to dump unused sections LDFLAGS += -Wl,--gc-sections @@ -212,41 +179,15 @@ OBJECTS = $(C_OBJECTS) $(ASM_OBJECTS) TARGET_LIBS= nrf52832.a $(NRF52_SDK_ROOT)/components/iot/ble_6lowpan/lib/ble_6lowpan.a -### Don't treat the .elf as intermediate -.PRECIOUS: %.hex %.bin - nrf52832.a: $(OBJECTS) $(TRACE_AR) $(Q)$(AR) $(AROPTS) $@ $^ -### Compilation rules -CUSTOM_RULE_LINK=1 - -%.elf: $(TARGET_STARTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(TARGET_LIBS) - $(TRACE_LD) - $(Q)$(CC) $(LDFLAGS) ${filter %o %.co %.a,$^} -o $@ - # Assemble files $(OBJECT_DIRECTORY)/%.o: %.s @echo Compiling file: $(notdir $<) $(Q)$(CC) $(ASMFLAGS) $(addprefix -I$(NRF52_SDK_ROOT)/, $(INC_PATHS)) -c -o $@ $< -# Create binary file from the .out file -%.bin: %.elf - @echo Preparing: $@ - $(Q)$(OBJCOPY) -O binary $^ $@ - -# Create binary .hex file from the .out file -%.hex: %.elf - @echo Preparing: $@ - $(Q)$(OBJCOPY) -O ihex $^ $@ - -### We don't really need the .hex and .bin for the .$(TARGET) but let's make -### sure they get built -%.$(TARGET): %.elf %.hex %.bin - cp $*.elf $@ - $(Q)$(SIZE) $@ - %.jlink: sed -e 's/#OUTPUT_FILENAME#/$*.hex/' $(CONTIKI_CPU)/flash.jlink > $@ @@ -265,3 +206,5 @@ erase: $(JLINK) $(JLINK_OPTS) -CommanderScript $(CONTIKI_CPU)/erase.jlink .PHONY: softdevice.jlink + +include $(CONTIKI)/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 From 29662d4e6d9887f49a71c1f12f510eee403134c9 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Tue, 5 Dec 2017 00:44:20 +0000 Subject: [PATCH 31/31] Clarify sensniff doc: It is also distributed as part of Contiki-NG --- examples/sensniff/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/sensniff/README.md b/examples/sensniff/README.md index 3fe1df7dd..01b3de54c 100644 --- a/examples/sensniff/README.md +++ b/examples/sensniff/README.md @@ -2,7 +2,8 @@ sensniff Contiki Project ======================== This example can be used to create an IEEE 802.15.4 wireless sniffer firmware, meant to be used in parallel with -[sensniff](https://github.com/g-oikonomou/sensniff). +[sensniff](https://github.com/g-oikonomou/sensniff). Sensniff is distributed +standalone, but also as part of Contiki-NG under `tools/sensniff`. Running =======