]> git.karo-electronics.de Git - oswald.git/blob - metawatch/Makefile
Rework font code, add new fonts, also proportional, rework watch usage - "SET" button...
[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
28 BTCC256x_SCRIPT = bluetooth_init_cc2560_2.44.c
29 #BTCC256x_SCRIPT = bluetooth_init_cc2564_2.8.c
30
31 OSWALD_SRC = ../ui/oswald_main.c ../ui/oswald_screens.c \
32         ../ui/oswald_watch_faces.c \
33         ../ui/oswald_strings.c ../ui/calendar.c \
34         ../ui/oswald_graphics.c ../ui/oswald_fonts.c \
35         ../ui/embedvm.c
36
37 SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \
38         mw_acc.c $(BTCC256x_SCRIPT) \
39         bt_hci.c bt_l2cap.c \
40         oswald_hal.c $(OSWALD_SRC)
41 #       $(BT_SMALLTOOTH_SRC)
42 #       $(BT_STACK_SRC) \
43
44 #BT_STACK_INC = -Ibtstack/ -Ibtstack/include/
45 #BT_SMALLTOOTH_INV = -IBluetooth/
46 # Include are located in the Include directory
47 #INCLUDES = $(BT_STACK_INC)
48 #INCLUDES = $(BT_SMALLTOOTH_INV)
49 INCLUDES = -I../ui/
50
51 # Add or subtract whatever MSPGCC flags you want. There are plenty more
52 #######################################################################################
53 CFLAGS   = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG)
54 ASFLAGS  = -mmcu=$(MCU) $(MEMMODEL) -x assembler-with-cpp -Wa,-gstabs
55 LDFLAGS  = -mmcu=$(MCU) $(MEMMODEL) -Wl,-gc-sections -Wl,-Map=$(TARGET).map
56 ########################################################################################
57 CC       = msp430-gcc
58 LD       = msp430-ld
59 AR       = msp430-ar
60 AS       = msp430-gcc
61 GASP     = msp430-gasp
62 NM       = msp430-nm
63 OBJCOPY  = msp430-objcopy
64 RANLIB   = msp430-ranlib
65 STRIP    = msp430-strip
66 SIZE     = msp430-size
67 READELF  = msp430-readelf
68 MAKETXT  = srec_cat
69 CP       = cp -p
70 RM       = rm -f
71 MV       = mv
72 ########################################################################################
73 # the file which will include dependencies
74 DEPEND = $(SOURCES:.c=.d)
75
76 # all the object files
77 OBJECTS = $(SOURCES:.c=.o)
78
79 all: $(TARGET).elf $(TARGET).hex $(TARGET).txt 
80
81 prog: $(TARGET).hex
82         mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex"
83
84 prog_watch: $(TARGET).hex
85         mspdebug rf2500 -v 2500 "prog $(TARGET).hex"
86
87 $(TARGET).elf: $(OBJECTS)
88         echo "Linking $@"
89         $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
90         echo
91         echo ">>>> Size of Firmware <<<<"
92         $(SIZE) $(TARGET).elf
93         echo
94
95 %.hex: %.elf
96         $(OBJCOPY) -O ihex $< $@
97
98 %.txt: %.hex
99         $(MAKETXT) -O $@ -TITXT $< -I
100         unix2dos $(TARGET).txt
101 #  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.
102
103 %.o: %.c
104         echo "Compiling $<"
105         $(CC) -c $(CFLAGS) -o $@ $<
106
107 # rule for making assembler source listing, to see the code
108 %.lst: %.c
109         $(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
110
111 # include the dependencies unless we're going to clean, then forget about them.
112 ifneq ($(MAKECMDGOALS), clean)
113 -include $(DEPEND)
114 endif
115 # dependencies file
116 # includes also considered, since some of these are our own
117 # (otherwise use -MM instead of -M)
118 %.d: %.c
119         echo "Generating dependencies $@ from $<"
120         $(CC) -M ${CFLAGS} $< >$@
121
122 #.SILENT:
123 .PHONY: clean
124 clean:
125         -$(RM) $(OBJECTS)
126         -$(RM) $(TARGET).*
127         -$(RM) $(SOURCES:.c=.lst)
128         -$(RM) $(DEPEND)