fixed Sky platform for IAR compiler
This commit is contained in:
parent
d01df43a0c
commit
95dde73618
@ -50,9 +50,12 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <io.h>
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "dev/ds2411.h"
|
||||
|
||||
|
@ -41,8 +41,12 @@ IAR_PATH_C = $(shell dirname "$(IAR_BIN_PATH)")
|
||||
IAR_PATH = $(shell cygpath -m "$(IAR_PATH_C)")
|
||||
endif
|
||||
|
||||
#defaults on the MSP430X core include file here (xlfn.h)
|
||||
ifndef CFLAGSNO
|
||||
CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430xlfn.h" $(CFLAGSWERROR)
|
||||
# CFLAGSNO = --dlib_config $(IAR_PATH)/LIB/DLIB/dl430xlfn.h -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X $(CFLAGSWERROR) --data_model large --double=32
|
||||
endif
|
||||
|
||||
CUSTOM_RULE_C_TO_O = 1
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
@ -29,10 +29,15 @@
|
||||
* @(#)$Id: cc2420-arch.c,v 1.10 2010/12/16 22:49:33 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "contiki.h"
|
||||
#include "contiki-net.h"
|
||||
|
||||
#include "dev/spi.h"
|
||||
@ -51,7 +56,13 @@
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=CC2420_IRQ_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(CC2420_IRQ_VECTOR)
|
||||
#endif
|
||||
|
||||
cc24240_port1_interrupt(void)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
@ -34,9 +34,13 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sys/energest.h"
|
||||
@ -248,7 +252,12 @@ uart1_init(unsigned long ubr)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if !RX_WITH_DMA
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=UART1RX_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(UART1RX_VECTOR)
|
||||
#endif
|
||||
uart1_rx_interrupt(void)
|
||||
{
|
||||
uint8_t c;
|
||||
|
@ -31,9 +31,14 @@
|
||||
* @(#)$Id: msp430.c,v 1.15 2011/01/05 13:36:38 joxe Exp $
|
||||
*/
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#include <sys/unistd.h>
|
||||
#define asmv(arg) __asm__ __volatile__(arg)
|
||||
#endif
|
||||
#include "dev/watchdog.h"
|
||||
#include "net/uip.h"
|
||||
|
||||
@ -182,8 +187,10 @@ init_ports(void)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* msp430-ld may align _end incorrectly. Workaround in cpu_init. */
|
||||
#if defined(__MSP430__) && defined(__GNUC__)
|
||||
extern int _end; /* Not in sys/unistd.h */
|
||||
static char *cur_break = (char *)&_end;
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* add/remove_lpm_req - for requiring a specific LPM mode. currently Contiki */
|
||||
@ -215,14 +222,17 @@ msp430_cpu_init(void)
|
||||
init_ports();
|
||||
msp430_init_dco();
|
||||
eint();
|
||||
#if defined(__MSP430__) && defined(__GNUC__)
|
||||
if((uintptr_t)cur_break & 1) { /* Workaround for msp430-ld bug! */
|
||||
cur_break++;
|
||||
}
|
||||
#endif
|
||||
|
||||
msp430_dco_required = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define asmv(arg) __asm__ __volatile__(arg)
|
||||
|
||||
#
|
||||
#define STACK_EXTRA 32
|
||||
|
||||
/*
|
||||
@ -231,6 +241,7 @@ msp430_cpu_init(void)
|
||||
* be used to check if cur_break and the stack pointer meet during
|
||||
* runtime.
|
||||
*/
|
||||
#if defined(__MSP430__) && defined(__GNUC__)
|
||||
void *
|
||||
sbrk(int incr)
|
||||
{
|
||||
@ -249,6 +260,7 @@ sbrk(int incr)
|
||||
*/
|
||||
return old_break;
|
||||
}
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Mask all interrupts that can be masked.
|
||||
@ -256,10 +268,15 @@ sbrk(int incr)
|
||||
int
|
||||
splhigh_(void)
|
||||
{
|
||||
/* Clear the GIE (General Interrupt Enable) flag. */
|
||||
int sr;
|
||||
/* Clear the GIE (General Interrupt Enable) flag. */
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
sr = __get_SR_register();
|
||||
__bic_SR_register(GIE);
|
||||
#else
|
||||
asmv("mov r2, %0" : "=r" (sr));
|
||||
asmv("bic %0, r2" : : "i" (GIE));
|
||||
#endif
|
||||
return sr & GIE; /* Ignore other sr bits. */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -269,8 +286,12 @@ splhigh_(void)
|
||||
void
|
||||
splx_(int sr)
|
||||
{
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
__bis_SR_register(sr);
|
||||
#else
|
||||
/* If GIE was set, restore it. */
|
||||
asmv("bis %0, r2" : : "r" (sr));
|
||||
#endif
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* this code will always start the TimerB if not already started */
|
||||
|
@ -33,11 +33,13 @@
|
||||
* Machine dependent MSP430 SLIP routines for UART1.
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
#endif
|
||||
#include "dev/slip.h"
|
||||
#include "dev/uart1.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -29,10 +29,15 @@
|
||||
* @(#)$Id: spi.c,v 1.1 2006/06/17 22:41:21 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
#include <io.h>
|
||||
|
||||
#include "contiki-conf.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* On the Tmote sky access to I2C/SPI/UART0 must always be
|
||||
* exclusive. Set spi_busy so that interrupt handlers can check if
|
||||
|
@ -14,7 +14,19 @@ ifdef UIP_CONF_IPV6
|
||||
CFLAGS += -DWITH_UIP6=1
|
||||
endif
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) $(CONTIKI_TARGET_MAIN)
|
||||
ifdef GCC
|
||||
CFLAGS+=-Os -g
|
||||
endif
|
||||
|
||||
ifdef IAR
|
||||
CFLAGS+=-e --vla -Ohz --multiplier=16s --core=430 --double=32
|
||||
CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR)
|
||||
|
||||
endif
|
||||
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) #$(CONTIKI_TARGET_MAIN)
|
||||
CONTIKI_TARGET_SOURCEFILES += contiki-sky-platform.c
|
||||
|
||||
MCU=msp430x1611
|
||||
include $(CONTIKI)/cpu/msp430/Makefile.msp430
|
||||
@ -23,6 +35,14 @@ contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
||||
# $(AR) rcf $@ $^
|
||||
|
||||
|
||||
ifdef IAR
|
||||
ifdef ELF
|
||||
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl" -l contiki-$(TARGET).map -Felf -yn -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
else
|
||||
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
endif
|
||||
endif
|
||||
|
||||
NUMPAR=20
|
||||
IHEXFILE=tmpimage.ihex
|
||||
|
||||
|
@ -56,8 +56,12 @@
|
||||
#include "cfs/cfs.h"
|
||||
#include "cfs/cfs-coffee.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#define DEBUG 0
|
||||
|
@ -31,11 +31,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "contiki.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "contiki.h"
|
||||
#endif
|
||||
|
||||
#include "dev/cc2420.h"
|
||||
#include "dev/ds2411.h"
|
||||
|
@ -36,9 +36,14 @@
|
||||
* $Revision: 1.11 $
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "dev/battery-sensor.h"
|
||||
#include "dev/sky-sensors.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
/* Configure ADC12_2 to sample channel 11 (voltage) and use */
|
||||
/* the Vref+ as reference (SREF_1) since it is a stable reference */
|
||||
|
@ -33,7 +33,12 @@
|
||||
#include "lib/sensors.h"
|
||||
#include "dev/hwconf.h"
|
||||
#include "dev/button-sensor.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
const struct sensors_sensor button_sensor;
|
||||
|
||||
@ -44,7 +49,12 @@ HWCONF_PIN(BUTTON, 2, 7);
|
||||
HWCONF_IRQ(BUTTON, 2, 7);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=PORT2_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(PORT2_VECTOR)
|
||||
#endif
|
||||
irq_p2(void)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
@ -41,10 +41,14 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <io.h>
|
||||
|
||||
#include <contiki.h>
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include <dev/spi.h>
|
||||
#include <dev/leds.h>
|
||||
|
||||
|
@ -36,7 +36,11 @@
|
||||
#include "dev/sky-sensors.h"
|
||||
#include "dev/light-sensor.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
/* Photodiode 1 (P64) on INCH_4 */
|
||||
/* Photodiode 2 (P65) on INCH_5 */
|
||||
|
@ -38,8 +38,13 @@
|
||||
* $Revision: 1.3 $
|
||||
*/
|
||||
#include "contiki.h"
|
||||
#include "lib/sensors.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include "lib/sensors.h"
|
||||
|
||||
#define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno]
|
||||
|
||||
|
@ -39,13 +39,18 @@
|
||||
* unwritten data will read as zeros (UNIX style).
|
||||
*/
|
||||
|
||||
|
||||
#include "contiki.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
#include "dev/spi.h"
|
||||
#include "dev/xmem.h"
|
||||
|
@ -50,6 +50,21 @@
|
||||
#define PLATFORM_HAS_LEDS 1
|
||||
#define PLATFORM_HAS_BUTTON 1
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <intrinsics.h>
|
||||
#include <in430.h>
|
||||
#define dint() __disable_interrupt()
|
||||
#define eint() __enable_interrupt()
|
||||
#define __MSP430F1611__ 1
|
||||
#define __MSP430__ 1
|
||||
#define CC_CONF_INLINE
|
||||
#define BV(x) (1 << x)
|
||||
#else
|
||||
#define CC_CONF_INLINE inline
|
||||
#define MSP430_MEMCPY_WORKAROUND 1
|
||||
#endif
|
||||
|
||||
|
||||
/* CPU target speed in Hz */
|
||||
#define F_CPU 3900000uL /*2457600uL*/
|
||||
|
||||
@ -61,10 +76,7 @@
|
||||
#define CCIF
|
||||
#define CLIF
|
||||
|
||||
#define CC_CONF_INLINE inline
|
||||
|
||||
#define HAVE_STDINT_H
|
||||
#define MSP430_MEMCPY_WORKAROUND 1
|
||||
#include "msp430def.h"
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user