]> rtime.felk.cvut.cz Git - fpga/virtex2/blink.git/commitdiff
+ Softcore software.
authorVladimir Burian <buriavl2@fel.cvut.cz>
Sat, 8 Jan 2011 23:43:57 +0000 (00:43 +0100)
committerVladimir Burian <buriavl2@fel.cvut.cz>
Sat, 8 Jan 2011 23:43:57 +0000 (00:43 +0100)
software/Makefile [new file with mode: 0644]
software/hardware.h [new file with mode: 0644]
software/main.c [new file with mode: 0644]

diff --git a/software/Makefile b/software/Makefile
new file mode 100644 (file)
index 0000000..00e37ad
--- /dev/null
@@ -0,0 +1,53 @@
+# makfile configuration
+NAME            = leds
+OBJECTS         = main.o
+CPU             = msp430x1121
+
+CFLAGS          = -mmcu=${CPU} -mforce-hwmul -O2 -Wall -g
+CFLAGS         += -v
+
+#switch the compiler (for the internal make rules)
+CC              = msp430-gcc
+
+
+.PHONY: all FORCE clean download download-jtag download-bsl dist
+
+#all should be the first target. it's built when make is runwithout args
+all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst
+
+#confgigure the next line if you want to use the serial download
+download: download-uart
+#download: download-jtag
+#download: download-bsl
+
+#additional rules for files
+${NAME}.elf: ${OBJECTS}
+       ${CC} ${CFLAGS} -mmcu=${CPU} -o $@ ${OBJECTS}
+
+${NAME}.a43: ${NAME}.elf
+       msp430-objcopy -O ihex $^ $@
+
+${NAME}.lst: ${NAME}.elf
+       msp430-objdump -dSt $^ >$@
+
+download-jtag: all
+       msp430-jtag -e ${NAME}.elf
+
+download-bsl: all
+       msp430-bsl -e ${NAME}.elf
+
+download-uart: all
+       openmsp430-loader.tcl -device /dev/ttyUSB0 -baudrate 115200 ${NAME}.elf
+
+clean:
+       rm -f ${NAME} ${NAME}.a43 ${NAME}.lst *.o
+
+#backup archive
+dist:
+       tar czf dist.tgz *.c *.h *.txt makefile
+
+#dummy target as dependecy if something has to be build everytime
+FORCE:
+
+#project dependencies
+main.o: main.c hardware.h
diff --git a/software/hardware.h b/software/hardware.h
new file mode 100644 (file)
index 0000000..3584bb8
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef MAIN_H
+#define MAIN_H
+
+#define __msp430_have_port3
+#define __MSP430_HAS_PORT3__
+
+#include <io.h>
+#include <signal.h>
+#include <iomacros.h>
+
+
+
+#endif // MAIN_H
diff --git a/software/main.c b/software/main.c
new file mode 100644 (file)
index 0000000..57e68c1
--- /dev/null
@@ -0,0 +1,34 @@
+#include "hardware.h"
+
+void delay(unsigned int c, unsigned int d) {
+  unsigned int i, j;
+  
+  for (i = 0; i<c; i++) {
+    for (j = 0; j<d; j++) {
+      nop();
+      nop();
+    }
+  }
+}
+
+//==============================================================================
+int main(void) {
+  unsigned int i;
+
+  WDTCTL = WDTPW | WDTHOLD;          // Disable watchdog timer
+
+  P1DIR  = 0xff;
+  P1OUT  = 0x00;
+
+  P2DIR  = 0xff;
+  P2OUT  = 0xf1;
+
+
+  while (1) {
+    for (i = 0;  i < 6;  i++) {
+      P1OUT = (1 << i);
+      delay(0x0007, 0xffff);
+    }
+  }  
+}
+