Sensinode/cc2430 stack depth optimisation
This replicates the method used by the cc2530 port
This commit is contained in:
parent
067fabe0f9
commit
95b9d4ee29
11 changed files with 72 additions and 6 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -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
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -32,6 +32,10 @@ extern void spi_rx_dma_callback(void);
|
|||
*
|
||||
* if callback defined a poll is made to that process
|
||||
*/
|
||||
#pragma save
|
||||
#if CC_CONF_OPTIMIZE_STACK_SIZE
|
||||
#pragma exclude bits
|
||||
#endif
|
||||
void
|
||||
dma_ISR(void) __interrupt (DMA_VECTOR)
|
||||
{
|
||||
|
@ -65,4 +69,5 @@ dma_ISR(void) __interrupt (DMA_VECTOR)
|
|||
#endif
|
||||
EA = 1;
|
||||
}
|
||||
#pragma restore
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -36,6 +36,10 @@ uart0_set_input(int (*input)(unsigned char c))
|
|||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#pragma save
|
||||
#if CC_CONF_OPTIMIZE_STACK_SIZE
|
||||
#pragma exclude bits
|
||||
#endif
|
||||
void
|
||||
uart0_rx_ISR(void) __interrupt (URX0_VECTOR)
|
||||
{
|
||||
|
@ -51,6 +55,7 @@ void
|
|||
uart0_tx_ISR( void ) __interrupt (UTX0_VECTOR)
|
||||
{
|
||||
}
|
||||
#pragma restore
|
||||
#endif /* UART_ZERO_ENABLE */
|
||||
#if UART_ONE_ENABLE
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -61,6 +66,10 @@ uart1_set_input(int (*input)(unsigned char c))
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if UART_ONE_CONF_WITH_INPUT
|
||||
#pragma save
|
||||
#if CC_CONF_OPTIMIZE_STACK_SIZE
|
||||
#pragma exclude bits
|
||||
#endif
|
||||
void
|
||||
uart1_rx_ISR(void) __interrupt (URX1_VECTOR)
|
||||
{
|
||||
|
@ -76,6 +85,7 @@ void
|
|||
uart1_tx_ISR( void ) __interrupt (UTX1_VECTOR)
|
||||
{
|
||||
}
|
||||
#pragma restore
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* UART_ONE_CONF_WITH_INPUT */
|
||||
#endif /* UART_ONE_ENABLE */
|
||||
|
|
|
@ -47,6 +47,10 @@
|
|||
/*---------------------------------------------------------------------------*/
|
||||
/* The watchdog only throws interrupts in timer mode */
|
||||
#if WDT_TIMER_MODE
|
||||
#pragma save
|
||||
#if CC_CONF_OPTIMIZE_STACK_SIZE
|
||||
#pragma exclude bits
|
||||
#endif
|
||||
void
|
||||
cc4230_watchdog_ISR(void) __interrupt (WDT_VECTOR)
|
||||
{
|
||||
|
@ -57,6 +61,7 @@ cc4230_watchdog_ISR(void) __interrupt (WDT_VECTOR)
|
|||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
EA = 1;
|
||||
}
|
||||
#pragma restore
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
|
|
@ -104,6 +104,10 @@ rtimer_arch_schedule(rtimer_clock_t t)
|
|||
T1CCTL1 |= T1IM;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#pragma save
|
||||
#if CC_CONF_OPTIMIZE_STACK_SIZE
|
||||
#pragma exclude bits
|
||||
#endif
|
||||
void
|
||||
cc2430_timer_1_ISR(void) __interrupt (T1_VECTOR)
|
||||
{
|
||||
|
@ -120,3 +124,4 @@ cc2430_timer_1_ISR(void) __interrupt (T1_VECTOR)
|
|||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
IEN1_T1IE = 1; /* Acknowledge Timer 1 Interrupts */
|
||||
}
|
||||
#pragma restore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue