]> git.karo-electronics.de Git - oswald.git/blob - metawatch/Makefile
Here we are! MetaWatch support in Oswald!
[oswald.git] / metawatch / Makefile
1 #
2 # Makefile for msp430
3 # adapted from the example Makefile from the mspgcc project
4 #
5 # 'make' builds everything
6 # 'make clean' deletes everything except source files and Makefile
7 # You need to set TARGET, MCU and SOURCES for your project.
8 # TARGET is the name of the executable file to be produced 
9 # $(TARGET).elf $(TARGET).hex and $(TARGET).txt nad $(TARGET).map are all generated.
10 # The TXT file is used for BSL loading, the ELF can be used for JTAG use
11
12 TARGET     = oswald_mw
13 MCU        = msp430f5438a
14 MEMMODEL   = -mmemory-model=huge -fdata-sections -ffunction-sections # -mdata-region=far
15 # -gdwarf-2 -fdata-sections -ffunction-sections
16 #MEMMODEL   = -mmpy=16 -msr20 -md20 -gdwarf-2 -fdata-sections -ffunction-sections
17 # MEMMODEL   = -mmemory-model=medium -misr20
18 #MEMMODEL   = -mmemory-model=medium
19
20 APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2
21 #APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 -DWITH_BTSTACK
22 #APPCONFIG = -DDIGITAL -DMW_DEVBOARD_V2 -DCC256x_TRANSP
23 #APPCONFIG = -DDIGITAL -DMW_DIGITAL_V2
24
25 # List all the source files here
26 # eg if you have a source file foo.c then list it here
27 OSWALD_SRC = ../ui/oswald_main.c ../ui/oswald_screens.c \
28         ../ui/oswald_watch_faces.c ../ui/Fonts.c ../ui/LcdDisplay.c \
29         ../ui/oswald_strings.c ../ui/calendar.c \
30         ../ui/embedvm.c
31
32 SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \
33         bluetooth_init_cc2560_2.44.c \
34         bt_hci.c bt_l2cap.c \
35         oswald_hal.c $(OSWALD_SRC)
36 #       $(BT_SMALLTOOTH_SRC)
37 #       $(BT_STACK_SRC) \
38
39 #BT_STACK_INC = -Ibtstack/ -Ibtstack/include/
40 #BT_SMALLTOOTH_INV = -IBluetooth/
41 # Include are located in the Include directory
42 #INCLUDES = $(BT_STACK_INC)
43 #INCLUDES = $(BT_SMALLTOOTH_INV)
44 INCLUDES = -I../ui/ -I../ui/bitmaps/
45
46 # Add or subtract whatever MSPGCC flags you want. There are plenty more
47 #######################################################################################
48 CFLAGS   = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG)
49 ASFLAGS  = -mmcu=$(MCU) $(MEMMODEL) -x assembler-with-cpp -Wa,-gstabs
50 LDFLAGS  = -mmcu=$(MCU) $(MEMMODEL) -Wl,-gc-sections -Wl,-Map=$(TARGET).map
51 ########################################################################################
52 CC       = msp430-gcc
53 LD       = msp430-ld
54 AR       = msp430-ar
55 AS       = msp430-gcc
56 GASP     = msp430-gasp
57 NM       = msp430-nm
58 OBJCOPY  = msp430-objcopy
59 RANLIB   = msp430-ranlib
60 STRIP    = msp430-strip
61 SIZE     = msp430-size
62 READELF  = msp430-readelf
63 MAKETXT  = srec_cat
64 CP       = cp -p
65 RM       = rm -f
66 MV       = mv
67 ########################################################################################
68 # the file which will include dependencies
69 DEPEND = $(SOURCES:.c=.d)
70
71 # all the object files
72 OBJECTS = $(SOURCES:.c=.o)
73
74 all: $(TARGET).elf $(TARGET).hex $(TARGET).txt 
75
76 prog: $(TARGET).hex
77         mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex"
78
79 prog_watch: $(TARGET).hex
80         mspdebug rf2500 -v 2500 "prog $(TARGET).hex"
81
82 $(TARGET).elf: $(OBJECTS)
83         echo "Linking $@"
84         $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
85         echo
86         echo ">>>> Size of Firmware <<<<"
87         $(SIZE) $(TARGET).elf
88         echo
89
90 %.hex: %.elf
91         $(OBJCOPY) -O ihex $< $@
92
93 %.txt: %.hex
94         $(MAKETXT) -O $@ -TITXT $< -I
95         unix2dos $(TARGET).txt
96 #  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.
97
98 %.o: %.c
99         echo "Compiling $<"
100         $(CC) -c $(CFLAGS) -o $@ $<
101
102 # rule for making assembler source listing, to see the code
103 %.lst: %.c
104         $(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
105
106 # include the dependencies unless we're going to clean, then forget about them.
107 ifneq ($(MAKECMDGOALS), clean)
108 -include $(DEPEND)
109 endif
110 # dependencies file
111 # includes also considered, since some of these are our own
112 # (otherwise use -MM instead of -M)
113 %.d: %.c
114         echo "Generating dependencies $@ from $<"
115         $(CC) -M ${CFLAGS} $< >$@
116
117 #.SILENT:
118 .PHONY: clean
119 clean:
120         -$(RM) $(OBJECTS)
121         -$(RM) $(TARGET).*
122         -$(RM) $(SOURCES:.c=.lst)
123         -$(RM) $(DEPEND)