mirror of https://github.com/contiki-ng/mspsim
Updated tests to build with msp430-gcc 4.7.x
This commit is contained in:
parent
18e2a66906
commit
61b84a08d2
|
|
@ -1,17 +1,7 @@
|
|||
### Check if we are running under Windows
|
||||
|
||||
ifndef WINDIR
|
||||
ifdef OS
|
||||
ifneq (,$(findstring Windows,$(OS)))
|
||||
WINDIR := Windows
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
#MCU=msp430x149
|
||||
MCU=msp430x1611
|
||||
#MCU=msp430f149
|
||||
MCU=msp430f1611
|
||||
|
||||
### Compiler definitions
|
||||
CC = msp430-gcc
|
||||
|
|
@ -21,8 +11,7 @@ AR = msp430-ar
|
|||
OBJCOPY = msp430-objcopy
|
||||
STRIP = msp430-strip
|
||||
BSL = msp430-bsl
|
||||
CFLAGSNO = -I. -DWITH_ASCII \
|
||||
-Wall -mmcu=$(MCU) -g
|
||||
CFLAGSNO = -I. -Wall -mmcu=$(MCU) -g
|
||||
CFLAGS += $(CFLAGSNO) -Os
|
||||
|
||||
SOURCES := msp430setup.c
|
||||
|
|
@ -33,7 +22,7 @@ OBJECTS := $(SOURCES:.c=.o)
|
|||
all: cputest.firmware timertest.firmware
|
||||
|
||||
|
||||
%.firmware: %.co $(OBJECTS)
|
||||
%.firmware: %.o $(OBJECTS)
|
||||
$(CC) -mmcu=$(MCU) -Wl,-Map=$(@:.firmware=.map) $(CFLAGS) -o $@ $^
|
||||
|
||||
%.ihex: %.firmware
|
||||
|
|
@ -42,11 +31,8 @@ all: cputest.firmware timertest.firmware
|
|||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.co: %.c
|
||||
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE -c $< -o $@
|
||||
|
||||
%.u: %.ihex
|
||||
msp430-jtag -eI $^
|
||||
|
||||
clean:
|
||||
rm -f *~ *.lst *.map *.co *.o *.ihex *.firmware
|
||||
rm -f *~ *.lst *.map *.o *.ihex *.firmware
|
||||
|
|
|
|||
|
|
@ -79,13 +79,14 @@ static int caseID = 0;
|
|||
/*---------------------------------------------------------------------------*/
|
||||
static int pos = 0;
|
||||
static unsigned int times[10];
|
||||
interrupt(TIMERB1_VECTOR) timerb1 (void) {
|
||||
if (TBIV == 2) {
|
||||
if (pos < 10) {
|
||||
times[pos] = TBR;
|
||||
pos++;
|
||||
TBCCR1 = TBCCR1 + 100;
|
||||
}
|
||||
interrupt(TIMERB1_VECTOR) timerb1 (void)
|
||||
{
|
||||
if(TBIV == 2) {
|
||||
if(pos < 10) {
|
||||
times[pos] = TBR;
|
||||
pos++;
|
||||
TBCCR1 = TBCCR1 + 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
@ -259,13 +260,13 @@ static void testBitFields() {
|
|||
invert.green ^= 1;
|
||||
assertTrue(invert.green == 0);
|
||||
|
||||
assertTrue(pelle == 0x4711);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int flag;
|
||||
interrupt(UART0TX_VECTOR)
|
||||
usart_tx_test0(void)
|
||||
interrupt(UART0TX_VECTOR) usart_tx_test0 (void)
|
||||
{
|
||||
printf("*IRQ: Flags:%d %d\n", IFG1, UTCTL0);
|
||||
flag++;
|
||||
|
|
@ -352,7 +353,7 @@ uint16_t test_calib_busywait_delta( int calib )
|
|||
int8_t aclk_count = 2;
|
||||
uint16_t dco_prev = 0;
|
||||
uint16_t dco_curr = 0;
|
||||
|
||||
|
||||
set_dco_calib( calib );
|
||||
|
||||
while( aclk_count-- > 0 )
|
||||
|
|
@ -391,18 +392,18 @@ void busyCalibrateDco()
|
|||
for( calib=0,step=0x800; step!=0; step>>=1 )
|
||||
{
|
||||
// if the step is not past the target, commit it
|
||||
printf(" step: %d\n", step);
|
||||
if((tmp = test_calib_busywait_delta(calib|step)) <= TARGET_DCO_DELTA )
|
||||
printf(" step: %d\n", step);
|
||||
if((tmp = test_calib_busywait_delta(calib|step)) <= TARGET_DCO_DELTA )
|
||||
{
|
||||
calib |= step;
|
||||
printf(" committed: tmp = %d\n", tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if DCOx is 7 (0x0e0 in calib), then the 5-bit MODx is not useable, set it to 0
|
||||
if( (calib & 0x0e0) == 0x0e0 )
|
||||
calib &= ~0x01f;
|
||||
|
||||
|
||||
set_dco_calib( calib );
|
||||
}
|
||||
|
||||
|
|
@ -429,5 +430,9 @@ main(void)
|
|||
busyCalibrateDco();
|
||||
/* printf("PROFILE\n"); */
|
||||
printf("EXIT\n");
|
||||
return 0;
|
||||
|
||||
/* Short delay to allow serial output to finish */
|
||||
__delay_cycles(2000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,17 +76,17 @@ static int caseID = 0;
|
|||
|
||||
#define RTIMER_ARCH_SECOND 4096
|
||||
#define CLOCK_SECOND 128
|
||||
#define CLOCK_CONF_SECOND CLOCK_SECOND
|
||||
#define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND)
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int pos = 0;
|
||||
static unsigned int ticka0 = 0;
|
||||
static unsigned int count = 0;
|
||||
static unsigned int seconds = 0;
|
||||
static unsigned int last_tar = 0;
|
||||
static volatile unsigned int ticka0 = 0;
|
||||
static volatile unsigned int count = 0;
|
||||
static volatile unsigned int seconds = 0;
|
||||
static volatile unsigned int last_tar = 0;
|
||||
|
||||
interrupt(TIMERA1_VECTOR) timera1 (void) {
|
||||
interrupt(TIMERA1_VECTOR) timera1 (void)
|
||||
{
|
||||
if(TAIV == 2) {
|
||||
eint();
|
||||
do {
|
||||
|
|
@ -99,7 +99,7 @@ interrupt(TIMERA1_VECTOR) timera1 (void) {
|
|||
}
|
||||
}
|
||||
|
||||
if(count % CLOCK_CONF_SECOND == 0) {
|
||||
if(count % CLOCK_SECOND == 0) {
|
||||
++seconds;
|
||||
}
|
||||
} while((TACCR1 - TAR) > INTERVAL);
|
||||
|
|
@ -109,7 +109,8 @@ interrupt(TIMERA1_VECTOR) timera1 (void) {
|
|||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
interrupt(TIMERA0_VECTOR) timera0 (void) {
|
||||
interrupt(TIMERA0_VECTOR) timera0 (void)
|
||||
{
|
||||
ticka0++;
|
||||
TACCR0 += 4;
|
||||
}
|
||||
|
|
@ -132,6 +133,10 @@ static void testCase(char *description) {
|
|||
}
|
||||
|
||||
static void testTimers() {
|
||||
unsigned int counter = 0;
|
||||
|
||||
testCase("Timers");
|
||||
|
||||
dint();
|
||||
/* Timer A1 */
|
||||
/* Select ACLK 32768Hz clock, divide by 8 */
|
||||
|
|
@ -154,10 +159,11 @@ static void testTimers() {
|
|||
eint();
|
||||
|
||||
|
||||
while (ticka0 < 200) {
|
||||
printf("Timer a0:%d \n", ticka0);
|
||||
for(counter = 0; ticka0 < 100 && counter < 2000; counter++) {
|
||||
printf("Timer a0:%d\n", ticka0);
|
||||
}
|
||||
|
||||
assertTrue(ticka0 >= 100);
|
||||
assertTrue(count > 10);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -170,5 +176,9 @@ main(void)
|
|||
testTimers();
|
||||
|
||||
printf("EXIT\n");
|
||||
|
||||
/* Short delay to allow serial output to finish */
|
||||
__delay_cycles(2000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue