From: Dan White Date: Tue, 11 Sep 2012 19:24:47 +0000 (-0500) Subject: Workup to allow msp4th testing on PC X-Git-Tag: bootrom-initial-submission~80 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=c6afe4bf3c25ace0a2fa370e7a9fa03955d0eaa1;p=430.git Workup to allow msp4th testing on PC --- diff --git a/msp4th/msp4th.c b/msp4th/msp4th.c index 67394b0..69694b3 100644 --- a/msp4th/msp4th.c +++ b/msp4th/msp4th.c @@ -1,8 +1,20 @@ -#include - +#if defined(MSP430) +/* use devboard uart */ #include "ns430-atoi.h" #include "ns430-uart.h" + +#else +/* mixins to test msp4th on PC */ +#include +#include +typedef uint8_t str_t; +void uart_putchar(uint8_t c) { putchar(c); } +uint8_t uart_getchar(void) { return (uint8_t)getchar(); } +void uart_puts(uint8_t *s) { puts((char *)s); } +#endif + + #include "msp4th.h" @@ -341,7 +353,7 @@ void getLine() } } else { uart_putchar(c); - if (c == '\r') { + if ((c == '\r') || (c == '\n')) { // hit cr lineBuffer[lineBufferPtr] = 0; waiting = 0; @@ -1060,13 +1072,13 @@ void execN(int16_t n){ break; case 56: // fasttimer - i = (int16_t )&fastTimer; + i = (int16_t )fastTimer; i = i>>1; pushMathStack(i); break; case 57: // slowtimer - i = (int16_t )&slowTimer; + i = (int16_t )slowTimer; i = i>>1; pushMathStack(i); break; @@ -1141,19 +1153,23 @@ void execN(int16_t n){ } +#if defined(MSP430) static int16_t __inline__ RAMerrors(void){ int16_t errors; __asm__ __volatile__ ( "mov r9, %0\n" : [res] "=r" (errors)); return errors; } +#endif void init_msp4th(void) { volatile uint16_t i; +#if defined(MSP430) printNumber(RAMerrors()); uart_puts((uint8_t *)"<-- RAM errors"); +#endif // xit = 0; diff --git a/msp4th/test4th.c b/msp4th/test4th.c new file mode 100644 index 0000000..7a2cebe --- /dev/null +++ b/msp4th/test4th.c @@ -0,0 +1,14 @@ + + +#include "msp4th.h" + + +int main(void) +{ + + init_msp4th(); + + processLoop(); + + return 0; +}