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
28 BTCC256x_SCRIPT = bluetooth_init_cc2560_2.44.c
29 #BTCC256x_SCRIPT = bluetooth_init_cc2564_2.8.c
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 \
37 SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \
38 mw_acc.c $(BTCC256x_SCRIPT) \
40 oswald_hal.c $(OSWALD_SRC)
41 # $(BT_SMALLTOOTH_SRC)
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)
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 ########################################################################################
63 OBJCOPY = msp430-objcopy
64 RANLIB = msp430-ranlib
67 READELF = msp430-readelf
72 ########################################################################################
73 # the file which will include dependencies
74 DEPEND = $(SOURCES:.c=.d)
76 # all the object files
77 OBJECTS = $(SOURCES:.c=.o)
79 all: $(TARGET).elf $(TARGET).hex $(TARGET).txt
82 mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex"
84 prog_watch: $(TARGET).hex
85 mspdebug rf2500 -v 2500 "prog $(TARGET).hex"
87 $(TARGET).elf: $(OBJECTS)
89 $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
91 echo ">>>> Size of Firmware <<<<"
96 $(OBJCOPY) -O ihex $< $@
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.
105 $(CC) -c $(CFLAGS) -o $@ $<
107 # rule for making assembler source listing, to see the code
109 $(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
111 # include the dependencies unless we're going to clean, then forget about them.
112 ifneq ($(MAKECMDGOALS), clean)
116 # includes also considered, since some of these are our own
117 # (otherwise use -MM instead of -M)
119 echo "Generating dependencies $@ from $<"
120 $(CC) -M ${CFLAGS} $< >$@
127 -$(RM) $(SOURCES:.c=.lst)