]> git.karo-electronics.de Git - oswald.git/blobdiff - metawatch/Makefile
Here we are! MetaWatch support in Oswald!
[oswald.git] / metawatch / Makefile
diff --git a/metawatch/Makefile b/metawatch/Makefile
new file mode 100644 (file)
index 0000000..64ef09f
--- /dev/null
@@ -0,0 +1,123 @@
+#
+# Makefile for msp430
+# adapted from the example Makefile from the mspgcc project
+#
+# 'make' builds everything
+# 'make clean' deletes everything except source files and Makefile
+# You need to set TARGET, MCU and SOURCES for your project.
+# TARGET is the name of the executable file to be produced 
+# $(TARGET).elf $(TARGET).hex and $(TARGET).txt nad $(TARGET).map are all generated.
+# The TXT file is used for BSL loading, the ELF can be used for JTAG use
+# 
+TARGET     = oswald_mw
+MCU        = msp430f5438a
+MEMMODEL   = -mmemory-model=huge -fdata-sections -ffunction-sections # -mdata-region=far
+# -gdwarf-2 -fdata-sections -ffunction-sections
+#MEMMODEL   = -mmpy=16 -msr20 -md20 -gdwarf-2 -fdata-sections -ffunction-sections
+# MEMMODEL   = -mmemory-model=medium -misr20
+#MEMMODEL   = -mmemory-model=medium
+
+APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2
+#APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 -DWITH_BTSTACK
+#APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 -DCC256x_TRANSP
+#APPCONFIG = -DDIGITAL -DMW_DIGITAL_V2
+
+# List all the source files here
+# eg if you have a source file foo.c then list it here
+OSWALD_SRC = ../ui/oswald_main.c ../ui/oswald_screens.c \
+       ../ui/oswald_watch_faces.c ../ui/Fonts.c ../ui/LcdDisplay.c \
+       ../ui/oswald_strings.c ../ui/calendar.c \
+       ../ui/embedvm.c
+
+SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \
+       bluetooth_init_cc2560_2.44.c \
+       bt_hci.c bt_l2cap.c \
+       oswald_hal.c $(OSWALD_SRC)
+#      $(BT_SMALLTOOTH_SRC)
+#      $(BT_STACK_SRC) \
+
+#BT_STACK_INC = -Ibtstack/ -Ibtstack/include/
+#BT_SMALLTOOTH_INV = -IBluetooth/
+# Include are located in the Include directory
+#INCLUDES = $(BT_STACK_INC)
+#INCLUDES = $(BT_SMALLTOOTH_INV)
+INCLUDES = -I../ui/ -I../ui/bitmaps/
+
+# Add or subtract whatever MSPGCC flags you want. There are plenty more
+#######################################################################################
+CFLAGS   = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG)
+ASFLAGS  = -mmcu=$(MCU) $(MEMMODEL) -x assembler-with-cpp -Wa,-gstabs
+LDFLAGS  = -mmcu=$(MCU) $(MEMMODEL) -Wl,-gc-sections -Wl,-Map=$(TARGET).map
+########################################################################################
+CC       = msp430-gcc
+LD       = msp430-ld
+AR       = msp430-ar
+AS       = msp430-gcc
+GASP     = msp430-gasp
+NM       = msp430-nm
+OBJCOPY  = msp430-objcopy
+RANLIB   = msp430-ranlib
+STRIP    = msp430-strip
+SIZE     = msp430-size
+READELF  = msp430-readelf
+MAKETXT  = srec_cat
+CP       = cp -p
+RM       = rm -f
+MV       = mv
+########################################################################################
+# the file which will include dependencies
+DEPEND = $(SOURCES:.c=.d)
+
+# all the object files
+OBJECTS = $(SOURCES:.c=.o)
+
+all: $(TARGET).elf $(TARGET).hex $(TARGET).txt 
+
+prog: $(TARGET).hex
+       mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex"
+
+prog_watch: $(TARGET).hex
+       mspdebug rf2500 -v 2500 "prog $(TARGET).hex"
+
+$(TARGET).elf: $(OBJECTS)
+       echo "Linking $@"
+       $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
+       echo
+       echo ">>>> Size of Firmware <<<<"
+       $(SIZE) $(TARGET).elf
+       echo
+
+%.hex: %.elf
+       $(OBJCOPY) -O ihex $< $@
+
+%.txt: %.hex
+       $(MAKETXT) -O $@ -TITXT $< -I
+       unix2dos $(TARGET).txt
+#  The above line is required for the DOS based TI BSL tool to be able to read the txt file generated from linux/unix systems.
+
+%.o: %.c
+       echo "Compiling $<"
+       $(CC) -c $(CFLAGS) -o $@ $<
+
+# rule for making assembler source listing, to see the code
+%.lst: %.c
+       $(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
+
+# include the dependencies unless we're going to clean, then forget about them.
+ifneq ($(MAKECMDGOALS), clean)
+-include $(DEPEND)
+endif
+# dependencies file
+# includes also considered, since some of these are our own
+# (otherwise use -MM instead of -M)
+%.d: %.c
+       echo "Generating dependencies $@ from $<"
+       $(CC) -M ${CFLAGS} $< >$@
+
+#.SILENT:
+.PHONY:        clean
+clean:
+       -$(RM) $(OBJECTS)
+       -$(RM) $(TARGET).*
+       -$(RM) $(SOURCES:.c=.lst)
+       -$(RM) $(DEPEND)