3 # adapted from the example Makefile from the mspgcc project
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
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
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
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 \
29 ../ui/oswald_strings.c ../ui/calendar.c \
30 ../ui/oswald_graphics.c ../ui/oswald_fonts.c \
33 SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \
34 bluetooth_init_cc2560_2.44.c \
36 oswald_hal.c $(OSWALD_SRC)
37 # $(BT_SMALLTOOTH_SRC)
40 #BT_STACK_INC = -Ibtstack/ -Ibtstack/include/
41 #BT_SMALLTOOTH_INV = -IBluetooth/
42 # Include are located in the Include directory
43 #INCLUDES = $(BT_STACK_INC)
44 #INCLUDES = $(BT_SMALLTOOTH_INV)
47 # Add or subtract whatever MSPGCC flags you want. There are plenty more
48 #######################################################################################
49 CFLAGS = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG)
50 ASFLAGS = -mmcu=$(MCU) $(MEMMODEL) -x assembler-with-cpp -Wa,-gstabs
51 LDFLAGS = -mmcu=$(MCU) $(MEMMODEL) -Wl,-gc-sections -Wl,-Map=$(TARGET).map
52 ########################################################################################
59 OBJCOPY = msp430-objcopy
60 RANLIB = msp430-ranlib
63 READELF = msp430-readelf
68 ########################################################################################
69 # the file which will include dependencies
70 DEPEND = $(SOURCES:.c=.d)
72 # all the object files
73 OBJECTS = $(SOURCES:.c=.o)
75 all: $(TARGET).elf $(TARGET).hex $(TARGET).txt
78 mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex"
80 prog_watch: $(TARGET).hex
81 mspdebug rf2500 -v 2500 "prog $(TARGET).hex"
83 $(TARGET).elf: $(OBJECTS)
85 $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
87 echo ">>>> Size of Firmware <<<<"
92 $(OBJCOPY) -O ihex $< $@
95 $(MAKETXT) -O $@ -TITXT $< -I
96 unix2dos $(TARGET).txt
97 # 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.
101 $(CC) -c $(CFLAGS) -o $@ $<
103 # rule for making assembler source listing, to see the code
105 $(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
107 # include the dependencies unless we're going to clean, then forget about them.
108 ifneq ($(MAKECMDGOALS), clean)
112 # includes also considered, since some of these are our own
113 # (otherwise use -MM instead of -M)
115 echo "Generating dependencies $@ from $<"
116 $(CC) -M ${CFLAGS} $< >$@
123 -$(RM) $(SOURCES:.c=.lst)