Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

upgrade example to uniarch

  • Loading branch information...
commit 495ba51a5150b231ca5bb3e75a8871a9eadd01f2 1 parent 1142b24
Antoine Fraboulet authored
View
14 examples/test2/test2-uart/Makefile
@@ -0,0 +1,14 @@
+
+# define one name for each executable to be built
+NAMES = uart
+CPU = -mmcu=msp430x135
+UTILS_PATH = ../../utils
+
+# sources files specific to 'first_target'
+SRC = main.c serialComm.c
+ASM = taskhandler.S asmlib.S
+INCLUDES = -I.
+
+# the makefile common will generate NAMES.hex and NAMES.elf files, and define 'all' and 'clean' directives
+-include ${UTILS_PATH}/mspgcc.makefile
+
View
16 examples/test2/test2-uart/asmlib.S
@@ -14,8 +14,16 @@ chris <cliechti@gmx.net>
/**
demux timer A interrupts
*/
+#if defined(__MSPGCC__)
+.global tax_int
+ .type tax_int,@function
+tax_int:
+.global __isr_6
+__isr_6:
+#else
interrupt(TIMERA1_VECTOR)
tax_int:
+#endif
add &TAIV, r0 ; Add TA interrupt offset to PC
reti ; CCR0 - no source
jmp ccr1 ; CCR1
@@ -31,8 +39,16 @@ ccr2: reti ;br #INT_TimerA_CCR2 ;redirect to an interrupt function
/**
UART receive interrupts on character
*/
+#if defined(__MSPGCC__)
+.global uart0RX
+ .type uart9RX,@function
+uart0RX:
+.global __isr_9
+__isr_9:
+#else
interrupt(UART0RX_VECTOR)
uart0RX:
+#endif
push r12 ; registers have to be saved, as a C func is called
push r13
push r14
View
59 examples/test2/test2-uart/demo.sh
@@ -1,34 +1,25 @@
-#! /bin/sh
-
-rm -f trace*.eps trace*.gp
-
-gnuplot_build()
-{
- GP=`echo *.gp`
- if [ "$GP" != "*.gp" ] ; then
- for i in ${GP} ; do
- gnuplot < $i
- done
- fi
-}
-
-gnuplot_show()
-{
- EPS=`echo *.eps`
- if [ "$EPS" != "*.eps" ] ; then
- for i in ${EPS} ; do
- gv $i &
- done
- fi
-}
-
-CALLGRINDOPTS="--dump-line=yes --dump-instr=yes --trace-jump=yes --collect-systime=yes --collect-jumps=yes --combine-dumps=yes"
-DEBUG="callgrind ${CALLGRINDOPTS}"
-DEBUG=""
-
-if [ "$1" != "" ] ; then
- ${DEBUG} ./wsim --ui --serial0=$1 --trace=trace --tracemode=gplot uart.elf
-else
- ${DEBUG} ./wsim --ui --serial0=stdout --trace=trace --tracemode=gplot uart.elf
-fi
-
+#! /bin/bash
+
+source ../../utils/wsim.inc
+
+## ============= Config===================
+
+ELF=uart.elf
+PLATFORM=msp1611-2
+
+VERBOSE=4
+LOGFILE=wsim.log
+TRACEFILE=wsim.trc
+
+MODE=run
+TIME=60s
+
+# Serial 0
+SERIAL[0]="stdout"
+
+## ============= Run =====================
+
+run_wsim
+
+## =======================================
+
View
2  examples/test2/test2-uart/hardware.h
@@ -65,7 +65,7 @@
#define BCSCTL2_INIT SELM_2|SELS|DIVS_1
#define U0CTL_INIT CHAR
-#define U0TCTL_INIT SSEL_SMCLK|TXEPT //use SMCLK
+#define U0TCTL_INIT SSEL1|TXEPT //use SMCLK
#define U0RCTL_INIT 0
//~ //115200 @4MHz
View
8 examples/test2/test2-uart/main.c
@@ -58,10 +58,10 @@ int main(void) {
P6SEL = P6SEL_INIT; //Init port or module -function on port6
#endif
- IE1 = IE1_INIT;
- IE2 = IE2_INIT;
- ME1 = ME1_INIT;
- ME2 = ME2_INIT;
+ // IE1 = IE1_INIT;
+ // IE2 = IE2_INIT;
+ // ME1 = ME1_INIT;
+ // ME2 = ME2_INIT;
P2OUT |= BIT0; //light LED during init
View
52 examples/test2/test2-uart/makefile
@@ -1,52 +0,0 @@
-# makfile configuration
-NAME = uart
-OBJECTS = main.o taskhandler.o serialComm.o asmlib.o
-CPU = msp430x135
-
-ASFLAGS = -mmcu=${CPU} -D_GNU_ASSEMBLER_
-CFLAGS = -mmcu=${CPU} -O2 -Wall -g
-
-#switch the compiler (for the internal make rules)
-CC = msp430-gcc
-AS = msp430-gcc
-
-.PHONY: all FORCE clean download download-jtag download-bsl dist
-
-#all should be the first target. it's built when make is run without args
-all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst
-
-#confgigure the next line if you want to use the serial download
-download: download-jtag
-#download: download-bsl
-
-#additional rules for files
-${NAME}.elf: ${OBJECTS}
- ${CC} -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
-
-clean:
- rm -f ${NAME}.elf ${NAME}.a43 ${NAME}.lst ${OBJECTS}
-
-#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 taskhandler.h
-serialComm.o: serialComm.c hardware.h serialComm.h asmlib.h
-asmlib.o: asmlib.S hardware.h
-taskhandler.o: taskhandler.S hardware.h taskhandler.h tasklist.h
View
2  examples/test2/test2-uart/taskhandler.S
@@ -68,7 +68,7 @@ taskhandler:
.golowpower: ; if it was last entry...
bic.b #LEDRT, &P2OUT ; Activity indicator
- bis #LPM0, r2 ; go in lowpower mode until wakeup trough interrupt
+ bis #CPUOFF, r2 ; go in lowpower mode until wakeup trough interrupt
bis.b #LEDRT, &P2OUT ; Activity indicator
jmp .Ltsk1 ; restart searching on wakeup
View
2  examples/utils/mspgcc-uniarch/io.h
@@ -1,4 +1,6 @@
+#ifndef _GNU_ASSEMBLER_
#include <inttypes.h>
+#endif
#define critical __attribute__ ((critical))
#include <msp430.h>
View
13 examples/utils/mspgcc.makefile
@@ -68,6 +68,8 @@ endif # CC_UNIARCH
+ASFLAGS += ${CPU} -D_GNU_ASSEMBLER_
+ASFLAGS += $(OPT) $(DEBUG) $(GCC_4_INCLUDE) $(INCLUDES)
CFLAGS += $(CPU) -DGCC_MSP430
CFLAGS += -MMD -MP -MF $(basename $@).d # generate dependencies file
@@ -86,6 +88,8 @@ OBJ = $(SRC:.c=.o)
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
+ASMOBJ = $(ASM:.S=.o)
+
all : $(TARGETS)
%.hex : %.elf
@@ -99,15 +103,18 @@ all : $(TARGETS)
# I didn't manage to get the content of SRC_target_name variable in prerequisites
# but is really linked with only the needed files
-%.elf : $(OBJS)
- $(CC) -o $@ $(CFLAGS) $(OBJ) $(SRC_$(basename $@):.c=.o)
+%.elf : $(OBJS) $(ASMOBJ)
+ $(CC) -o $@ $(CFLAGS) $(OBJ) $(SRC_$(basename $@):.c=.o) $(ASMOBJ)
$(OBJS) :%.o : %.c $(filter-out %.d, $(MAKEFILE_LIST))
$(CC) -c $(CFLAGS) $< -o $@
+$(ASMOBJ) :%.o : %.S
+ $(CC) -c $(ASFLAGS) $< -o $@
+
clean :
- $(RM) $(TARGETS) $(OBJS) $(DEPS) *.elf *.hex
+ $(RM) $(TARGETS) $(OBJS) ${ASMOBJ} $(DEPS) *.elf *.hex
realclean: clean
$(RM) *.log *.trc *.vcd *.pkt
Please sign in to comment.
Something went wrong with that request. Please try again.