Improved support for the IAR compiler.

io and signal have been moved into contiki include file.
This commit is contained in:
Niclas Finne 2012-03-08 22:39:53 +01:00
parent f67fb672eb
commit c2e07c9798
13 changed files with 17 additions and 144 deletions

View file

@ -1,19 +1,8 @@
# $Id: Makefile.z1,v 1.4 2010/11/07 08:40:24 enricmcalvo Exp $ # $Id: Makefile.z1,v 1.4 2010/11/07 08:40:24 enricmcalvo Exp $
# msp430flasher -n msp430x5437 -w "Firmware.txt" -v -z [VCC] # msp430flasher -n msp430x5437 -w "Firmware.txt" -v -z [VCC]
ifndef IAR
GCC=1
endif
ifdef GCC
CFLAGS+=-Os -g
else
IAR=1
endif
ifdef IAR ifdef IAR
CFLAGS+=-e --vla -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X --data_model small --double=32 -D__MSP430F5438A__ CFLAGS+=-e --vla -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X --data_model small --double=32 -D__MSP430F5438A__=1
CFLAGS += --diag_suppress=Pa050
#CFLAGS+=--no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --debug -D__MSP430F5438A__ -e --double=32 --dlib_config 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.0 Evaluation\430\LIB\DLIB\dl430xsfn.h' --core=430X --data_model=small -Ol --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 #CFLAGS+=--no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --debug -D__MSP430F5438A__ -e --double=32 --dlib_config 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.0 Evaluation\430\LIB\DLIB\dl430xsfn.h' --core=430X --data_model=small -Ol --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40
endif endif
@ -43,7 +32,7 @@ help:
@echo make help - shows this help @echo make help - shows this help
@echo make TARGET=exp5438 savetarget - stores selection of target to avoid using TARGET= on every make invokation @echo make TARGET=exp5438 savetarget - stores selection of target to avoid using TARGET= on every make invokation
@echo make program.upload - compiles and uploads program to connected board @echo make program.upload - compiles and uploads program to connected board
@echo make program.upload GCC=1 - uses the mspgcc compiler instead of IAR @echo make program.upload IAR=1 - uses the IAR compiler instead of mspgcc
@echo make program.upload NODEID=x - uploads with node_id set to x @echo make program.upload NODEID=x - uploads with node_id set to x
CONTIKI_TARGET_DIRS = . dev apps net CONTIKI_TARGET_DIRS = . dev apps net
@ -70,19 +59,12 @@ contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
ifdef IAR ifdef IAR
STACKSIZE=300 STACKSIZE=300
LDFLAGS_ELF=-B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -Felf -yn -s __program_start -D_STACK_SIZE=$(STACKSIZE) -D_DATA16_HEAP_SIZE=$(STACKSIZE) -D_DATA20_HEAP_SIZE=$(STACKSIZE) LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=$(STACKSIZE) -D_DATA16_HEAP_SIZE=$(STACKSIZE) -D_DATA20_HEAP_SIZE=$(STACKSIZE)
LDFLAGS += $(LDFLAGSNO) -Felf -yn
endif
LDFLAGS_HEX=-B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=$(STACKSIZE) -D_DATA16_HEAP_SIZE=$(STACKSIZE) -D_DATA20_HEAP_SIZE=$(STACKSIZE)
LDFLAGS+=$(LDFLAGS_ELF)
%.hex: %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
$(LD) $(LDFLAGS_HEX) $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@
else
%.hex: %.ihex %.hex: %.ihex
mv $< $@ mv $< $@
endif
%.upload: %.hex %.upload: %.hex
msp430flasher -n msp430x5438a -e ERASE_MAIN -w $< -v -z [VCC] msp430flasher -n msp430x5438a -e ERASE_MAIN -w $< -v -z [VCC]

View file

