From 3bb60074dffc11a904edf09f3df0f2c4c8577817 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:27:39 +0000 Subject: [PATCH 01/28] Provide header file with configuration common to all Arm CPUs --- arch/cpu/arm/arm-def.h | 76 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 arch/cpu/arm/arm-def.h diff --git a/arch/cpu/arm/arm-def.h b/arch/cpu/arm/arm-def.h new file mode 100644 index 000000000..63a70a535 --- /dev/null +++ b/arch/cpu/arm/arm-def.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup arm + * @{ + * + * \file + * Compiler and data type definitions for all ARM-based CPUs + */ +/*---------------------------------------------------------------------------*/ +#ifndef ARM_DEF_ +#define ARM_DEF_ +/*---------------------------------------------------------------------------*/ +#include +/*---------------------------------------------------------------------------*/ +/** + * \name Compiler configuration + * + * Those values are not meant to be modified by the user + * @{ + */ +#define CCIF +#define CLIF +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Macros and typedefs + * + * Those values are not meant to be modified by the user + * @{ + */ +#define CLOCK_CONF_SECOND 128 + +/* Clock (time) comparison macro */ +#define CLOCK_LT(a, b) ((signed long)((a) - (b)) < 0) + +/* Platform typedefs */ +typedef uint32_t clock_time_t; +typedef uint32_t uip_stats_t; + +typedef uint32_t rtimer_clock_t; +#define RTIMER_CLOCK_DIFF(a, b) ((int32_t)((a) - (b))) +/** @} */ +/*---------------------------------------------------------------------------*/ +#endif /* ARM_DEF_ */ +/*---------------------------------------------------------------------------*/ +/** @} */ From 3a0ea7331080678629e1ef6f835089b2664d0d10 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:29:43 +0000 Subject: [PATCH 02/28] Provide header file with configuration common to all CM3-based CPUs --- arch/cpu/arm/cortex-m/cm3/cm3-def.h | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 arch/cpu/arm/cortex-m/cm3/cm3-def.h diff --git a/arch/cpu/arm/cortex-m/cm3/cm3-def.h b/arch/cpu/arm/cortex-m/cm3/cm3-def.h new file mode 100644 index 000000000..041bb3d71 --- /dev/null +++ b/arch/cpu/arm/cortex-m/cm3/cm3-def.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup arm + * @{ + * + * \defgroup cm3 Arm Cortex-M3 + * @{ + * + * \file + * Compiler and data type definitions for all CM3-based CPUs + */ +/*---------------------------------------------------------------------------*/ +#ifndef CM3_DEF_H_ +#define CM3_DEF_H_ +/*---------------------------------------------------------------------------*/ +#include "arm-def.h" +/*---------------------------------------------------------------------------*/ +#endif /* CM3_DEF_H_ */ +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ From a05db7322d5749b357220d111026d1d16fa2c322 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:29:54 +0000 Subject: [PATCH 03/28] Provide header file with configuration common to all CM4-based CPUs --- arch/cpu/arm/cortex-m/cm4/cm4-def.h | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 arch/cpu/arm/cortex-m/cm4/cm4-def.h diff --git a/arch/cpu/arm/cortex-m/cm4/cm4-def.h b/arch/cpu/arm/cortex-m/cm4/cm4-def.h new file mode 100644 index 000000000..1144d9798 --- /dev/null +++ b/arch/cpu/arm/cortex-m/cm4/cm4-def.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup arm + * @{ + * + * \defgroup cm4 Arm Cortex-M4 + * @{ + * + * \file + * Compiler and data type definitions for all CM4-based CPUs + */ +/*---------------------------------------------------------------------------*/ +#ifndef CM4_DEF_H_ +#define CM4_DEF_H_ +/*---------------------------------------------------------------------------*/ +#include "arm-def.h" +/*---------------------------------------------------------------------------*/ +#endif /* CM4_DEF_H_ */ +/*---------------------------------------------------------------------------*/ +/** + * @} + * @} + */ From 4b4234db403cdacff639a602b2d5a33b2efb30f5 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:34:47 +0000 Subject: [PATCH 04/28] Provide header file with defines for the nrf52832 --- arch/cpu/nrf52832/nrf52832-def.h | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 arch/cpu/nrf52832/nrf52832-def.h diff --git a/arch/cpu/nrf52832/nrf52832-def.h b/arch/cpu/nrf52832/nrf52832-def.h new file mode 100644 index 000000000..f31054dda --- /dev/null +++ b/arch/cpu/nrf52832/nrf52832-def.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +#ifndef NRF52832_DEF_H_ +#define NRF52832_DEF_H_ +/*---------------------------------------------------------------------------*/ +#include "cm4/cm4-def.h" +/*---------------------------------------------------------------------------*/ +#define RTIMER_ARCH_SECOND 62500 +/*---------------------------------------------------------------------------*/ +#endif /* NRF52832_DEF_H_ */ +/*---------------------------------------------------------------------------*/ From 945c66b7f8514fe9dbb7a8ec8997a8225f7be0c3 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:35:15 +0000 Subject: [PATCH 05/28] Provide header file with defines for the CC13xx/CC26xx --- arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-def.h | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-def.h diff --git a/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-def.h b/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-def.h new file mode 100644 index 000000000..283738ffe --- /dev/null +++ b/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-def.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +#ifndef CC13XX_CC26XX_DEF_H_ +#define CC13XX_CC26XX_DEF_H_ +/*---------------------------------------------------------------------------*/ +#include "cm3/cm3-def.h" +/*---------------------------------------------------------------------------*/ +/* TSCH related defines */ + +/* Delay between GO signal and SFD */ +#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(81)) +/* Delay between GO signal and start listening. + * This value is so small because the radio is constantly on within each timeslot. */ +#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15)) +/* Delay between the SFD finishes arriving and it is detected in software. */ +#define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352)) + +/* Timer conversion; radio is running at 4 MHz */ +#define RADIO_TIMER_SECOND 4000000u +#if (RTIMER_SECOND % 256) || (RADIO_TIMER_SECOND % 256) +#error RADIO_TO_RTIMER macro must be fixed! +#endif +#define RADIO_TO_RTIMER(X) ((uint32_t)(((uint64_t)(X) * (RTIMER_SECOND / 256)) / (RADIO_TIMER_SECOND / 256))) +#define USEC_TO_RADIO(X) ((X) * 4) + +/* The PHY header (preamble + SFD, 4+1 bytes) duration is equivalent to 10 symbols */ +#define RADIO_IEEE_802154_PHY_HEADER_DURATION_USEC 160 + +/* Do not turn off TSCH within a timeslot: not enough time */ +#define TSCH_CONF_RADIO_ON_DURING_TIMESLOT 1 + +/* Disable TSCH frame filtering */ +#define TSCH_CONF_HW_FRAME_FILTERING 0 + +/* Use hardware timestamps */ +#ifndef TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS +#define TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS 1 +#define TSCH_CONF_TIMESYNC_REMOVE_JITTER 0 +#endif + +#ifndef TSCH_CONF_BASE_DRIFT_PPM +/* The drift compared to "true" 10ms slots. + * Enable adaptive sync to enable compensation for this. + * Slot length 10000 usec + * 328 ticks + * Tick duration 30.517578125 usec + * Real slot duration 10009.765625 usec + * Target - real duration = -9.765625 usec + * TSCH_CONF_BASE_DRIFT_PPM -977 + */ +#define TSCH_CONF_BASE_DRIFT_PPM -977 +#endif + +/* 10 times per second */ +#ifndef TSCH_CONF_CHANNEL_SCAN_DURATION +#define TSCH_CONF_CHANNEL_SCAN_DURATION (CLOCK_SECOND / 10) +#endif + +/* Slightly reduce the TSCH guard time (from 2200 usec to 1800 usec) to make sure + * the CC26xx radio has sufficient time to start up. */ +#ifndef TSCH_CONF_RX_WAIT +#define TSCH_CONF_RX_WAIT 1800 +#endif +/*---------------------------------------------------------------------------*/ +#define RTIMER_ARCH_SECOND 65536 +/*---------------------------------------------------------------------------*/ +#endif /* CC13XX_CC26XX_DEF_H_ */ +/*---------------------------------------------------------------------------*/ From d66633ffc4ac8be47c0433a15ab6203cd2aa2205 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:38:59 +0000 Subject: [PATCH 06/28] Provide header file with defines for the CC2538 --- arch/cpu/cc2538/cc2538-def.h | 62 +++++++++++++++++++++++++++++++++++ arch/cpu/cc2538/rtimer-arch.h | 2 -- 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 arch/cpu/cc2538/cc2538-def.h diff --git a/arch/cpu/cc2538/cc2538-def.h b/arch/cpu/cc2538/cc2538-def.h new file mode 100644 index 000000000..11baef4ec --- /dev/null +++ b/arch/cpu/cc2538/cc2538-def.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +#ifndef CC2538_DEF_H_ +#define CC2538_DEF_H_ +/*---------------------------------------------------------------------------*/ +#include "cm3/cm3-def.h" +/*---------------------------------------------------------------------------*/ +#define RTIMER_ARCH_SECOND 32768 +/*---------------------------------------------------------------------------*/ +/* 352us from calling transmit() until the SFD byte has been sent */ +#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(352)) +/* 192us as in datasheet but ACKs are not always received, so adjusted to 250us */ +#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(250)) +#define RADIO_DELAY_BEFORE_DETECT 0 +#ifndef TSCH_CONF_BASE_DRIFT_PPM +/* The drift compared to "true" 10ms slots. + * Enable adaptive sync to enable compensation for this. + * Slot length 10000 usec + * 328 ticks + * Tick duration 30.517578125 usec + * Real slot duration 10009.765625 usec + * Target - real duration = -9.765625 usec + * TSCH_CONF_BASE_DRIFT_PPM -977 + */ +#define TSCH_CONF_BASE_DRIFT_PPM -977 +#endif + +#if MAC_CONF_WITH_TSCH +#define TSCH_CONF_HW_FRAME_FILTERING 0 +#endif /* MAC_CONF_WITH_TSCH */ +/*---------------------------------------------------------------------------*/ +#endif /* CC2538_DEF_H_ */ +/*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc2538/rtimer-arch.h b/arch/cpu/cc2538/rtimer-arch.h index 45ebc5c5d..37aa102da 100644 --- a/arch/cpu/cc2538/rtimer-arch.h +++ b/arch/cpu/cc2538/rtimer-arch.h @@ -63,8 +63,6 @@ #include "contiki.h" #include "dev/gptimer.h" -#define RTIMER_ARCH_SECOND 32768 - /* Do the math in 32bits to save precision. * Round to nearest integer rather than truncate. */ #define US_TO_RTIMERTICKS(US) ((US) >= 0 ? \ From ea2fb7bcc1552e42bcf947f78c4383a73eb6ed8d Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:39:34 +0000 Subject: [PATCH 07/28] Provide header file with configuration common to all CC2538-based platforms --- arch/cpu/cc2538/cc2538-conf.h | 330 ++++++++++++++++++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 arch/cpu/cc2538/cc2538-conf.h diff --git a/arch/cpu/cc2538/cc2538-conf.h b/arch/cpu/cc2538/cc2538-conf.h new file mode 100644 index 000000000..725f95439 --- /dev/null +++ b/arch/cpu/cc2538/cc2538-conf.h @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup cc2538 + * @{ + */ +/*---------------------------------------------------------------------------*/ +#ifndef CC2538_CONF_H_ +#define CC2538_CONF_H_ +/*---------------------------------------------------------------------------*/ +/** + * \name CFS configuration + * + * @{ + */ +#ifndef COFFEE_CONF_SIZE +#define COFFEE_CONF_SIZE (4 * COFFEE_SECTOR_SIZE) +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name CC2538 System Control configuration + * + * @{ + */ +#ifndef SYS_CTRL_CONF_OSC32K_USE_XTAL +#define SYS_CTRL_CONF_OSC32K_USE_XTAL 0 /**< Use the on-board 32.768-kHz crystal */ +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Watchdog Timer configuration + * + * @{ + */ +#ifndef WATCHDOG_CONF_ENABLE +#define WATCHDOG_CONF_ENABLE 1 /**< Enable the watchdog timer */ +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name USB 'core' configuration + * + * Those values are not meant to be modified by the user, except where stated + * otherwise + * @{ + */ +#define CTRL_EP_SIZE 8 +#define USB_EP1_SIZE 32 +#define USB_EP2_SIZE 64 +#define USB_EP3_SIZE 64 +#define USB_ARCH_WRITE_NOTIFY 0 + +#ifndef USB_ARCH_CONF_DMA +#define USB_ARCH_CONF_DMA 1 /**< Change to Enable/Disable USB DMA */ + +#endif +/** @} */ +/** + * \name uDMA Configuration and channel allocations + * + * @{ + */ +#define USB_ARCH_CONF_RX_DMA_CHAN 0 /**< USB -> RAM DMA channel */ +#define USB_ARCH_CONF_TX_DMA_CHAN 1 /**< RAM -> USB DMA channel */ +#define CC2538_RF_CONF_TX_DMA_CHAN 2 /**< RF -> RAM DMA channel */ +#define CC2538_RF_CONF_RX_DMA_CHAN 3 /**< RAM -> RF DMA channel */ +#define UDMA_CONF_MAX_CHANNEL CC2538_RF_CONF_RX_DMA_CHAN +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Character I/O Configuration + * + * @{ + */ +#ifndef UART_CONF_ENABLE +#define UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */ +#endif + +#ifndef UART0_CONF_BAUD_RATE +#define UART0_CONF_BAUD_RATE 115200 /**< Default UART0 baud rate */ +#endif + +#ifndef UART1_CONF_BAUD_RATE +#define UART1_CONF_BAUD_RATE 115200 /**< Default UART1 baud rate */ +#endif + +#ifndef SLIP_ARCH_CONF_USB +#define SLIP_ARCH_CONF_USB 0 /**< SLIP over UART by default */ +#endif + +#ifndef DBG_CONF_USB +#define DBG_CONF_USB 0 /**< All debugging over UART by default */ +#endif + +#ifndef SERIAL_LINE_CONF_UART +#define SERIAL_LINE_CONF_UART 0 /**< UART to use with serial line */ +#endif + +#if !SLIP_ARCH_CONF_USB +#ifndef SLIP_ARCH_CONF_UART +#define SLIP_ARCH_CONF_UART 0 /**< UART to use with SLIP */ +#endif +#endif + +#if !DBG_CONF_USB +#ifndef DBG_CONF_UART +#define DBG_CONF_UART 0 /**< UART to use for debugging */ +#endif +#endif + +#ifndef UART1_CONF_UART +#define UART1_CONF_UART 0 /**< UART to use for examples relying on + the uart1_* API */ +#endif + +#ifndef SLIP_ARCH_CONF_ENABLED +/* + * Determine whether we need SLIP + * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT + * keep using SLIP + */ +#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT) +#define SLIP_ARCH_CONF_ENABLED 1 +#endif +#endif + +/** + * \brief Define this as 1 to build a headless node. + * + * The UART will not be initialised its clock will be gated, offering some + * energy savings. The USB will not be initialised either + */ +#ifndef CC2538_CONF_QUIET +#define CC2538_CONF_QUIET 0 +#endif + +/* CC2538_CONF_QUIET is hard and overrides all other related defines */ +#if CC2538_CONF_QUIET +#undef USB_SERIAL_CONF_ENABLE +#define USB_SERIAL_CONF_ENABLE 0 + +#undef UART_CONF_ENABLE +#define UART_CONF_ENABLE 0 +#endif /* CC2538_CONF_QUIET */ + +/** + * \brief Enable the USB core only if we need it + */ +#ifndef USB_SERIAL_CONF_ENABLE +#define USB_SERIAL_CONF_ENABLE \ + ((SLIP_ARCH_CONF_USB && SLIP_ARCH_CONF_ENABLED) || \ + (MAC_CONF_WITH_TSCH && (SLIP_ARCH_CONF_ENABLED || BUILD_WITH_SHELL)) || \ + DBG_CONF_USB) +#endif + +/* + * If debugging and SLIP use the same peripheral, this will be 1. Don't modify + * this + */ +#if SLIP_ARCH_CONF_ENABLED +#define DBG_CONF_SLIP_MUX (SLIP_ARCH_CONF_USB == DBG_CONF_USB && \ + (SLIP_ARCH_CONF_USB || \ + SLIP_ARCH_CONF_UART == DBG_CONF_UART)) +#endif + +/* + * Automatic detection of whether a specific UART is in use + */ +#define UART_IN_USE_BY_SERIAL_LINE(u) (SERIAL_LINE_CONF_UART == (u)) +#define UART_IN_USE_BY_SLIP(u) (SLIP_ARCH_CONF_ENABLED && \ + !SLIP_ARCH_CONF_USB && \ + SLIP_ARCH_CONF_UART == (u)) +#define UART_IN_USE_BY_DBG(u) (!DBG_CONF_USB && DBG_CONF_UART == (u)) +#define UART_IN_USE_BY_UART1(u) (UART1_CONF_UART == (u)) + +#define UART_IN_USE(u) ( \ + UART_CONF_ENABLE && \ + (UART_IN_USE_BY_SERIAL_LINE(u) || \ + UART_IN_USE_BY_SLIP(u) || \ + UART_IN_USE_BY_DBG(u) || \ + UART_IN_USE_BY_UART1(u)) \ +) +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name RF configuration + * + * @{ + */ +/* RF Config */ + +#ifdef RF_CHANNEL +#define CC2538_RF_CONF_CHANNEL RF_CHANNEL +#endif + +#ifndef CC2538_RF_CONF_CHANNEL +#define CC2538_RF_CONF_CHANNEL 26 +#endif /* CC2538_RF_CONF_CHANNEL */ + +#ifndef CC2538_RF_CONF_AUTOACK +#define CC2538_RF_CONF_AUTOACK 1 /**< RF H/W generates ACKs */ +#endif /* CC2538_CONF_AUTOACK */ + +#ifndef CC2538_RF_CONF_TX_USE_DMA +#define CC2538_RF_CONF_TX_USE_DMA 1 /**< RF TX over DMA */ +#endif + +#ifndef CC2538_RF_CONF_RX_USE_DMA +#define CC2538_RF_CONF_RX_USE_DMA 1 /**< RF RX over DMA */ +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name LPM configuration + * @{ + */ +#ifndef LPM_CONF_ENABLE +#define LPM_CONF_ENABLE 1 /**< Set to 0 to disable LPM entirely */ +#endif + +/** + * \brief Maximum PM + * + * The SoC will never drop to a Power Mode deeper than the one specified here. + * 0 for PM0, 1 for PM1 and 2 for PM2 + */ +#ifndef LPM_CONF_MAX_PM +#define LPM_CONF_MAX_PM 1 +#endif + +#ifndef LPM_CONF_STATS +#define LPM_CONF_STATS 0 /**< Set to 1 to enable LPM-related stats */ +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Radio Configuration + * + * @{ + */ +#ifndef NETSTACK_CONF_RADIO +#define NETSTACK_CONF_RADIO cc2538_rf_driver +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name IEEE address configuration + * + * Used to generate our link-layer & IPv6 address + * @{ + */ +/** + * \brief Location of the IEEE address + * 0 => Read from InfoPage, + * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS + */ +#ifndef IEEE_ADDR_CONF_HARDCODED +#define IEEE_ADDR_CONF_HARDCODED 0 +#endif + +/** + * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED + * is defined as 1 + */ +#ifndef IEEE_ADDR_CONF_ADDRESS +#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF } +#endif + +/** + * \brief Location of the IEEE address in the InfoPage when + * IEEE_ADDR_CONF_HARDCODED is defined as 0 + * 0 => Use the primary address location + * 1 => Use the secondary address location + */ +#ifndef IEEE_ADDR_CONF_USE_SECONDARY_LOCATION +#define IEEE_ADDR_CONF_USE_SECONDARY_LOCATION 0 +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Security + * + * @{ + */ +#ifndef CRYPTO_CONF_INIT +#define CRYPTO_CONF_INIT 1 /**< Whether to init cryptoprocessor */ +#endif + +#ifndef AES_128_CONF +#define AES_128_CONF cc2538_aes_128_driver /**< AES-128 driver */ +#endif + +#ifndef CCM_STAR_CONF +#define CCM_STAR_CONF cc2538_ccm_star_driver /**< AES-CCM* driver */ +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +#endif /* CC2538_CONF_H_ */ +/*---------------------------------------------------------------------------*/ +/** @} */ From fdde5dc66978b0a778e432128ff87057adf567ad Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:46:24 +0000 Subject: [PATCH 08/28] Provide header file with configuration common to all CC26xx-based platforms --- arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h | 204 ++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h diff --git a/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h b/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h new file mode 100644 index 000000000..6ecdafa6b --- /dev/null +++ b/arch/cpu/cc26xx-cc13xx/cc13xx-cc26xx-conf.h @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2017, George Oikonomou - http://www.spd.gr + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +/** + * \addtogroup cc26xx + * @{ + * + * \file + * Header with configuration defines common to all CC13xx/CC26xx platforms + */ +/*---------------------------------------------------------------------------*/ +#ifndef CC13XX_CC26XX_CONF_H_ +#define CC13XX_CC26XX_CONF_H_ +/*---------------------------------------------------------------------------*/ +/** + * \name Network Stack Configuration + * + * @{ + */ + +/* + * If set, the systems keeps the HF crystal oscillator on even when the radio is off. + * You need to set this to 1 to use TSCH with its default 2.2ms or larger guard time. + */ +#ifndef CC2650_FAST_RADIO_STARTUP +#define CC2650_FAST_RADIO_STARTUP (MAC_CONF_WITH_TSCH) +#endif + +#ifdef RF_CHANNEL +#define RF_CORE_CONF_CHANNEL RF_CHANNEL +#endif + +#ifndef RF_CORE_CONF_CHANNEL +#define RF_CORE_CONF_CHANNEL 25 +#endif + +/* Number of Prop Mode RX buffers */ +#ifndef PROP_MODE_CONF_RX_BUF_CNT +#define PROP_MODE_CONF_RX_BUF_CNT 4 +#endif + +/* + * Auto-configure Prop-mode radio if we are running on CC13xx, unless the + * project has specified otherwise. Depending on the final mode, determine a + * default channel (again, if unspecified) and configure RDC params + */ +#if CPU_FAMILY_CC13XX +#ifndef CC13XX_CONF_PROP_MODE +#define CC13XX_CONF_PROP_MODE 1 +#endif /* CC13XX_CONF_PROP_MODE */ +#endif /* CPU_FAMILY_CC13XX */ + +#if CC13XX_CONF_PROP_MODE +#define NETSTACK_CONF_RADIO prop_mode_driver + +#ifndef RF_CORE_CONF_CHANNEL +#define RF_CORE_CONF_CHANNEL 0 +#endif + +#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 400) +#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000) +#define CSMA_CONF_SEND_SOFT_ACK 1 + +#else /* CC13XX_CONF_PROP_MODE */ +#define NETSTACK_CONF_RADIO ieee_mode_driver + +#define CSMA_CONF_SEND_SOFT_ACK 0 +#endif /* CC13XX_CONF_PROP_MODE */ + +#define NETSTACK_RADIO_MAX_PAYLOAD_LEN 125 + +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name IEEE address configuration + * + * Used to generate our link-local & IPv6 address + * @{ + */ +/** + * \brief Location of the IEEE address + * 0 => Read from InfoPage, + * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS + */ +#ifndef IEEE_ADDR_CONF_HARDCODED +#define IEEE_ADDR_CONF_HARDCODED 0 +#endif + +/** + * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED + * is defined as 1 + */ +#ifndef IEEE_ADDR_CONF_ADDRESS +#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF } +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name RF configuration + * + * @{ + */ +/* RF Config */ + +#ifndef IEEE_MODE_CONF_AUTOACK +#define IEEE_MODE_CONF_AUTOACK 1 /**< RF H/W generates ACKs */ +#endif + +#ifndef IEEE_MODE_CONF_PROMISCOUS +#define IEEE_MODE_CONF_PROMISCOUS 0 /**< 1 to enable promiscous mode */ +#endif + +#ifndef RF_BLE_CONF_ENABLED +#define RF_BLE_CONF_ENABLED 0 /**< 0 to disable BLE support */ +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name Character I/O Configuration + * + * @{ + */ +#ifndef CC26XX_UART_CONF_ENABLE +#define CC26XX_UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */ +#endif + +#ifndef CC26XX_UART_CONF_BAUD_RATE +#define CC26XX_UART_CONF_BAUD_RATE 115200 /**< Default UART0 baud rate */ +#endif + +/* Enable I/O over the Debugger Devpack - Only relevant for the SensorTag */ +#ifndef BOARD_CONF_DEBUGGER_DEVPACK +#define BOARD_CONF_DEBUGGER_DEVPACK 1 +#endif + +#ifndef SLIP_ARCH_CONF_ENABLED +/* + * Determine whether we need SLIP + * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT + * keep using SLIP + */ +#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT) +#define SLIP_ARCH_CONF_ENABLED 1 +#endif +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name JTAG interface configuration + * + * Enable/Disable the JTAG DAP and TAP interfaces on the chip. + * Setting this to 0 will disable access to the debug interface + * to secure deployed images. + * @{ + */ +#ifndef CCXXWARE_CONF_JTAG_INTERFACE_ENABLE +#define CCXXWARE_CONF_JTAG_INTERFACE_ENABLE 1 +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +/** + * \name ROM Bootloader configuration + * + * Enable/Disable the ROM bootloader in your image, if the board supports it. + * Look in board.h to choose the DIO and corresponding level that will cause + * the chip to enter bootloader mode. + * @{ + */ +#ifndef ROM_BOOTLOADER_ENABLE +#define ROM_BOOTLOADER_ENABLE 0 +#endif +/** @} */ +/*---------------------------------------------------------------------------*/ +#endif /* CC13XX_CC26XX_CONF_H_ */ +/*---------------------------------------------------------------------------*/ +/** @} */ From 5c07cb02a8738ccfc48750e5e64287fb131cdddd Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:56:57 +0000 Subject: [PATCH 09/28] Pull CPU-related constants from the CPU header (CC13xx/CC26xx) --- arch/cpu/cc26xx-cc13xx/rtimer-arch.h | 2 - arch/platform/srf06-cc26xx/contiki-conf.h | 87 +---------------------- 2 files changed, 1 insertion(+), 88 deletions(-) diff --git a/arch/cpu/cc26xx-cc13xx/rtimer-arch.h b/arch/cpu/cc26xx-cc13xx/rtimer-arch.h index 128461c8d..c6907ee59 100644 --- a/arch/cpu/cc26xx-cc13xx/rtimer-arch.h +++ b/arch/cpu/cc26xx-cc13xx/rtimer-arch.h @@ -47,8 +47,6 @@ /*---------------------------------------------------------------------------*/ #include "contiki.h" /*---------------------------------------------------------------------------*/ -#define RTIMER_ARCH_SECOND 65536 -/*---------------------------------------------------------------------------*/ rtimer_clock_t rtimer_arch_now(void); /* HW oscillator frequency is 32 kHz, not 64 kHz and RTIMER_NOW() never returns diff --git a/arch/platform/srf06-cc26xx/contiki-conf.h b/arch/platform/srf06-cc26xx/contiki-conf.h index fbe9c5059..ec7d964bc 100644 --- a/arch/platform/srf06-cc26xx/contiki-conf.h +++ b/arch/platform/srf06-cc26xx/contiki-conf.h @@ -202,6 +202,7 @@ #define ROM_BOOTLOADER_ENABLE 0 #endif /** @} */ +#include "cc13xx-cc26xx-def.h" /*---------------------------------------------------------------------------*/ /** * \name Button configurations @@ -227,92 +228,6 @@ /* Platform-specific define to signify sensor reading failure */ #define CC26XX_SENSOR_READING_ERROR 0x80000000 /*---------------------------------------------------------------------------*/ -/** - * \name Compiler configuration and platform-specific type definitions - * - * Those values are not meant to be modified by the user - * @{ - */ -#define CLOCK_CONF_SECOND 128 - -/* Compiler configurations */ -#define CCIF -#define CLIF - -/* Platform typedefs */ -typedef uint32_t clock_time_t; -typedef uint32_t uip_stats_t; - -/* Clock (time) comparison macro */ -#define CLOCK_LT(a, b) ((signed long)((a) - (b)) < 0) - -/* - * rtimer.h typedefs rtimer_clock_t as unsigned short. We need to define - * RTIMER_CLOCK_DIFF to override this - */ -typedef uint32_t rtimer_clock_t; -#define RTIMER_CLOCK_DIFF(a, b) ((int32_t)((a) - (b))) - -/* --------------------------------------------------------------------- */ -/* TSCH related defines */ - -/* Delay between GO signal and SFD */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(81)) -/* Delay between GO signal and start listening. - * This value is so small because the radio is constantly on within each timeslot. */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(15)) -/* Delay between the SFD finishes arriving and it is detected in software. */ -#define RADIO_DELAY_BEFORE_DETECT ((unsigned)US_TO_RTIMERTICKS(352)) - -/* Timer conversion; radio is running at 4 MHz */ -#define RADIO_TIMER_SECOND 4000000u -#if (RTIMER_SECOND % 256) || (RADIO_TIMER_SECOND % 256) -#error RADIO_TO_RTIMER macro must be fixed! -#endif -#define RADIO_TO_RTIMER(X) ((uint32_t)(((uint64_t)(X) * (RTIMER_SECOND / 256)) / (RADIO_TIMER_SECOND / 256))) -#define USEC_TO_RADIO(X) ((X) * 4) - -/* The PHY header (preamble + SFD, 4+1 bytes) duration is equivalent to 10 symbols */ -#define RADIO_IEEE_802154_PHY_HEADER_DURATION_USEC 160 - -/* Do not turn off TSCH within a timeslot: not enough time */ -#define TSCH_CONF_RADIO_ON_DURING_TIMESLOT 1 - -/* Disable TSCH frame filtering */ -#define TSCH_CONF_HW_FRAME_FILTERING 0 - -/* Use hardware timestamps */ -#ifndef TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS -#define TSCH_CONF_RESYNC_WITH_SFD_TIMESTAMPS 1 -#define TSCH_CONF_TIMESYNC_REMOVE_JITTER 0 -#endif - -#ifndef TSCH_CONF_BASE_DRIFT_PPM -/* The drift compared to "true" 10ms slots. - * Enable adaptive sync to enable compensation for this. - * Slot length 10000 usec - * 328 ticks - * Tick duration 30.517578125 usec - * Real slot duration 10009.765625 usec - * Target - real duration = -9.765625 usec - * TSCH_CONF_BASE_DRIFT_PPM -977 - */ -#define TSCH_CONF_BASE_DRIFT_PPM -977 -#endif - -/* 10 times per second */ -#ifndef TSCH_CONF_CHANNEL_SCAN_DURATION -#define TSCH_CONF_CHANNEL_SCAN_DURATION (CLOCK_SECOND / 10) -#endif - -/* Slightly reduce the TSCH guard time (from 2200 usec to 1800 usec) to make sure - * the CC26xx radio has sufficient time to start up. */ -#ifndef TSCH_CONF_RX_WAIT -#define TSCH_CONF_RX_WAIT 1800 -#endif - -/** @} */ -/*---------------------------------------------------------------------------*/ /* board.h assumes that basic configuration is done */ #include "board.h" /*---------------------------------------------------------------------------*/ From fb9c0beb37c6a7221c3f7b3c28d78e4ff2803f05 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 00:57:24 +0000 Subject: [PATCH 10/28] Pull CPU-related configuration from the CPU header (CC13xx/CC26xx) --- arch/platform/srf06-cc26xx/contiki-conf.h | 161 +--------------------- 1 file changed, 3 insertions(+), 158 deletions(-) diff --git a/arch/platform/srf06-cc26xx/contiki-conf.h b/arch/platform/srf06-cc26xx/contiki-conf.h index ec7d964bc..07c8f285a 100644 --- a/arch/platform/srf06-cc26xx/contiki-conf.h +++ b/arch/platform/srf06-cc26xx/contiki-conf.h @@ -44,164 +44,6 @@ #include PROJECT_CONF_PATH #endif /* PROJECT_CONF_PATH */ /*---------------------------------------------------------------------------*/ -/** - * \name Network Stack Configuration - * - * @{ - */ - -/* - * If set, the systems keeps the HF crystal oscillator on even when the radio is off. - * You need to set this to 1 to use TSCH with its default 2.2ms or larger guard time. - */ -#ifndef CC2650_FAST_RADIO_STARTUP -#define CC2650_FAST_RADIO_STARTUP (MAC_CONF_WITH_TSCH) -#endif - -#ifdef RF_CHANNEL -#define RF_CORE_CONF_CHANNEL RF_CHANNEL -#endif - -#ifndef RF_CORE_CONF_CHANNEL -#define RF_CORE_CONF_CHANNEL 25 -#endif - -/* Number of Prop Mode RX buffers */ -#ifndef PROP_MODE_CONF_RX_BUF_CNT -#define PROP_MODE_CONF_RX_BUF_CNT 4 -#endif - -/* - * Auto-configure Prop-mode radio if we are running on CC13xx, unless the - * project has specified otherwise. Depending on the final mode, determine a - * default channel (again, if unspecified) and configure RDC params - */ -#if CPU_FAMILY_CC13XX -#ifndef CC13XX_CONF_PROP_MODE -#define CC13XX_CONF_PROP_MODE 1 -#endif /* CC13XX_CONF_PROP_MODE */ -#endif /* CPU_FAMILY_CC13XX */ - -#if CC13XX_CONF_PROP_MODE -#define NETSTACK_CONF_RADIO prop_mode_driver - -#ifndef RF_CORE_CONF_CHANNEL -#define RF_CORE_CONF_CHANNEL 0 -#endif - -#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 400) -#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000) -#define CSMA_CONF_SEND_SOFT_ACK 1 - -#else /* CC13XX_CONF_PROP_MODE */ -#define NETSTACK_CONF_RADIO ieee_mode_driver - -#define CSMA_CONF_SEND_SOFT_ACK 0 -#endif /* CC13XX_CONF_PROP_MODE */ - -#define NETSTACK_RADIO_MAX_PAYLOAD_LEN 125 - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name IEEE address configuration - * - * Used to generate our link-local & IPv6 address - * @{ - */ -/** - * \brief Location of the IEEE address - * 0 => Read from InfoPage, - * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS - */ -#ifndef IEEE_ADDR_CONF_HARDCODED -#define IEEE_ADDR_CONF_HARDCODED 0 -#endif - -/** - * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED - * is defined as 1 - */ -#ifndef IEEE_ADDR_CONF_ADDRESS -#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF } -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name RF configuration - * - * @{ - */ -/* RF Config */ - -#ifndef IEEE_MODE_CONF_AUTOACK -#define IEEE_MODE_CONF_AUTOACK 1 /**< RF H/W generates ACKs */ -#endif - -#ifndef IEEE_MODE_CONF_PROMISCOUS -#define IEEE_MODE_CONF_PROMISCOUS 0 /**< 1 to enable promiscous mode */ -#endif - -#ifndef RF_BLE_CONF_ENABLED -#define RF_BLE_CONF_ENABLED 0 /**< 0 to disable BLE support */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Character I/O Configuration - * - * @{ - */ -#ifndef CC26XX_UART_CONF_ENABLE -#define CC26XX_UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */ -#endif - -#ifndef CC26XX_UART_CONF_BAUD_RATE -#define CC26XX_UART_CONF_BAUD_RATE 115200 /**< Default UART0 baud rate */ -#endif - -/* Enable I/O over the Debugger Devpack - Only relevant for the SensorTag */ -#ifndef BOARD_CONF_DEBUGGER_DEVPACK -#define BOARD_CONF_DEBUGGER_DEVPACK 1 -#endif - -#ifndef SLIP_ARCH_CONF_ENABLED -/* - * Determine whether we need SLIP - * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT - * keep using SLIP - */ -#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT) -#define SLIP_ARCH_CONF_ENABLED 1 -#endif -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name JTAG interface configuration - * - * Enable/Disable the JTAG DAP and TAP interfaces on the chip. - * Setting this to 0 will disable access to the debug interface - * to secure deployed images. - * @{ - */ -#ifndef CCXXWARE_CONF_JTAG_INTERFACE_ENABLE -#define CCXXWARE_CONF_JTAG_INTERFACE_ENABLE 1 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name ROM Bootloader configuration - * - * Enable/Disable the ROM bootloader in your image, if the board supports it. - * Look in board.h to choose the DIO and corresponding level that will cause - * the chip to enter bootloader mode. - * @{ - */ -#ifndef ROM_BOOTLOADER_ENABLE -#define ROM_BOOTLOADER_ENABLE 0 -#endif -/** @} */ #include "cc13xx-cc26xx-def.h" /*---------------------------------------------------------------------------*/ /** @@ -231,6 +73,9 @@ /* board.h assumes that basic configuration is done */ #include "board.h" /*---------------------------------------------------------------------------*/ +/* Include CPU-related configuration */ +#include "cc13xx-cc26xx-conf.h" +/*---------------------------------------------------------------------------*/ #endif /* CONTIKI_CONF_H */ /** @} */ From ba8f37bef4aa16580d7caedc7c527d4043bd16dd Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 01:02:22 +0000 Subject: [PATCH 11/28] Pull CPU-related constants from the CPU header (nrf52dk) --- arch/platform/nrf52dk/contiki-conf.h | 1 + arch/platform/nrf52dk/platform-conf.h | 29 --------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/arch/platform/nrf52dk/contiki-conf.h b/arch/platform/nrf52dk/contiki-conf.h index 2ab089856..6e1529352 100644 --- a/arch/platform/nrf52dk/contiki-conf.h +++ b/arch/platform/nrf52dk/contiki-conf.h @@ -49,6 +49,7 @@ /*---------------------------------------------------------------------------*/ /* Include platform peripherals configuration */ #include "platform-conf.h" +#include "nrf52832-def.h" /*---------------------------------------------------------------------------*/ /** * \name Network Stack Configuration diff --git a/arch/platform/nrf52dk/platform-conf.h b/arch/platform/nrf52dk/platform-conf.h index d40fd2b3e..e2fd6cac0 100644 --- a/arch/platform/nrf52dk/platform-conf.h +++ b/arch/platform/nrf52dk/platform-conf.h @@ -107,35 +107,6 @@ */ #define PLATFORM_TIMER_INSTANCE_ID 1 -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Compiler configuration and platform-specific type definitions - * - * Those values are not meant to be modified by the user - * @{ - */ -#define CLOCK_CONF_SECOND 128 - -/* Compiler configurations */ -#define CCIF -#define CLIF - -/* Platform typedefs */ -typedef uint32_t clock_time_t; -typedef uint32_t uip_stats_t; - -/* Clock (time) comparison macro */ -#define CLOCK_LT(a, b) ((signed long)((a) - (b)) < 0) - -#define RTIMER_ARCH_SECOND 62500 -/* - * rtimer.h typedefs rtimer_clock_t as unsigned short. We need to define - * RTIMER_CLOCK_DIFF to override this - */ -typedef uint32_t rtimer_clock_t; -#define RTIMER_CLOCK_DIFF(a,b) ((int32_t)((a)-(b))) - /** @} */ /*---------------------------------------------------------------------------*/ /** @} From 03435d826e7a058216695890e0c20407e6280ac9 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 01:04:22 +0000 Subject: [PATCH 12/28] Pull CPU-related constants from the CPU header (CC2538DK) --- arch/platform/cc2538dk/contiki-conf.h | 46 +-------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/arch/platform/cc2538dk/contiki-conf.h b/arch/platform/cc2538dk/contiki-conf.h index 4f7f6dc0a..b956f90e6 100644 --- a/arch/platform/cc2538dk/contiki-conf.h +++ b/arch/platform/cc2538dk/contiki-conf.h @@ -47,51 +47,7 @@ #include PROJECT_CONF_PATH #endif /* PROJECT_CONF_PATH */ /*---------------------------------------------------------------------------*/ -/** - * \name Compiler configuration and platform-specific type definitions - * - * Those values are not meant to be modified by the user - * @{ - */ -#define CLOCK_CONF_SECOND 128 - -/* Compiler configurations */ -#define CCIF -#define CLIF - -/* Platform typedefs */ -typedef uint32_t clock_time_t; -typedef uint32_t uip_stats_t; - -/* - * rtimer.h typedefs rtimer_clock_t as unsigned short. We need to define - * RTIMER_CLOCK_DIFF to override this - */ -typedef uint32_t rtimer_clock_t; -#define RTIMER_CLOCK_DIFF(a,b) ((int32_t)((a)-(b))) -/** @} */ -/*---------------------------------------------------------------------------*/ -/* 352us from calling transmit() until the SFD byte has been sent */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(352)) -/* 192us as in datasheet but ACKs are not always received, so adjusted to 250us */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(250)) -#define RADIO_DELAY_BEFORE_DETECT 0 -#ifndef TSCH_CONF_BASE_DRIFT_PPM -/* The drift compared to "true" 10ms slots. - * Enable adaptive sync to enable compensation for this. - * Slot length 10000 usec - * 328 ticks - * Tick duration 30.517578125 usec - * Real slot duration 10009.765625 usec - * Target - real duration = -9.765625 usec - * TSCH_CONF_BASE_DRIFT_PPM -977 - */ -#define TSCH_CONF_BASE_DRIFT_PPM -977 -#endif - -#if MAC_CONF_WITH_TSCH -#define TSCH_CONF_HW_FRAME_FILTERING 0 -#endif /* MAC_CONF_WITH_TSCH */ +#include "cc2538-def.h" /*---------------------------------------------------------------------------*/ /** * \name Serial Boot Loader Backdoor configuration From 88feb34ec7aa89eaeddfc3d6ff58446accd9c6e6 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 01:04:40 +0000 Subject: [PATCH 13/28] Pull CPU-related configuration from the CPU header (CC2538DK) --- arch/platform/cc2538dk/contiki-conf.h | 270 +------------------------- 1 file changed, 4 insertions(+), 266 deletions(-) diff --git a/arch/platform/cc2538dk/contiki-conf.h b/arch/platform/cc2538dk/contiki-conf.h index b956f90e6..1a463a0be 100644 --- a/arch/platform/cc2538dk/contiki-conf.h +++ b/arch/platform/cc2538dk/contiki-conf.h @@ -55,7 +55,7 @@ * @{ */ #ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR -#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /** RAM DMA channel */ -#define USB_ARCH_CONF_TX_DMA_CHAN 1 /**< RAM -> USB DMA channel */ -#define CC2538_RF_CONF_TX_DMA_CHAN 2 /**< RF -> RAM DMA channel */ -#define CC2538_RF_CONF_RX_DMA_CHAN 3 /**< RAM -> RF DMA channel */ -#define UDMA_CONF_MAX_CHANNEL CC2538_RF_CONF_RX_DMA_CHAN -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Character I/O Configuration - * - * @{ - */ -#ifndef UART_CONF_ENABLE -#define UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */ -#endif - -#ifndef UART0_CONF_BAUD_RATE -#define UART0_CONF_BAUD_RATE 115200 /**< Default UART0 baud rate */ -#endif - -#ifndef UART1_CONF_BAUD_RATE -#define UART1_CONF_BAUD_RATE 115200 /**< Default UART1 baud rate */ -#endif - -#ifndef SLIP_ARCH_CONF_USB -#define SLIP_ARCH_CONF_USB 0 /**< SLIP over UART by default */ -#endif - -#ifndef DBG_CONF_USB -#define DBG_CONF_USB 0 /**< All debugging over UART by default */ -#endif - -#ifndef SERIAL_LINE_CONF_UART -#define SERIAL_LINE_CONF_UART 0 /**< UART to use with serial line */ -#endif - -#if !SLIP_ARCH_CONF_USB -#ifndef SLIP_ARCH_CONF_UART -#define SLIP_ARCH_CONF_UART 0 /**< UART to use with SLIP */ -#endif -#endif - -#if !DBG_CONF_USB -#ifndef DBG_CONF_UART -#define DBG_CONF_UART 0 /**< UART to use for debugging */ -#endif -#endif - -#ifndef UART1_CONF_UART -#define UART1_CONF_UART 0 /**< UART to use for examples relying on - the uart1_* API */ -#endif - -#ifndef SLIP_ARCH_CONF_ENABLED -/* - * Determine whether we need SLIP - * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT - * keep using SLIP - */ -#if defined (UIP_FALLBACK_INTERFACE) || defined (CMD_CONF_OUTPUT) -#define SLIP_ARCH_CONF_ENABLED 1 -#endif -#endif - -/** - * \brief Define this as 1 to build a headless node. - * - * The UART will not be initialised its clock will be gated, offering some - * energy savings. The USB will not be initialised either - */ -#ifndef CC2538_CONF_QUIET -#define CC2538_CONF_QUIET 0 -#endif - -/* CC2538_CONF_QUIET is hard and overrides all other related defines */ -#if CC2538_CONF_QUIET -#undef USB_SERIAL_CONF_ENABLE -#define USB_SERIAL_CONF_ENABLE 0 - -#undef UART_CONF_ENABLE -#define UART_CONF_ENABLE 0 -#endif /* CC2538_CONF_QUIET */ - -/** - * \brief Enable the USB core only if we need it - */ -#ifndef USB_SERIAL_CONF_ENABLE -#define USB_SERIAL_CONF_ENABLE \ - ((SLIP_ARCH_CONF_USB && SLIP_ARCH_CONF_ENABLED) || \ - (MAC_CONF_WITH_TSCH && (SLIP_ARCH_CONF_ENABLED || BUILD_WITH_SHELL)) || \ - DBG_CONF_USB) -#endif - -/* - * If debugging and SLIP use the same peripheral, this will be 1. Don't modify - * this - */ -#if SLIP_ARCH_CONF_ENABLED -#define DBG_CONF_SLIP_MUX (SLIP_ARCH_CONF_USB == DBG_CONF_USB && \ - (SLIP_ARCH_CONF_USB || \ - SLIP_ARCH_CONF_UART == DBG_CONF_UART)) -#endif - -/* - * Automatic detection of whether a specific UART is in use - */ -#define UART_IN_USE_BY_SERIAL_LINE(u) (SERIAL_LINE_CONF_UART == (u)) -#define UART_IN_USE_BY_SLIP(u) (SLIP_ARCH_CONF_ENABLED && \ - !SLIP_ARCH_CONF_USB && \ - SLIP_ARCH_CONF_UART == (u)) -#define UART_IN_USE_BY_DBG(u) (!DBG_CONF_USB && DBG_CONF_UART == (u)) -#define UART_IN_USE_BY_UART1(u) (UART1_CONF_UART == (u)) - -#define UART_IN_USE(u) ( \ - UART_CONF_ENABLE && \ - (UART_IN_USE_BY_SERIAL_LINE(u) || \ - UART_IN_USE_BY_SLIP(u) || \ - UART_IN_USE_BY_DBG(u) || \ - UART_IN_USE_BY_UART1(u)) \ -) -/** @} */ -/*---------------------------------------------------------------------------*/ /* board.h assumes that basic configuration is done */ #include "board.h" /*---------------------------------------------------------------------------*/ - -#define NETSTACK_CONF_RADIO cc2538_rf_driver -/** @} */ +/* Include CPU-related configuration */ +#include "cc2538-conf.h" /*---------------------------------------------------------------------------*/ -/** - * \name LPM configuration - * @{ - */ -#ifndef LPM_CONF_ENABLE -#define LPM_CONF_ENABLE 1 /**< Set to 0 to disable LPM entirely */ -#endif - -/** - * \brief Maximum PM - * - * The SoC will never drop to a Power Mode deeper than the one specified here. - * 0 for PM0, 1 for PM1 and 2 for PM2 - */ -#ifndef LPM_CONF_MAX_PM -#define LPM_CONF_MAX_PM 1 -#endif - -#ifndef LPM_CONF_STATS -#define LPM_CONF_STATS 0 /**< Set to 1 to enable LPM-related stats */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name IEEE address configuration - * - * Used to generate our link-layer & IPv6 address - * @{ - */ -/** - * \brief Location of the IEEE address - * 0 => Read from InfoPage, - * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS - */ -#ifndef IEEE_ADDR_CONF_HARDCODED -#define IEEE_ADDR_CONF_HARDCODED 0 -#endif - -/** - * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED - * is defined as 1 - */ -#ifndef IEEE_ADDR_CONF_ADDRESS -#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF } -#endif - -/** - * \brief Location of the IEEE address in the InfoPage when - * IEEE_ADDR_CONF_HARDCODED is defined as 0 - * 0 => Use the primary address location - * 1 => Use the secondary address location - */ -#ifndef IEEE_ADDR_CONF_USE_SECONDARY_LOCATION -#define IEEE_ADDR_CONF_USE_SECONDARY_LOCATION 0 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name RF configuration - * - * @{ - */ -/* RF Config */ -#ifdef RF_CHANNEL -#define CC2538_RF_CONF_CHANNEL RF_CHANNEL -#endif - -#ifndef CC2538_RF_CONF_CHANNEL -#define CC2538_RF_CONF_CHANNEL 25 -#endif /* CC2538_RF_CONF_CHANNEL */ - -#ifndef CC2538_RF_CONF_AUTOACK -#define CC2538_RF_CONF_AUTOACK 1 /**< RF H/W generates ACKs */ -#endif /* CC2538_CONF_AUTOACK */ - -#ifndef CC2538_RF_CONF_TX_USE_DMA -#define CC2538_RF_CONF_TX_USE_DMA 1 /**< RF TX over DMA */ -#endif - -#ifndef CC2538_RF_CONF_RX_USE_DMA -#define CC2538_RF_CONF_RX_USE_DMA 1 /**< RF RX over DMA */ -#endif -/** @} */ - -/*---------------------------------------------------------------------------*/ -/** - * \name Security - * - * @{ - */ -#ifndef CRYPTO_CONF_INIT -#define CRYPTO_CONF_INIT 1 /**< Whether to init cryptoprocessor */ -#endif - -#ifndef AES_128_CONF -#define AES_128_CONF cc2538_aes_128_driver /**< AES-128 driver */ -#endif - -#ifndef CCM_STAR_CONF -#define CCM_STAR_CONF cc2538_ccm_star_driver /**< AES-CCM* driver */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ - #endif /* CONTIKI_CONF_H_ */ - +/*---------------------------------------------------------------------------*/ /** @} */ From 91c437e63142059c15935812a2b59085a11b4cad Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 01:04:58 +0000 Subject: [PATCH 14/28] Pull CPU-related constants from the CPU header (OpenMote) --- arch/platform/openmote-cc2538/contiki-conf.h | 46 +------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/arch/platform/openmote-cc2538/contiki-conf.h b/arch/platform/openmote-cc2538/contiki-conf.h index 4cc9d9dce..1370752c1 100644 --- a/arch/platform/openmote-cc2538/contiki-conf.h +++ b/arch/platform/openmote-cc2538/contiki-conf.h @@ -56,51 +56,7 @@ #include PROJECT_CONF_PATH #endif /* PROJECT_CONF_PATH */ /*---------------------------------------------------------------------------*/ -/** - * \name Compiler configuration and platform-specific type definitions - * - * Those values are not meant to be modified by the user - * @{ - */ -#define CLOCK_CONF_SECOND 128 - -/* Compiler configurations */ -#define CCIF -#define CLIF - -/* Platform typedefs */ -typedef uint32_t clock_time_t; -typedef uint32_t uip_stats_t; - -/* - * rtimer.h typedefs rtimer_clock_t as unsigned short. We need to define - * RTIMER_CLOCK_DIFF to override this - */ -typedef uint32_t rtimer_clock_t; -#define RTIMER_CLOCK_DIFF(a, b) ((int32_t)((a) - (b))) -/** @} */ -/*---------------------------------------------------------------------------*/ -/* 352us from calling transmit() until the SFD byte has been sent */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(352)) -/* 192us as in datasheet but ACKs are not always received, so adjusted to 250us */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(250)) -#define RADIO_DELAY_BEFORE_DETECT 0 -#ifndef TSCH_CONF_BASE_DRIFT_PPM -/* The drift compared to "true" 10ms slots. - * Enable adaptive sync to enable compensation for this. - * Slot length 10000 usec - * 328 ticks - * Tick duration 30.517578125 usec - * Real slot duration 10009.765625 usec - * Target - real duration = -9.765625 usec - * TSCH_CONF_BASE_DRIFT_PPM -977 - */ -#define TSCH_CONF_BASE_DRIFT_PPM -977 -#endif - -#if MAC_CONF_WITH_TSCH -#define TSCH_CONF_HW_FRAME_FILTERING 0 -#endif /* MAC_CONF_WITH_TSCH */ +#include "cc2538-def.h" /*---------------------------------------------------------------------------*/ /** * \name Serial Boot Loader Backdoor configuration From 369f58a60b0b9ef58cf4e3b7840d4177cdb4467f Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 01:06:29 +0000 Subject: [PATCH 15/28] Pull CPU-related configuration from the CPU header (OpenMote) --- arch/platform/openmote-cc2538/contiki-conf.h | 283 +------------------ 1 file changed, 2 insertions(+), 281 deletions(-) diff --git a/arch/platform/openmote-cc2538/contiki-conf.h b/arch/platform/openmote-cc2538/contiki-conf.h index 1370752c1..d9f0b047e 100644 --- a/arch/platform/openmote-cc2538/contiki-conf.h +++ b/arch/platform/openmote-cc2538/contiki-conf.h @@ -86,290 +86,11 @@ #endif /** @} */ /*---------------------------------------------------------------------------*/ -/** - * \name CFS configuration - * - * @{ - */ -#ifndef COFFEE_CONF_SIZE -#define COFFEE_CONF_SIZE (4 * COFFEE_SECTOR_SIZE) -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Watchdog Timer configuration - * - * @{ - */ -#ifndef WATCHDOG_CONF_ENABLE -#define WATCHDOG_CONF_ENABLE 1 /**< Enable the watchdog timer */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB 'core' configuration - * - * Those values are not meant to be modified by the user, except where stated - * otherwise - * @{ - */ -#define CTRL_EP_SIZE 8 -#define USB_EP1_SIZE 32 -#define USB_EP2_SIZE 64 -#define USB_EP3_SIZE 64 -#define USB_ARCH_WRITE_NOTIFY 0 - -#ifndef USB_ARCH_CONF_DMA -#define USB_ARCH_CONF_DMA 1 /**< Change to Enable/Disable USB DMA */ - -#endif -/** @} */ - -/*---------------------------------------------------------------------------*/ -/** - * \name uDMA Configuration and channel allocations - * - * @{ - */ -#define USB_ARCH_CONF_RX_DMA_CHAN 0 /**< USB -> RAM DMA channel */ -#define USB_ARCH_CONF_TX_DMA_CHAN 1 /**< RAM -> USB DMA channel */ -#define CC2538_RF_CONF_TX_DMA_CHAN 2 /**< RF -> RAM DMA channel */ -#define CC2538_RF_CONF_RX_DMA_CHAN 3 /**< RAM -> RF DMA channel */ -#define UDMA_CONF_MAX_CHANNEL CC2538_RF_CONF_RX_DMA_CHAN -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Character I/O Configuration - * - * @{ - */ -#ifndef UART_CONF_ENABLE -#define UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */ -#endif - -#ifndef UART0_CONF_BAUD_RATE -#define UART0_CONF_BAUD_RATE 115200 /**< Default UART0 baud rate */ -#endif - -#ifndef UART1_CONF_BAUD_RATE -#define UART1_CONF_BAUD_RATE 115200 /**< Default UART1 baud rate */ -#endif - -#ifndef SLIP_ARCH_CONF_USB -#define SLIP_ARCH_CONF_USB 0 /**< SLIP over UART by default */ -#endif - -#ifndef DBG_CONF_USB -#define DBG_CONF_USB 0 /**< All debugging over UART by default */ -#endif - -#ifndef SERIAL_LINE_CONF_UART -#define SERIAL_LINE_CONF_UART 0 /**< UART to use with serial line */ -#endif - -#if !SLIP_ARCH_CONF_USB -#ifndef SLIP_ARCH_CONF_UART -#define SLIP_ARCH_CONF_UART 0 /**< UART to use with SLIP */ -#endif -#endif - -#if !DBG_CONF_USB -#ifndef DBG_CONF_UART -#define DBG_CONF_UART 0 /**< UART to use for debugging */ -#endif -#endif - -#ifndef UART1_CONF_UART -#define UART1_CONF_UART 0 /**< UART to use for examples relying on - the uart1_* API */ -#endif - -#ifndef SLIP_ARCH_CONF_ENABLED -/* - * Determine whether we need SLIP - * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT - * keep using SLIP - */ -#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT) -#define SLIP_ARCH_CONF_ENABLED 1 -#endif -#endif - -/** - * \brief Define this as 1 to build a headless node. - * - * The UART will not be initialised its clock will be gated, offering some - * energy savings. The USB will not be initialised either - */ -#ifndef CC2538_CONF_QUIET -#define CC2538_CONF_QUIET 0 -#endif - -/* CC2538_CONF_QUIET is hard and overrides all other related defines */ -#if CC2538_CONF_QUIET -#undef USB_SERIAL_CONF_ENABLE -#define USB_SERIAL_CONF_ENABLE 0 - -#undef UART_CONF_ENABLE -#define UART_CONF_ENABLE 0 -#endif /* CC2538_CONF_QUIET */ - -/** - * \brief Enable the USB core only if we need it - */ -#ifndef USB_SERIAL_CONF_ENABLE -#define USB_SERIAL_CONF_ENABLE \ - ((SLIP_ARCH_CONF_USB && SLIP_ARCH_CONF_ENABLED) || \ - (MAC_CONF_WITH_TSCH && (SLIP_ARCH_CONF_ENABLED || BUILD_WITH_SHELL)) || \ - DBG_CONF_USB) -#endif - -/* - * If debugging and SLIP use the same peripheral, this will be 1. Don't modify - * this - */ -#if SLIP_ARCH_CONF_ENABLED -#define DBG_CONF_SLIP_MUX (SLIP_ARCH_CONF_USB == DBG_CONF_USB && \ - (SLIP_ARCH_CONF_USB || \ - SLIP_ARCH_CONF_UART == DBG_CONF_UART)) -#endif - -/* - * Automatic detection of whether a specific UART is in use - */ -#define UART_IN_USE_BY_SERIAL_LINE(u) (SERIAL_LINE_CONF_UART == (u)) -#define UART_IN_USE_BY_SLIP(u) (SLIP_ARCH_CONF_ENABLED && \ - !SLIP_ARCH_CONF_USB && \ - SLIP_ARCH_CONF_UART == (u)) -#define UART_IN_USE_BY_DBG(u) (!DBG_CONF_USB && DBG_CONF_UART == (u)) -#define UART_IN_USE_BY_UART1(u) (UART1_CONF_UART == (u)) - -#define UART_IN_USE(u) ( \ - UART_CONF_ENABLE && \ - (UART_IN_USE_BY_SERIAL_LINE(u) || \ - UART_IN_USE_BY_SLIP(u) || \ - UART_IN_USE_BY_DBG(u) || \ - UART_IN_USE_BY_UART1(u)) \ - ) -/** @} */ -/*---------------------------------------------------------------------------*/ /* board.h assumes that basic configuration is done */ #include "board.h" /*---------------------------------------------------------------------------*/ -/** - * \name Radio Configuration - * - * @{ - */ - -#ifndef NETSTACK_CONF_RADIO -#define NETSTACK_CONF_RADIO cc2538_rf_driver -#endif - -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name LPM configuration - * @{ - */ -#ifndef LPM_CONF_ENABLE -#define LPM_CONF_ENABLE 1 /**< Set to 0 to disable LPM entirely */ -#endif - -/** - * \brief Maximum PM - * - * The SoC will never drop to a Power Mode deeper than the one specified here. - * 0 for PM0, 1 for PM1 and 2 for PM2 - */ -#ifndef LPM_CONF_MAX_PM -#define LPM_CONF_MAX_PM 1 -#endif - -#ifndef LPM_CONF_STATS -#define LPM_CONF_STATS 0 /**< Set to 1 to enable LPM-related stats */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name IEEE address configuration - * - * Used to generate our link-layer & IPv6 address - * @{ - */ -/** - * \brief Location of the IEEE address - * 0 => Read from InfoPage, - * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS - */ -#ifndef IEEE_ADDR_CONF_HARDCODED -#define IEEE_ADDR_CONF_HARDCODED 0 -#endif - -/** - * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED - * is defined as 1 - */ -#ifndef IEEE_ADDR_CONF_ADDRESS -#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF } -#endif - -/** - * \brief Location of the IEEE address in the InfoPage when - * IEEE_ADDR_CONF_HARDCODED is defined as 0 - * 0 => Use the primary address location - * 1 => Use the secondary address location - */ -#ifndef IEEE_ADDR_CONF_USE_SECONDARY_LOCATION -#define IEEE_ADDR_CONF_USE_SECONDARY_LOCATION 0 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name RF configuration - * - * @{ - */ -/* RF Config */ - -#ifdef RF_CHANNEL -#define CC2538_RF_CONF_CHANNEL RF_CHANNEL -#endif - -#ifndef CC2538_RF_CONF_CHANNEL -#define CC2538_RF_CONF_CHANNEL 26 -#endif /* CC2538_RF_CONF_CHANNEL */ - -#ifndef CC2538_RF_CONF_AUTOACK -#define CC2538_RF_CONF_AUTOACK 1 /**< RF H/W generates ACKs */ -#endif /* CC2538_CONF_AUTOACK */ - -#ifndef CC2538_RF_CONF_TX_USE_DMA -#define CC2538_RF_CONF_TX_USE_DMA 1 /**< RF TX over DMA */ -#endif - -#ifndef CC2538_RF_CONF_RX_USE_DMA -#define CC2538_RF_CONF_RX_USE_DMA 1 /**< RF RX over DMA */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Security - * - * @{ - */ -#ifndef CRYPTO_CONF_INIT -#define CRYPTO_CONF_INIT 1 /**< Whether to init cryptoprocessor */ -#endif - -#ifndef AES_128_CONF -#define AES_128_CONF cc2538_aes_128_driver /**< AES-128 driver */ -#endif - -#ifndef CCM_STAR_CONF -#define CCM_STAR_CONF cc2538_ccm_star_driver /**< AES-CCM* driver */ -#endif -/** @} */ +/* Include CPU-related configuration */ +#include "cc2538-conf.h" /*---------------------------------------------------------------------------*/ #endif /* CONTIKI_CONF_H_ */ /*---------------------------------------------------------------------------*/ From 458fbb1ee21b1dc756791d64ac15af4bb39032be Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 01:06:50 +0000 Subject: [PATCH 16/28] Pull CPU-related constants from the CPU header (Zoul) --- arch/platform/zoul/contiki-conf.h | 46 +------------------------------ 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/arch/platform/zoul/contiki-conf.h b/arch/platform/zoul/contiki-conf.h index 35d4ebc6d..710ad1695 100644 --- a/arch/platform/zoul/contiki-conf.h +++ b/arch/platform/zoul/contiki-conf.h @@ -53,51 +53,7 @@ #include PROJECT_CONF_PATH #endif /* PROJECT_CONF_PATH */ /*---------------------------------------------------------------------------*/ -/** - * \name Compiler configuration and platform-specific type definitions - * - * Those values are not meant to be modified by the user - * @{ - */ -#define CLOCK_CONF_SECOND 128 - -/* Compiler configurations */ -#define CCIF -#define CLIF - -/* Platform typedefs */ -typedef uint32_t clock_time_t; -typedef uint32_t uip_stats_t; - -/* - * rtimer.h typedefs rtimer_clock_t as unsigned short. We need to define - * RTIMER_CLOCK_DIFF to override this - */ -typedef uint32_t rtimer_clock_t; -#define RTIMER_CLOCK_DIFF(a, b) ((int32_t)((a) - (b))) -/** @} */ -/*---------------------------------------------------------------------------*/ -/* 352us from calling transmit() until the SFD byte has been sent */ -#define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(352)) -/* 192us as in datasheet but ACKs are not always received, so adjusted to 250us */ -#define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(250)) -#define RADIO_DELAY_BEFORE_DETECT 0 -#ifndef TSCH_CONF_BASE_DRIFT_PPM -/* The drift compared to "true" 10ms slots. - * Enable adaptive sync to enable compensation for this. - * Slot length 10000 usec - * 328 ticks - * Tick duration 30.517578125 usec - * Real slot duration 10009.765625 usec - * Target - real duration = -9.765625 usec - * TSCH_CONF_BASE_DRIFT_PPM -977 - */ -#define TSCH_CONF_BASE_DRIFT_PPM -977 -#endif - -#if MAC_CONF_WITH_TSCH -#define TSCH_CONF_HW_FRAME_FILTERING 0 -#endif /* MAC_CONF_WITH_TSCH */ +#include "cc2538-def.h" /*---------------------------------------------------------------------------*/ /** * \name Serial Boot Loader Backdoor configuration From da5d415bc1c94439a95da4d9f07d9585f3e1c607 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 3 Dec 2017 01:07:04 +0000 Subject: [PATCH 17/28] Pull CPU-related configuration from the CPU header (Zoul) --- arch/platform/zoul/contiki-conf.h | 252 +----------------------------- 1 file changed, 4 insertions(+), 248 deletions(-) diff --git a/arch/platform/zoul/contiki-conf.h b/arch/platform/zoul/contiki-conf.h index 710ad1695..cfca8f9f1 100644 --- a/arch/platform/zoul/contiki-conf.h +++ b/arch/platform/zoul/contiki-conf.h @@ -83,172 +83,6 @@ #endif /** @} */ /*---------------------------------------------------------------------------*/ -/** - * \name CFS configuration - * - * @{ - */ -#ifndef COFFEE_CONF_SIZE -#define COFFEE_CONF_SIZE (4 * COFFEE_SECTOR_SIZE) -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Watchdog Timer configuration - * - * @{ - */ -#ifndef WATCHDOG_CONF_ENABLE -#define WATCHDOG_CONF_ENABLE 1 /**< Enable the watchdog timer */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name USB 'core' configuration - * - * Those values are not meant to be modified by the user, except where stated - * otherwise - * @{ - */ -#define CTRL_EP_SIZE 8 -#define USB_EP1_SIZE 32 -#define USB_EP2_SIZE 64 -#define USB_EP3_SIZE 64 -#define USB_ARCH_WRITE_NOTIFY 0 - -#ifndef USB_ARCH_CONF_DMA -#define USB_ARCH_CONF_DMA 1 /**< Change to Enable/Disable USB DMA */ - -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name uDMA Configuration and channel allocations - * - * @{ - */ -#define USB_ARCH_CONF_RX_DMA_CHAN 0 /**< USB -> RAM DMA channel */ -#define USB_ARCH_CONF_TX_DMA_CHAN 1 /**< RAM -> USB DMA channel */ -#define CC2538_RF_CONF_TX_DMA_CHAN 2 /**< RF -> RAM DMA channel */ -#define CC2538_RF_CONF_RX_DMA_CHAN 3 /**< RAM -> RF DMA channel */ -#define UDMA_CONF_MAX_CHANNEL CC2538_RF_CONF_RX_DMA_CHAN -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Character I/O Configuration - * - * @{ - */ -#ifndef UART_CONF_ENABLE -#define UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */ -#endif - -#ifndef UART0_CONF_BAUD_RATE -#define UART0_CONF_BAUD_RATE 115200 /**< Default UART0 baud rate */ -#endif - -#ifndef UART1_CONF_BAUD_RATE -#define UART1_CONF_BAUD_RATE 115200 /**< Default UART1 baud rate */ -#endif - -#ifndef SLIP_ARCH_CONF_USB -#define SLIP_ARCH_CONF_USB 0 /**< SLIP over UART by default */ -#endif - -#ifndef DBG_CONF_USB -#define DBG_CONF_USB 0 /**< All debugging over UART by default */ -#endif - -#ifndef SERIAL_LINE_CONF_UART -#define SERIAL_LINE_CONF_UART 0 /**< UART to use with serial line */ -#endif - -#if !SLIP_ARCH_CONF_USB -#ifndef SLIP_ARCH_CONF_UART -#define SLIP_ARCH_CONF_UART 0 /**< UART to use with SLIP */ -#endif -#endif - -#if !DBG_CONF_USB -#ifndef DBG_CONF_UART -#define DBG_CONF_UART 0 /**< UART to use for debugging */ -#endif -#endif - -#ifndef UART1_CONF_UART -#define UART1_CONF_UART 0 /**< UART to use for examples relying on - the uart1_* API */ -#endif - -#ifndef SLIP_ARCH_CONF_ENABLED -/* - * Determine whether we need SLIP - * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT - * keep using SLIP - */ -#if defined(UIP_FALLBACK_INTERFACE) || defined(CMD_CONF_OUTPUT) -#define SLIP_ARCH_CONF_ENABLED 1 -#endif -#endif - -/** - * \brief Define this as 1 to build a headless node. - * - * The UART will not be initialised its clock will be gated, offering some - * energy savings. The USB will not be initialised either - */ -#ifndef CC2538_CONF_QUIET -#define CC2538_CONF_QUIET 0 -#endif - -/* CC2538_CONF_QUIET is hard and overrides all other related defines */ -#if CC2538_CONF_QUIET -#undef USB_SERIAL_CONF_ENABLE -#define USB_SERIAL_CONF_ENABLE 0 - -#undef UART_CONF_ENABLE -#define UART_CONF_ENABLE 0 -#endif /* CC2538_CONF_QUIET */ - -/** - * \brief Enable the USB core only if we need it - */ -#ifndef USB_SERIAL_CONF_ENABLE -#define USB_SERIAL_CONF_ENABLE \ - ((SLIP_ARCH_CONF_USB && SLIP_ARCH_CONF_ENABLED) || \ - (MAC_CONF_WITH_TSCH && (SLIP_ARCH_CONF_ENABLED || BUILD_WITH_SHELL)) || \ - DBG_CONF_USB) -#endif - -/* - * If debugging and SLIP use the same peripheral, this will be 1. Don't modify - * this - */ -#if SLIP_ARCH_CONF_ENABLED -#define DBG_CONF_SLIP_MUX (SLIP_ARCH_CONF_USB == DBG_CONF_USB && \ - (SLIP_ARCH_CONF_USB || \ - SLIP_ARCH_CONF_UART == DBG_CONF_UART)) -#endif - -/* - * Automatic detection of whether a specific UART is in use - */ -#define UART_IN_USE_BY_SERIAL_LINE(u) (SERIAL_LINE_CONF_UART == (u)) -#define UART_IN_USE_BY_SLIP(u) (SLIP_ARCH_CONF_ENABLED && \ - !SLIP_ARCH_CONF_USB && \ - SLIP_ARCH_CONF_UART == (u)) -#define UART_IN_USE_BY_DBG(u) (!DBG_CONF_USB && DBG_CONF_UART == (u)) -#define UART_IN_USE_BY_UART1(u) (UART1_CONF_UART == (u)) - -#define UART_IN_USE(u) ( \ - UART_CONF_ENABLE && \ - (UART_IN_USE_BY_SERIAL_LINE(u) || \ - UART_IN_USE_BY_SLIP(u) || \ - UART_IN_USE_BY_DBG(u) || \ - UART_IN_USE_BY_UART1(u)) \ -) -/** @} */ -/*---------------------------------------------------------------------------*/ /* board.h assumes that basic configuration is done */ #include "board.h" /*---------------------------------------------------------------------------*/ @@ -319,86 +153,6 @@ #endif /** @} */ /*---------------------------------------------------------------------------*/ -/** - * \name IEEE address configuration - * - * Used to generate our link-layer & IPv6 address - * @{ - */ -/** - * \brief Location of the IEEE address - * 0 => Read from InfoPage, - * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS - */ -#ifndef IEEE_ADDR_CONF_HARDCODED -#define IEEE_ADDR_CONF_HARDCODED 0 -#endif - -/** - * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED - * is defined as 1 - */ -#ifndef IEEE_ADDR_CONF_ADDRESS -#define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF } -#endif - -/** - * \brief Location of the IEEE address in the InfoPage when - * IEEE_ADDR_CONF_HARDCODED is defined as 0 - * 0 => Use the primary address location - * 1 => Use the secondary address location - */ -#ifndef IEEE_ADDR_CONF_USE_SECONDARY_LOCATION -#define IEEE_ADDR_CONF_USE_SECONDARY_LOCATION 0 -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name RF configuration - * - * @{ - */ -/* RF Config */ - -#ifdef RF_CHANNEL -#define CC2538_RF_CONF_CHANNEL RF_CHANNEL -#endif - -#ifndef CC2538_RF_CONF_CHANNEL -#define CC2538_RF_CONF_CHANNEL 26 -#endif /* CC2538_RF_CONF_CHANNEL */ - -#ifndef CC2538_RF_CONF_AUTOACK -#define CC2538_RF_CONF_AUTOACK 1 /**< RF H/W generates ACKs */ -#endif /* CC2538_CONF_AUTOACK */ - -#ifndef CC2538_RF_CONF_TX_USE_DMA -#define CC2538_RF_CONF_TX_USE_DMA 1 /**< RF TX over DMA */ -#endif - -#ifndef CC2538_RF_CONF_RX_USE_DMA -#define CC2538_RF_CONF_RX_USE_DMA 1 /**< RF RX over DMA */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ -/** - * \name Security - * - * @{ - */ -#ifndef CRYPTO_CONF_INIT -#define CRYPTO_CONF_INIT 1 /**< Whether to init cryptoprocessor */ -#endif - -#ifndef AES_128_CONF -#define AES_128_CONF cc2538_aes_128_driver /**< AES-128 driver */ -#endif - -#ifndef CCM_STAR_CONF -#define CCM_STAR_CONF cc2538_ccm_star_driver /**< AES-CCM* driver */ -#endif -/** @} */ -/*---------------------------------------------------------------------------*/ /** * \name RTC * @@ -420,7 +174,9 @@ #endif /** @} */ /*---------------------------------------------------------------------------*/ - +/* Include CPU-related configuration */ +#include "cc2538-conf.h" +/*---------------------------------------------------------------------------*/ #endif /* CONTIKI_CONF_H_ */ - +/*---------------------------------------------------------------------------*/ /** @} */ From 4bdc2f7513444f9d8f3d823c04a791bfca7e8c55 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:22:53 +0000 Subject: [PATCH 18/28] Harmonise platform configuration files (jn516x) --- arch/platform/jn516x/contiki-conf.h | 14 +++++++++----- arch/platform/jn516x/dev/dr1174/README.md | 2 +- arch/platform/jn516x/dev/dr1175/README.md | 2 +- arch/platform/jn516x/dev/dr1199/README.md | 2 +- .../jn516x/{platform-conf.h => jn516x-def.h} | 15 ++++----------- 5 files changed, 16 insertions(+), 19 deletions(-) rename arch/platform/jn516x/{platform-conf.h => jn516x-def.h} (97%) diff --git a/arch/platform/jn516x/contiki-conf.h b/arch/platform/jn516x/contiki-conf.h index 620e55674..f8dbdc3e5 100644 --- a/arch/platform/jn516x/contiki-conf.h +++ b/arch/platform/jn516x/contiki-conf.h @@ -38,11 +38,15 @@ #include PROJECT_CONF_PATH #endif /* PROJECT_CONF_PATH */ -#ifdef PLATFORM_CONF_H -#include PLATFORM_CONF_H -#else -#include "platform-conf.h" -#endif /* PLATFORM_CONF_H */ +#include "jn516x-def.h" + +#ifdef RF_CHANNEL +#define MICROMAC_CONF_CHANNEL RF_CHANNEL +#endif + +#ifndef MICROMAC_CONF_CHANNEL +#define MICROMAC_CONF_CHANNEL 26 +#endif /* Configure radio driver */ #ifndef NETSTACK_CONF_RADIO diff --git a/arch/platform/jn516x/dev/dr1174/README.md b/arch/platform/jn516x/dev/dr1174/README.md index d3a21cbe0..60bffde14 100644 --- a/arch/platform/jn516x/dev/dr1174/README.md +++ b/arch/platform/jn516x/dev/dr1174/README.md @@ -5,4 +5,4 @@ Mapping of LEDs on JN516x DR1174: leds.h: led on DR1174: LEDS_GP0 LED D3 LEDS_GP1 LED D6 -Note: LEDS_GPx definitions included in leds.h via platform-conf.h +Note: LEDS_GPx definitions included in leds.h via jn516x-def.h diff --git a/arch/platform/jn516x/dev/dr1175/README.md b/arch/platform/jn516x/dev/dr1175/README.md index bf57a0a0e..e4fe60adf 100644 --- a/arch/platform/jn516x/dev/dr1175/README.md +++ b/arch/platform/jn516x/dev/dr1175/README.md @@ -14,4 +14,4 @@ DR1174+DR1175: LEDS_WHITE White power led with level control on DR1175 LEDS_GP0 LEDS D3 on DR1174 LEDS_GP1 LEDS D6 on DR1174 -Note: LEDS_GPx and LEDS_WHITE definitions included in leds.h via platform-conf.h +Note: LEDS_GPx and LEDS_WHITE definitions included in leds.h via jn516x-def.h diff --git a/arch/platform/jn516x/dev/dr1199/README.md b/arch/platform/jn516x/dev/dr1199/README.md index 83404a83b..c6e622652 100644 --- a/arch/platform/jn516x/dev/dr1199/README.md +++ b/arch/platform/jn516x/dev/dr1199/README.md @@ -16,4 +16,4 @@ DR1174+DR1199: LEDS_RED LED D3 on DR1199 LEDS_GP0 LED D3 on DR1174 LEDS_GP1 LED D6 on DR1174 -Note: LEDS_GPx definitions included in leds.h via platform-conf.h +Note: LEDS_GPx definitions included in leds.h via jn516x-def.h diff --git a/arch/platform/jn516x/platform-conf.h b/arch/platform/jn516x/jn516x-def.h similarity index 97% rename from arch/platform/jn516x/platform-conf.h rename to arch/platform/jn516x/jn516x-def.h index 990512ac2..357c255c0 100644 --- a/arch/platform/jn516x/platform-conf.h +++ b/arch/platform/jn516x/jn516x-def.h @@ -30,8 +30,8 @@ * */ -#ifndef PLATFORM_CONF_H -#define PLATFORM_CONF_H +#ifndef JN516X_DEF_H_ +#define JN516X_DEF_H_ #include #include @@ -56,14 +56,6 @@ #define MIRCOMAC_CONF_BUF_NUM 2 #endif -#ifdef RF_CHANNEL -#define MICROMAC_CONF_CHANNEL RF_CHANNEL -#endif - -#ifndef MICROMAC_CONF_CHANNEL -#define MICROMAC_CONF_CHANNEL 26 -#endif - /* 32kHz or 16MHz rtimers? */ #ifdef RTIMER_CONF_USE_32KHZ #define RTIMER_USE_32KHZ RTIMER_CONF_USE_32KHZ @@ -314,4 +306,5 @@ DR1174+DR1175: #define LEDS_GP2 64 #define LEDS_GP3 128 #define LEDS_CONF_ALL 255 -#endif /* PLATFORM_CONF_H */ + +#endif /* JN516X_DEF_H_ */ From abe583ed75cd14896983289dcbad19ca091f33e7 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:31:50 +0000 Subject: [PATCH 19/28] Harmonise platform configuration files (nrf52dk) --- arch/cpu/nrf52832/dev/clock.c | 1 - arch/cpu/nrf52832/rtimer-arch.c | 1 - arch/platform/nrf52dk/contiki-conf.h | 2 +- arch/platform/nrf52dk/{platform-conf.h => nrf52dk-def.h} | 6 +++--- 4 files changed, 4 insertions(+), 6 deletions(-) rename arch/platform/nrf52dk/{platform-conf.h => nrf52dk-def.h} (97%) diff --git a/arch/cpu/nrf52832/dev/clock.c b/arch/cpu/nrf52832/dev/clock.c index 4ee09839d..68413c23b 100644 --- a/arch/cpu/nrf52832/dev/clock.c +++ b/arch/cpu/nrf52832/dev/clock.c @@ -53,7 +53,6 @@ #include "nrf_delay.h" #include "app_error.h" #include "contiki.h" -#include "platform-conf.h" /*---------------------------------------------------------------------------*/ const nrf_drv_rtc_t rtc = NRF_DRV_RTC_INSTANCE(PLATFORM_RTC_INSTANCE_ID); /**< RTC instance used for platform clock */ diff --git a/arch/cpu/nrf52832/rtimer-arch.c b/arch/cpu/nrf52832/rtimer-arch.c index 78f4790f2..02611ccbc 100644 --- a/arch/cpu/nrf52832/rtimer-arch.c +++ b/arch/cpu/nrf52832/rtimer-arch.c @@ -44,7 +44,6 @@ #include "nrf_drv_timer.h" #include "app_error.h" #include "contiki.h" -#include "platform-conf.h" static const nrf_drv_timer_t timer = NRF_DRV_TIMER_INSTANCE(PLATFORM_TIMER_INSTANCE_ID); /**< Timer instance used for rtimer */ diff --git a/arch/platform/nrf52dk/contiki-conf.h b/arch/platform/nrf52dk/contiki-conf.h index 6e1529352..f7b8b1fa1 100644 --- a/arch/platform/nrf52dk/contiki-conf.h +++ b/arch/platform/nrf52dk/contiki-conf.h @@ -48,7 +48,7 @@ #endif /* PROJECT_CONF_PATH */ /*---------------------------------------------------------------------------*/ /* Include platform peripherals configuration */ -#include "platform-conf.h" +#include "nrf52dk-def.h" #include "nrf52832-def.h" /*---------------------------------------------------------------------------*/ /** diff --git a/arch/platform/nrf52dk/platform-conf.h b/arch/platform/nrf52dk/nrf52dk-def.h similarity index 97% rename from arch/platform/nrf52dk/platform-conf.h rename to arch/platform/nrf52dk/nrf52dk-def.h index e2fd6cac0..ea4060ca2 100644 --- a/arch/platform/nrf52dk/platform-conf.h +++ b/arch/platform/nrf52dk/nrf52dk-def.h @@ -43,8 +43,8 @@ * Wojciech Bober * */ -#ifndef PLATFORM_CONF_H_ -#define PLATFORM_CONF_H_ +#ifndef NRF52DK_DEF_H_ +#define NRF52DK_DEF_H_ #include "boards.h" @@ -113,4 +113,4 @@ * @} * @} */ -#endif /* PLATFORM_CONF_H_ */ +#endif /* NRF52DK_DEF_H_ */ From 4a129fefc60776fc1ed3957d89ce7afcacbcd084 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:39:40 +0000 Subject: [PATCH 20/28] Remove obsolete macro --- arch/platform/sky/platform-conf.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/platform/sky/platform-conf.h b/arch/platform/sky/platform-conf.h index 73f3e7652..c2267abda 100644 --- a/arch/platform/sky/platform-conf.h +++ b/arch/platform/sky/platform-conf.h @@ -43,9 +43,6 @@ * Definitions below are dictated by the hardware and not really * changeable! */ -/* Platform TMOTE_SKY */ -#define TMOTE_SKY 1 - /* Delay between GO signal and SFD: radio fixed delay + 4Bytes preample + 1B SFD -- 1Byte time is 32us * ~327us + 129preample = 456 us */ #define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(456)) From 49cb138020c26c1e9a1dd7a321aa52b5c5224961 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:40:15 +0000 Subject: [PATCH 21/28] Provide header file with configuration for the msp430 --- arch/cpu/msp430/msp430-conf.h | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 arch/cpu/msp430/msp430-conf.h diff --git a/arch/cpu/msp430/msp430-conf.h b/arch/cpu/msp430/msp430-conf.h new file mode 100644 index 000000000..ec4f49a55 --- /dev/null +++ b/arch/cpu/msp430/msp430-conf.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, Swedish Institute of Computer Science + * 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 Institute 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 INSTITUTE 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 INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/*---------------------------------------------------------------------------*/ +#ifndef MSP430_CONF_H_ +#define MSP430_CONF_H_ +/*---------------------------------------------------------------------------*/ +/* default DCOSYNCH Period is 30 seconds */ +#ifdef DCOSYNCH_CONF_PERIOD +#define DCOSYNCH_PERIOD DCOSYNCH_CONF_PERIOD +#else +#define DCOSYNCH_PERIOD 30 +#endif + +#ifdef F_CPU +#define MSP430_CPU_SPEED F_CPU +#else +#define MSP430_CPU_SPEED 2457600UL +#endif +/*---------------------------------------------------------------------------*/ +#endif /* MSP430_CONF_H_ */ +/*---------------------------------------------------------------------------*/ From fdb60ab22f75aaac7a4fa683dcafa022d70ba4c6 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:43:35 +0000 Subject: [PATCH 22/28] Move non-configuration macros to msp430def.h --- arch/cpu/msp430/msp430def.h | 13 +++++++++++++ arch/platform/sky/contiki-conf.h | 3 --- arch/platform/sky/platform-conf.h | 17 ----------------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/arch/cpu/msp430/msp430def.h b/arch/cpu/msp430/msp430def.h index 05e9b0bbc..d574697a9 100644 --- a/arch/cpu/msp430/msp430def.h +++ b/arch/cpu/msp430/msp430def.h @@ -85,14 +85,22 @@ typedef int32_t s32_t; #else #define DCOSYNCH_PERIOD 30 #endif +/* Types for clocks and uip_stats */ +typedef unsigned short uip_stats_t; +typedef unsigned long clock_time_t; +typedef long off_t; void msp430_cpu_init(void); /* Rename to cpu_init() later! */ void msp430_sync_dco(void); +/* Our clock resolution, this is the same as Unix HZ. */ +#define CLOCK_CONF_SECOND 128UL #define cpu_init() msp430_cpu_init() void *sbrk(int); +#define CCIF +#define CLIF typedef int spl_t; /* void splx_(spl_t); */ @@ -133,6 +141,11 @@ void *w_memset(void *out, int value, size_t n); #define MSP430_REQUIRE_LPM2 2 #define MSP430_REQUIRE_LPM3 3 +/* Platform-specific checksum implementation */ +#define UIP_ARCH_IPCHKSUM 1 + +#define BAUD2UBR(baud) ((F_CPU/baud)) + void msp430_add_lpm_req(int req); void msp430_remove_lpm_req(int req); diff --git a/arch/platform/sky/contiki-conf.h b/arch/platform/sky/contiki-conf.h index 52fc596a8..4b647e8b0 100644 --- a/arch/platform/sky/contiki-conf.h +++ b/arch/platform/sky/contiki-conf.h @@ -30,9 +30,6 @@ #define UIP_CONF_BUFFER_SIZE 240 #endif -/* Platform-specific checksum implementation */ -#define UIP_ARCH_IPCHKSUM 1 - /* Platform-specific (H/W) AES implementation */ #ifndef AES_128_CONF #define AES_128_CONF cc2420_aes_128_driver diff --git a/arch/platform/sky/platform-conf.h b/arch/platform/sky/platform-conf.h index c2267abda..93edd1d67 100644 --- a/arch/platform/sky/platform-conf.h +++ b/arch/platform/sky/platform-conf.h @@ -67,23 +67,6 @@ /* CPU target speed in Hz */ #define F_CPU 3900000uL /*2457600uL*/ -/* Our clock resolution, this is the same as Unix HZ. */ -#define CLOCK_CONF_SECOND 128UL - -#define BAUD2UBR(baud) ((F_CPU/baud)) - -#define CCIF -#define CLIF - -#define HAVE_STDINT_H -#include "msp430def.h" - - -/* Types for clocks and uip_stats */ -typedef unsigned short uip_stats_t; -typedef unsigned long clock_time_t; -typedef long off_t; - /* the low-level radio driver */ #define NETSTACK_CONF_RADIO cc2420_driver From ddd15692e1db769c1379643d9e69c8ac22a589af Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:44:49 +0000 Subject: [PATCH 23/28] Rename and restructure the msp430 constants header --- arch/cpu/msp430/{msp430def.h => msp430-def.h} | 43 +++---------------- 1 file changed, 7 insertions(+), 36 deletions(-) rename arch/cpu/msp430/{msp430def.h => msp430-def.h} (83%) diff --git a/arch/cpu/msp430/msp430def.h b/arch/cpu/msp430/msp430-def.h similarity index 83% rename from arch/cpu/msp430/msp430def.h rename to arch/cpu/msp430/msp430-def.h index d574697a9..1d11b07c1 100644 --- a/arch/cpu/msp430/msp430def.h +++ b/arch/cpu/msp430/msp430-def.h @@ -27,8 +27,8 @@ * SUCH DAMAGE. */ -#ifndef MSP430DEF_H -#define MSP430DEF_H +#ifndef MSP430_DEF_H_ +#define MSP430_DEF_H_ #ifdef __IAR_SYSTEMS_ICC__ #include @@ -60,18 +60,7 @@ #define BV(x) (1 << x) #endif -#ifdef HAVE_STDINT_H #include -#else -#ifndef uint8_t -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned long uint32_t; -typedef signed char int8_t; -typedef short int16_t; -typedef long int32_t; -#endif -#endif /* !HAVE_STDINT_H */ /* These names are deprecated, use C99 names. */ typedef uint8_t u8_t; @@ -79,31 +68,18 @@ typedef uint16_t u16_t; typedef uint32_t u32_t; typedef int32_t s32_t; -/* default DCOSYNCH Period is 30 seconds */ -#ifdef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_PERIOD DCOSYNCH_CONF_PERIOD -#else -#define DCOSYNCH_PERIOD 30 -#endif /* Types for clocks and uip_stats */ typedef unsigned short uip_stats_t; typedef unsigned long clock_time_t; typedef long off_t; -void msp430_cpu_init(void); /* Rename to cpu_init() later! */ -void msp430_sync_dco(void); /* Our clock resolution, this is the same as Unix HZ. */ #define CLOCK_CONF_SECOND 128UL - -#define cpu_init() msp430_cpu_init() - -void *sbrk(int); #define CCIF #define CLIF typedef int spl_t; -/* void splx_(spl_t); */ spl_t splhigh_(void); #define splhigh() splhigh_() @@ -127,15 +103,6 @@ void *w_memset(void *out, int value, size_t n); #endif /* memcpy */ #endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */ - -/* Moved from the msp430.h file with other msp430 related defines */ - -#ifdef F_CPU -#define MSP430_CPU_SPEED F_CPU -#else -#define MSP430_CPU_SPEED 2457600UL -#endif - #define MSP430_REQUIRE_CPUON 0 #define MSP430_REQUIRE_LPM1 1 #define MSP430_REQUIRE_LPM2 2 @@ -148,5 +115,9 @@ void *w_memset(void *out, int value, size_t n); void msp430_add_lpm_req(int req); void msp430_remove_lpm_req(int req); +void msp430_cpu_init(void); /* Rename to cpu_init() later! */ +void msp430_sync_dco(void); +#define cpu_init() msp430_cpu_init() +void *sbrk(int); -#endif /* MSP430DEF_H */ +#endif /* MSP430_DEF_H_ */ From d7b426c10522e08637c83b1203ee3c543044986a Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:45:46 +0000 Subject: [PATCH 24/28] Move user configuration to contiki-conf.h --- arch/platform/sky/contiki-conf.h | 8 ++++++++ arch/platform/sky/platform-conf.h | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/arch/platform/sky/contiki-conf.h b/arch/platform/sky/contiki-conf.h index 4b647e8b0..fb1192065 100644 --- a/arch/platform/sky/contiki-conf.h +++ b/arch/platform/sky/contiki-conf.h @@ -13,6 +13,10 @@ #else #include "platform-conf.h" #endif /* PLATFORM_CONF_H */ +/* Map RF_CHANNEL to cc2420 default channel */ +#ifdef RF_CHANNEL +#define CC2420_CONF_CHANNEL RF_CHANNEL +#endif /* RF_CHANNEL */ /* Configure radio driver */ #ifndef NETSTACK_CONF_RADIO @@ -35,4 +39,8 @@ #define AES_128_CONF cc2420_aes_128_driver #endif /* AES_128_CONF */ +/* Disable the stack check library by default: .rom overflow otherwise */ +#ifndef STACK_CHECK_CONF_ENABLED +#define STACK_CHECK_CONF_ENABLED 0 +#endif #endif /* CONTIKI_CONF_H */ diff --git a/arch/platform/sky/platform-conf.h b/arch/platform/sky/platform-conf.h index 93edd1d67..8e7b5c069 100644 --- a/arch/platform/sky/platform-conf.h +++ b/arch/platform/sky/platform-conf.h @@ -59,11 +59,6 @@ #define PLATFORM_HAS_SHT11 1 #define PLATFORM_HAS_RADIO 1 -/* Map RF_CHANNEL to cc2420 default channel */ -#ifdef RF_CHANNEL -#define CC2420_CONF_CHANNEL RF_CHANNEL -#endif /* RF_CHANNEL */ - /* CPU target speed in Hz */ #define F_CPU 3900000uL /*2457600uL*/ @@ -213,9 +208,4 @@ for SFD timestamping */ /* Platform-specific define for the end of the stack region */ #define STACK_CONF_ORIGIN ((void *)0x3900) -/* Disable the stack check library by default: .rom overflow otherwise */ -#ifndef STACK_CHECK_CONF_ENABLED -#define STACK_CHECK_CONF_ENABLED 0 -#endif - #endif /* PLATFORM_CONF_H_ */ From aa016c3c298fdd024cc416ddbfee66d7042370da Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:46:56 +0000 Subject: [PATCH 25/28] Pull CPU-related configuration from the CPU header (Sky) --- arch/platform/sky/contiki-conf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/platform/sky/contiki-conf.h b/arch/platform/sky/contiki-conf.h index fb1192065..db749db43 100644 --- a/arch/platform/sky/contiki-conf.h +++ b/arch/platform/sky/contiki-conf.h @@ -43,4 +43,7 @@ #ifndef STACK_CHECK_CONF_ENABLED #define STACK_CHECK_CONF_ENABLED 0 #endif +/*---------------------------------------------------------------------------*/ +#include "msp430-conf.h" +/*---------------------------------------------------------------------------*/ #endif /* CONTIKI_CONF_H */ From df54d30a2a4a2939fb2663c2b1a78a446b1a11f1 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:48:21 +0000 Subject: [PATCH 26/28] Pull CPU-related constants from the CPU header (Sky) --- arch/platform/sky/contiki-conf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/platform/sky/contiki-conf.h b/arch/platform/sky/contiki-conf.h index db749db43..18b687500 100644 --- a/arch/platform/sky/contiki-conf.h +++ b/arch/platform/sky/contiki-conf.h @@ -13,6 +13,8 @@ #else #include "platform-conf.h" #endif /* PLATFORM_CONF_H */ +#include "msp430-def.h" +/*---------------------------------------------------------------------------*/ /* Map RF_CHANNEL to cc2420 default channel */ #ifdef RF_CHANNEL #define CC2420_CONF_CHANNEL RF_CHANNEL From 0a76ff8ee78c7ec06887fba9ac7c846491c15109 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:49:33 +0000 Subject: [PATCH 27/28] Harmonise platform configuration files (Sky) --- arch/platform/sky/contiki-conf.h | 8 ++------ arch/platform/sky/{platform-conf.h => sky-def.h} | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) rename arch/platform/sky/{platform-conf.h => sky-def.h} (98%) diff --git a/arch/platform/sky/contiki-conf.h b/arch/platform/sky/contiki-conf.h index 18b687500..500e00e08 100644 --- a/arch/platform/sky/contiki-conf.h +++ b/arch/platform/sky/contiki-conf.h @@ -7,12 +7,8 @@ #ifdef PROJECT_CONF_PATH #include PROJECT_CONF_PATH #endif /* PROJECT_CONF_PATH */ - -#ifdef PLATFORM_CONF_H -#include PLATFORM_CONF_H -#else -#include "platform-conf.h" -#endif /* PLATFORM_CONF_H */ +/*---------------------------------------------------------------------------*/ +#include "sky-def.h" #include "msp430-def.h" /*---------------------------------------------------------------------------*/ /* Map RF_CHANNEL to cc2420 default channel */ diff --git a/arch/platform/sky/platform-conf.h b/arch/platform/sky/sky-def.h similarity index 98% rename from arch/platform/sky/platform-conf.h rename to arch/platform/sky/sky-def.h index 8e7b5c069..8640892af 100644 --- a/arch/platform/sky/platform-conf.h +++ b/arch/platform/sky/sky-def.h @@ -36,8 +36,8 @@ * Joakim Eriksson */ -#ifndef PLATFORM_CONF_H_ -#define PLATFORM_CONF_H_ +#ifndef SKY_DEF_H_ +#define SKY_DEF_H_ /* * Definitions below are dictated by the hardware and not really @@ -208,4 +208,4 @@ for SFD timestamping */ /* Platform-specific define for the end of the stack region */ #define STACK_CONF_ORIGIN ((void *)0x3900) -#endif /* PLATFORM_CONF_H_ */ +#endif /* SKY_DEF_H_ */ From 05c65f3c4a2a56c119182e31fcdea6469b63b9c5 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 Dec 2017 16:58:35 +0000 Subject: [PATCH 28/28] Update documentation --- os/services/ip64/ip64-dhcpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/services/ip64/ip64-dhcpc.c b/os/services/ip64/ip64-dhcpc.c index 3e99cd512..81d97490d 100644 --- a/os/services/ip64/ip64-dhcpc.c +++ b/os/services/ip64/ip64-dhcpc.c @@ -63,7 +63,7 @@ struct dhcp_msg { #if (UIP_BUFSIZE - UIP_UDPIP_HLEN) < 548 #error UIP_CONF_BUFFER_SIZE may be too small to accomodate DHCPv4 packets -#error Increase UIP_CONF_BUFFER_SIZE in your project-conf.h, platform-conf.h, or contiki-conf.h +#error Increase UIP_CONF_BUFFER_SIZE in your project-conf.h, or contiki-conf.h #error A good size is 600 bytes #endif