From: George O. <oik...@us...> - 2012-09-20 14:47:36
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "contiki". The branch, master has been updated via d84a97103fb2d2cad28402db31242d1dae3c7e67 (commit) via fde15106533bf0ca29d9af62bb37a9d8ac74a1ab (commit) via 3b0e92168b1674915e4b4d3f885a2c2a9f56ddbd (commit) via b292e0201280efa1c3b8ec67c23a7a64d2f3595c (commit) via 95b9d4ee29829bb176271146ea5d6cd9429bc67c (commit) via 067fabe0f9c85fa97e79a476e2f856169b4996c4 (commit) via cb168da7298365d0e8c9978767596567797a1592 (commit) via fa5a38666b68dcbca910498e24f3b80497d4e0f8 (commit) via 88c6689e38df71f4ec3e6d826340f5ba9f11a0b7 (commit) from 767e8bb551084f762f9a5f8098022e2a52fdc130 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d84a97103fb2d2cad28402db31242d1dae3c7e67 Author: George Oikonomou <g.o...@br...> Date: Thu Sep 20 15:12:02 2012 +0100 cc2x3x stack debugging macro fix diff --git a/cpu/cc2430/stack.h b/cpu/cc2430/stack.h index 18caccd..6ee7442 100644 --- a/cpu/cc2430/stack.h +++ b/cpu/cc2430/stack.h @@ -52,7 +52,6 @@ extern CC_AT_DATA uint8_t sp; #define stack_max_sp_print(f) do { \ putstring(f); \ - sp = SP; \ puthex(stack_get_max()); \ putchar('\n'); \ } while(0) diff --git a/cpu/cc253x/stack.h b/cpu/cc253x/stack.h index 989875d..16ceb92 100644 --- a/cpu/cc253x/stack.h +++ b/cpu/cc253x/stack.h @@ -52,7 +52,6 @@ extern CC_AT_DATA uint8_t sp; #define stack_max_sp_print(f) do { \ putstring(f); \ - sp = SP; \ puthex(stack_get_max()); \ putchar('\n'); \ } while(0) commit fde15106533bf0ca29d9af62bb37a9d8ac74a1ab Author: George Oikonomou <g.o...@br...> Date: Fri Sep 7 11:27:03 2012 +0100 Added definitions for cc2530 DMA-related SFR bits diff --git a/cpu/cc253x/sfr-bits.h b/cpu/cc253x/sfr-bits.h index efec539..7a4d72c 100644 --- a/cpu/cc253x/sfr-bits.h +++ b/cpu/cc253x/sfr-bits.h @@ -148,6 +148,28 @@ #define PICTL_P1ICONH 0x04 #define PICTL_P1ICONL 0x02 #define PICTL_P0ICON 0x01 + +/* DMAARM */ +#define DMAARM_ABORT 0x80 +#define DMAARM_DMAARM4 0x10 +#define DMAARM_DMAARM3 0x08 +#define DMAARM_DMAARM2 0x04 +#define DMAARM_DMAARM1 0x02 +#define DMAARM_DMAARM0 0x01 + +/* DMAREQ */ +#define DMAREQ_DMAREQ4 0x10 +#define DMAREQ_DMAREQ3 0x08 +#define DMAREQ_DMAREQ2 0x04 +#define DMAREQ_DMAREQ1 0x02 +#define DMAREQ_DMAREQ0 0x01 + +/* DMAIRQ */ +#define DMAIRQ_DMAIF4 0x10 +#define DMAIRQ_DMAIF3 0x08 +#define DMAIRQ_DMAIF2 0x04 +#define DMAIRQ_DMAIF1 0x02 +#define DMAIRQ_DMAIF0 0x01 /*--------------------------------------------------------------------------- * XREG bits, excluding RF and USB *---------------------------------------------------------------------------*/ commit 3b0e92168b1674915e4b4d3f885a2c2a9f56ddbd Author: George Oikonomou <g.o...@br...> Date: Fri Sep 7 15:23:08 2012 +0100 Copied cc2530 stack functions to the cc2430 port diff --git a/cpu/cc2430/Makefile.cc2430 b/cpu/cc2430/Makefile.cc2430 index fab1fbf..0f67e88 100644 --- a/cpu/cc2430/Makefile.cc2430 +++ b/cpu/cc2430/Makefile.cc2430 @@ -89,7 +89,7 @@ CONTIKI_CPU_DIRS = . dev ### CPU-dependent source files CONTIKI_SOURCEFILES += bus.c clock.c uart0.c uart1.c cc2430_rf.c dma.c CONTIKI_SOURCEFILES += uart_intr.c cc2430_rf_intr.c dma_intr.c -CONTIKI_SOURCEFILES += watchdog-cc2430.c rtimer-arch.c +CONTIKI_SOURCEFILES += watchdog-cc2430.c rtimer-arch.c stack.c CONTIKI_ASMFILES += CONTIKI_ASMOBJECTFILES = $(addprefix $(OBJECTDIR)/,$(CONTIKI_ASMFILES:.S=.rel)) diff --git a/cpu/cc2430/stack.c b/cpu/cc2430/stack.c new file mode 100644 index 0000000..0a26330 --- /dev/null +++ b/cpu/cc2430/stack.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2011, George Oikonomou - <oik...@us...> + * 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 AUTHOR 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. + * + * This file is part of the Contiki operating system. + */ + +/** + * \file + * 8051 stack debugging facilities + * + * \author + * George Oikonomou - <oik...@us...> + * Philippe Retornaz (EPFL) + */ +#include "contiki.h" + +#ifndef STACK_POISON +#define STACK_POISON 0xAA +#endif + +CC_AT_DATA uint8_t sp; + +void +stack_poison(void) +{ + __asm + mov r1, _SP +poison_loop: + inc r1 + mov @r1, #STACK_POISON + cjne r1, #0xFF, poison_loop + __endasm; +} + +uint8_t +stack_get_max(void) +{ + __data uint8_t * sp = (__data uint8_t *) 0xff; + uint8_t free = 0; + + while(*sp-- == STACK_POISON) { + free++; + } + + return 0xff - free; +} diff --git a/cpu/cc2430/stack.h b/cpu/cc2430/stack.h new file mode 100644 index 0000000..18caccd --- /dev/null +++ b/cpu/cc2430/stack.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2011, George Oikonomou - <oik...@us...> + * 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 AUTHOR 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. + * + * This file is part of the Contiki operating system. + */ + +/** + * \file + * Header file for 8051 stack debugging facilities + * + * \author + * George Oikonomou - <oik...@us...> + * Philippe Retornaz (EPFL) + */ +#ifndef STACK_H_ +#define STACK_H_ + +#if STACK_CONF_DEBUGGING +extern CC_AT_DATA uint8_t sp; + +#define stack_dump(f) do { \ + putstring(f); \ + sp = SP; \ + puthex(sp); \ + putchar('\n'); \ +} while(0) + +#define stack_max_sp_print(f) do { \ + putstring(f); \ + sp = SP; \ + puthex(stack_get_max()); \ + putchar('\n'); \ +} while(0) + +void stack_poison(void); +uint8_t stack_get_max(void); +#else +#define stack_dump(...) +#define stack_max_sp_print(...) +#define stack_poison() +#define stack_get_max() +#endif + +#endif /* STACK_H_ */ diff --git a/platform/sensinode/contiki-conf.h b/platform/sensinode/contiki-conf.h index ea11008..610c3cf 100644 --- a/platform/sensinode/contiki-conf.h +++ b/platform/sensinode/contiki-conf.h @@ -24,6 +24,10 @@ /* Logging.. */ #define LOG_CONF_ENABLED 0 +#ifndef STACK_CONF_DEBUGGING +#define STACK_CONF_DEBUGGING 0 +#endif + /* Energest Module */ #ifndef ENERGEST_CONF_ON #define ENERGEST_CONF_ON 0 diff --git a/platform/sensinode/contiki-sensinode-main.c b/platform/sensinode/contiki-sensinode-main.c index 6899de9..27cc1a1 100644 --- a/platform/sensinode/contiki-sensinode-main.c +++ b/platform/sensinode/contiki-sensinode-main.c @@ -16,6 +16,7 @@ #include "net/netstack.h" #include "net/mac/frame802154.h" #include "debug.h" +#include "stack.h" #include "dev/watchdog-cc2430.h" #include "dev/sensinode-sensors.h" #include "disco.h" @@ -164,6 +165,8 @@ main(void) bus_init(); rtimer_init(); + stack_poison(); + /* model-specific h/w init. */ model_init(); commit b292e0201280efa1c3b8ec67c23a7a64d2f3595c Author: George Oikonomou <g.o...@br...> Date: Fri Sep 7 14:59:34 2012 +0100 Sensinode putdec() debugging diff --git a/platform/sensinode/debug.c b/platform/sensinode/debug.c index b1e3a27..390c2ff 100644 --- a/platform/sensinode/debug.c +++ b/platform/sensinode/debug.c @@ -44,3 +44,18 @@ putbin(uint8_t c) } } /*---------------------------------------------------------------------------*/ +void +putdec(uint8_t c) +{ + uint8_t div; + uint8_t hassent = 0; + for(div = 100; div > 0; div /= 10) { + uint8_t disp = c / div; + c %= div; + if((disp != 0) || (hassent) || (div == 1)) { + hassent = 1; + putchar('0'+disp); + } + } +} +/*---------------------------------------------------------------------------*/ diff --git a/platform/sensinode/debug.h b/platform/sensinode/debug.h index 4c5dc13..94eaa4f 100644 --- a/platform/sensinode/debug.h +++ b/platform/sensinode/debug.h @@ -50,5 +50,6 @@ void putchar(char c); void putstring(char *s); void puthex(uint8_t c); void putbin(uint8_t c); +void putdec(uint8_t c); #endif /* DEBUG_H_ */ commit 95b9d4ee29829bb176271146ea5d6cd9429bc67c Author: George Oikonomou <g.o...@br...> Date: Fri Sep 7 14:48:15 2012 +0100 Sensinode/cc2430 stack depth optimisation This replicates the method used by the cc2530 port diff --git a/cpu/cc2430/8051def.h b/cpu/cc2430/8051def.h index ce6bc33..fe82ce9 100644 --- a/cpu/cc2430/8051def.h +++ b/cpu/cc2430/8051def.h @@ -51,6 +51,26 @@ #define CC_NON_BANKED #endif +/* + * Max Stack Depth manipulation. It is possible to get up to 247 bytes + * allocated for the stack if: + * - You set this to 1 and + * - You have a patched toolchain and + * - You don't use __bit variables + * - You do not link libraries using BIT registers (e.g. printf_large) + * Enabling this will mean ISRs will NOT push bits (#pragma exclude bits) so + * make sure you know what you're doing + * + * More information on the wiki + */ +#define CC_CONF_OPTIMIZE_STACK_SIZE 0 + +#if CC_CONF_OPTIMIZE_STACK_SIZE +#define CC_AT_DATA +#else +#define CC_AT_DATA __data +#endif + /* Generic types. */ typedef unsigned short uip_stats_t; diff --git a/cpu/cc2430/dev/cc2430_rf.c b/cpu/cc2430/dev/cc2430_rf.c index 5339c84..7d6d5ec 100644 --- a/cpu/cc2430/dev/cc2430_rf.c +++ b/cpu/cc2430/dev/cc2430_rf.c @@ -105,7 +105,7 @@ uint8_t rf_error = 0; PROCESS(cc2430_rf_process, "CC2430 RF driver"); #endif /*---------------------------------------------------------------------------*/ -static uint8_t __data rf_flags; +static uint8_t CC_AT_DATA rf_flags; static uint8_t rf_channel; static int on(void); /* prepare() needs our prototype */ diff --git a/cpu/cc2430/dev/cc2430_rf_intr.c b/cpu/cc2430/dev/cc2430_rf_intr.c index 510c93f..b19a115 100644 --- a/cpu/cc2430/dev/cc2430_rf_intr.c +++ b/cpu/cc2430/dev/cc2430_rf_intr.c @@ -56,6 +56,10 @@ PROCESS_NAME(cc2430_rf_process); * RF interrupt service routine. * */ +#pragma save +#if CC_CONF_OPTIMIZE_STACK_SIZE +#pragma exclude bits +#endif void cc2430_rf_ISR( void ) __interrupt (RF_VECTOR) { @@ -75,6 +79,7 @@ cc2430_rf_ISR( void ) __interrupt (RF_VECTOR) ENERGEST_OFF(ENERGEST_TYPE_IRQ); EA = 1; } +#pragma restore #endif /*---------------------------------------------------------------------------*/ #if CC2430_RFERR_INTERRUPT @@ -82,6 +87,10 @@ cc2430_rf_ISR( void ) __interrupt (RF_VECTOR) * RF error interrupt service routine. * Turned off by default, can be turned on in contiki-conf.h */ +#pragma save +#if CC_CONF_OPTIMIZE_STACK_SIZE +#pragma exclude bits +#endif void cc2430_rf_error_ISR( void ) __interrupt (RFERR_VECTOR) { @@ -98,5 +107,6 @@ cc2430_rf_error_ISR( void ) __interrupt (RFERR_VECTOR) RF_TX_LED_OFF(); EA = 1; } +#pragma restore #endif /*---------------------------------------------------------------------------*/ diff --git a/cpu/cc2430/dev/clock.c b/cpu/cc2430/dev/clock.c index 8ca9690..e36a112 100644 --- a/cpu/cc2430/dev/clock.c +++ b/cpu/cc2430/dev/clock.c @@ -51,8 +51,8 @@ volatile uint8_t sleep_flag; /*---------------------------------------------------------------------------*/ /* Used in sleep timer interrupt for calculating the next interrupt time */ static unsigned long timer_value; -static volatile __data clock_time_t count = 0; /* Uptime in ticks */ -static volatile __data clock_time_t seconds = 0; /* Uptime in secs */ +static volatile CC_AT_DATA clock_time_t count = 0; /* Uptime in ticks */ +static volatile CC_AT_DATA clock_time_t seconds = 0; /* Uptime in secs */ /*---------------------------------------------------------------------------*/ /** * Each iteration is ~1.0xy usec, so this function delays for roughly len usec @@ -109,6 +109,10 @@ clock_init(void) IEN0_STIE = 1; /* IEN0.STIE acknowledge Sleep Timer Interrupt */ } /*---------------------------------------------------------------------------*/ +#pragma save +#if CC_CONF_OPTIMIZE_STACK_SIZE +#pragma exclude bits +#endif void clock_ISR(void) __interrupt(ST_VECTOR) { @@ -161,4 +165,5 @@ clock_ISR(void) __interrupt(ST_VECTOR) ENERGEST_OFF(ENERGEST_TYPE_IRQ); ENABLE_INTERRUPTS(); } +#pragma restore /*------------------ |