@ -31,19 +31,12 @@
#include "contiki.h" #include "contiki.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#include <signal.h>
#endif
#include "contiki-net.h" #include "contiki-net.h"
#include "dev/spi.h" #include "dev/spi.h"
#include "dev/cc2420.h" #include "dev/cc2420.h"
#include "dev/leds.h" #include "dev/leds.h"
#include "isr_compat.h"
#ifndef CONF_SFD_TIMESTAMPS #ifndef CONF_SFD_TIMESTAMPS
#define CONF_SFD_TIMESTAMPS 0 #define CONF_SFD_TIMESTAMPS 0
@ -54,13 +47,7 @@
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifdef __IAR_SYSTEMS_ICC__ ISR(CC2420_IRQ, cc24240_fifop_interrupt)
#pragma vector=CC2420_IRQ_VECTOR
__interrupt void
#else
interrupt(CC2420_IRQ_VECTOR)
#endif
cc24240_fifop_interrupt(void)
{ {
ENERGEST_ON(ENERGEST_TYPE_IRQ); ENERGEST_ON(ENERGEST_TYPE_IRQ);

View file

@ -32,18 +32,11 @@
*/ */
#include "contiki-conf.h" #include "contiki-conf.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#include <signal.h>
#endif
#include "sys/energest.h" #include "sys/energest.h"
#include "sys/clock.h" #include "sys/clock.h"
#include "sys/etimer.h" #include "sys/etimer.h"
#include "rtimer-arch.h" #include "rtimer-arch.h"
#include "isr_compat.h"
#include "dev/leds.h" #include "dev/leds.h"
@ -57,13 +50,7 @@ static volatile clock_time_t count = 0;
/* last_tar is used for calculating clock_fine, last_ccr might be better? */ /* last_tar is used for calculating clock_fine, last_ccr might be better? */
static unsigned short last_tar = 0; static unsigned short last_tar = 0;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifdef __IAR_SYSTEMS_ICC__ ISR(TIMER1_A1, timera1)
#pragma vector=TIMER1_A1_VECTOR
__interrupt void
#else
interrupt(TIMER1_A1_VECTOR)
#endif
timera1 (void)
{ {
ENERGEST_ON(ENERGEST_TYPE_IRQ); ENERGEST_ON(ENERGEST_TYPE_IRQ);

View file

@ -30,13 +30,6 @@
*/ */
#include "contiki.h" #include "contiki.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#include <signal.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>

View file

@ -36,13 +36,6 @@
*/ */
#include "contiki.h" #include "contiki.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#include <signal.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include "dev/flash.h" #include "dev/flash.h"

View file

@ -35,11 +35,6 @@
******************************************************************************/ ******************************************************************************/
#include "contiki-conf.h" #include "contiki-conf.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#endif
#include "hal_MSP-EXP430F5438.h" #include "hal_MSP-EXP430F5438.h"
#include "hal_lcd_fonts.h" #include "hal_lcd_fonts.h"

View file

@ -42,12 +42,6 @@
#include "contiki-conf.h" #include "contiki-conf.h"
#include "dev/leds.h" #include "dev/leds.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#endif
/* LED ports */ /* LED ports */
#define LEDS_CONF_RED 0x01 #define LEDS_CONF_RED 0x01
#define LEDS_CONF_GREEN 0x02 #define LEDS_CONF_GREEN 0x02

View file

@ -31,12 +31,6 @@
* @(#)$Id: msp430.c,v 1.1 2010/08/24 16:26:38 joxe Exp $ * @(#)$Id: msp430.c,v 1.1 2010/08/24 16:26:38 joxe Exp $
*/ */
#include "contiki.h" #include "contiki.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#include <signal.h>
#endif
#include "dev/watchdog.h" #include "dev/watchdog.h"
#include "dev/leds.h" #include "dev/leds.h"
#include "net/uip.h" #include "net/uip.h"

View file

@ -44,19 +44,6 @@
* changeable! * changeable!
*/ */
#define TYNDALL 1 #define TYNDALL 1
/* Test for IAR compiler */
#ifdef __IAR_SYSTEMS_ICC__
#include <intrinsics.h>
#include <in430.h>
#define dint() __disable_interrupt()
#define eint() __enable_interrupt()
#define __MSP430F5437__ 1
#define __MSP430__ 1
#define CC_CONF_INLINE
#define BV(x) (1 << x)
#else
#define CC_CONF_INLINE inline
#endif
/* CPU target speed in Hz */ /* CPU target speed in Hz */
#define F_CPU 8000000uL // 8MHz by default #define F_CPU 8000000uL // 8MHz by default

View file

@ -39,17 +39,11 @@
*/ */
#include "contiki.h" #include "contiki.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#include <signal.h>
#endif
#include "sys/energest.h" #include "sys/energest.h"
#include "sys/rtimer.h" #include "sys/rtimer.h"
#include "sys/process.h" #include "sys/process.h"
#include "dev/watchdog.h" #include "dev/watchdog.h"
#include "isr_compat.h"
#define DEBUG 0 #define DEBUG 0
#if DEBUG #if DEBUG
@ -60,13 +54,8 @@
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifdef __IAR_SYSTEMS_ICC__ ISR(TIMER1_A0, timera0)
#pragma vector=TIMER1_A0_VECTOR {
__interrupt void
#else
interrupt(TIMER1_A0_VECTOR)
#endif
timera0 (void) {
ENERGEST_ON(ENERGEST_TYPE_IRQ); ENERGEST_ON(ENERGEST_TYPE_IRQ);
watchdog_start(); watchdog_start();

View file

@ -30,17 +30,12 @@
*/ */
#include "contiki-conf.h" #include "contiki-conf.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#endif
/* /*
* This is SPI initialization code for the MSP430X architecture. * This is SPI initialization code for the MSP430X architecture.
* *
*/ */
unsigned char spi_busy = 0; /* unsigned char spi_busy = 0; */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
* Initialize SPI bus. * Initialize SPI bus.

View file

@ -36,13 +36,6 @@
*/ */
#include "contiki.h" #include "contiki.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#include <signal.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include "sys/energest.h" #include "sys/energest.h"
@ -50,6 +43,7 @@
#include "dev/watchdog.h" #include "dev/watchdog.h"
#include "lib/ringbuf.h" #include "lib/ringbuf.h"
#include "dev/leds.h" #include "dev/leds.h"
#include "isr_compat.h"
static int (*uart1_input_handler)(unsigned char c); static int (*uart1_input_handler)(unsigned char c);
@ -114,13 +108,7 @@ uart1_init(unsigned long ubr)
UCA1IE |= UCRXIE; /* Enable UCA1 RX interrupt */ UCA1IE |= UCRXIE; /* Enable UCA1 RX interrupt */
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifdef __IAR_SYSTEMS_ICC__ ISR(USCI_A1, uart1_rx_interrupt)
#pragma vector=USCI_A1_VECTOR
__interrupt void
#else
interrupt(USCI_A1_VECTOR)
#endif
uart1_rx_interrupt(void)
{ {
uint8_t c; uint8_t c;

View file

@ -32,13 +32,8 @@
*/ */
#include "contiki-conf.h" #include "contiki-conf.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <msp430.h>
#else
#include <io.h>
#include <signal.h>
#endif
#include "dev/watchdog.h" #include "dev/watchdog.h"
#include "isr_compat.h"
static int counter = 0; static int counter = 0;
@ -76,13 +71,7 @@ printstring(char *s)
#endif /* CONTIKI_TARGET_SKY */ #endif /* CONTIKI_TARGET_SKY */
#endif /* PRINT_STACK_ON_REBOOT */ #endif /* PRINT_STACK_ON_REBOOT */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifdef __IAR_SYSTEMS_ICC__ ISR(WDT, watchdog_interrupt)
#pragma vector=WDT_VECTOR
__interrupt void
#else
interrupt(WDT_VECTOR)
#endif
watchdog_interrupt(void)
{ {
#ifdef CONTIKI_TARGET_SKY #ifdef CONTIKI_TARGET_SKY
#if PRINT_STACK_ON_REBOOT #if PRINT_STACK_ON_REBOOT