mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-10-09 04:54:56 +00:00
fixed cpu/msp430 for compilation with IAR compiler
This commit is contained in:
parent
26f0a6e88e
commit
928bf6b6c1
@ -25,6 +25,40 @@ CONTIKI_TARGET_SOURCEFILES += $(MSP430) \
|
||||
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
||||
|
||||
### Compiler definitions
|
||||
ifdef IAR
|
||||
CC = icc430
|
||||
LD = xlink
|
||||
AS = iasm430
|
||||
AR = xar
|
||||
OBJCOPY = ielftool
|
||||
STRIP = strip
|
||||
|
||||
|
||||
ifndef IAR_PATH
|
||||
# This works with cygwin...
|
||||
IAR_BIN_PATH = $(shell dirname `which $(CC)`)
|
||||
IAR_PATH_C = $(shell dirname $(IAR_BIN_PATH))
|
||||
IAR_PATH = $(shell cygpath -m $(IAR_PATH_C))
|
||||
endif
|
||||
|
||||
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
|
||||
CUSTOM_RULE_C_TO_O = 1
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
|
||||
$(OBJECTDIR)/%.o: %.c
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
# @$(FINALIZE_DEPENDENCY)
|
||||
CUSTOM_RULE_C_TO_CO = 1
|
||||
%.co: %.c
|
||||
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@
|
||||
|
||||
AROPTS = -o
|
||||
LDFLAGS += -B $(IAR_PATH)/lib/dlib/dl430xlfn.r43 -f $(IAR_PATH)/config/lnk430f5437.xcl -l contiki-$(TARGET).map -Fintel-extended -s __program_start
|
||||
|
||||
else
|
||||
GCC = 1
|
||||
CC = msp430-gcc
|
||||
LD = msp430-gcc
|
||||
AS = msp430-as
|
||||
@ -33,12 +67,16 @@ NM = msp430-nm
|
||||
OBJCOPY = msp430-objcopy
|
||||
STRIP = msp430-strip
|
||||
BSL = msp430-bsl
|
||||
ifdef WERROR
|
||||
CFLAGSWERROR=-Werror
|
||||
endif
|
||||
CFLAGSNO = -Wall -mmcu=$(MCU) -g $(CFLAGSWERROR)
|
||||
CFLAGS += $(CFLAGSNO) -Os
|
||||
LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map
|
||||
endif
|
||||
|
||||
ifdef WERROR
|
||||
CFLAGSWERROR=-Werror
|
||||
endif
|
||||
|
||||
CFLAGS += $(CFLAGSNO)
|
||||
|
||||
|
||||
### These flags can reduce the code size and RAM usage with up to 10%
|
||||
|
@ -35,7 +35,14 @@
|
||||
|
||||
#include "sys/cc.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <io430.h>
|
||||
#endif
|
||||
|
||||
#define HWCONF_PIN(name, port, bit) \
|
||||
static CC_INLINE void name##_SELECT() {P##port##SEL &= ~(1 << bit);} \
|
||||
|
@ -33,7 +33,6 @@
|
||||
#ifndef __LPM_H__
|
||||
#define __LPM_H__
|
||||
|
||||
#include <io.h>
|
||||
#include "contiki-conf.h"
|
||||
|
||||
#ifdef LPM_CONF_ON
|
||||
|
@ -35,9 +35,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <msp430x14x.h>
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <io430.h>
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "dev/flash.h"
|
||||
#include "dev/watchdog.h"
|
||||
|
@ -69,7 +69,11 @@ void splx_(spl_t);
|
||||
spl_t splhigh_(void);
|
||||
|
||||
#define splhigh() splhigh_()
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#define splx(sr) sr = __get_SR_register()
|
||||
#else
|
||||
#define splx(sr) __asm__ __volatile__("bis %0, r2" : : "r" (sr))
|
||||
#endif
|
||||
|
||||
/* Workaround for bug in msp430-gcc compiler */
|
||||
#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND
|
||||
|
@ -34,6 +34,10 @@
|
||||
#include <stdio.h>
|
||||
#include "sys/mt.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#define __asm__ asm
|
||||
#endif
|
||||
|
||||
static unsigned short *sptmp;
|
||||
static struct mtarch_thread *running;
|
||||
|
||||
@ -97,8 +101,14 @@ sw(void)
|
||||
__asm__("push r14");
|
||||
__asm__("push r15");
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
/* use IAR intrinsic functions */
|
||||
running->sp = (unsigned short *) __get_SP_register();
|
||||
__set_SP_register((unsigned short) sptmp);
|
||||
#else
|
||||
__asm__("mov.w r1,%0" : "=r" (running->sp));
|
||||
__asm__("mov.w %0,r1" : : "m" (sptmp));
|
||||
#endif
|
||||
|
||||
__asm__("pop r15");
|
||||
__asm__("pop r14");
|
||||
|
@ -39,7 +39,7 @@ struct mtarch_thread {
|
||||
unsigned short stack[MTARCH_STACKSIZE];
|
||||
unsigned short *sp;
|
||||
void *data;
|
||||
void *function;
|
||||
void (* function)(void *);
|
||||
};
|
||||
|
||||
struct mt_thread;
|
||||
|
@ -38,8 +38,14 @@
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <io430.h>
|
||||
#endif
|
||||
|
||||
#include "sys/energest.h"
|
||||
#include "sys/rtimer.h"
|
||||
|
@ -41,7 +41,6 @@
|
||||
#ifndef __RTIMER_ARCH_H__
|
||||
#define __RTIMER_ARCH_H__
|
||||
|
||||
#include <io.h>
|
||||
#include "sys/rtimer.h"
|
||||
|
||||
#define RTIMER_ARCH_SECOND (4096U*8)
|
||||
|
Loading…
Reference in New Issue
Block a user