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 # BUILDNO = \"\#$(shell cat .buildno)-$(shell date +%y%m%d)\"
52 BUILDNO = \"$(shell date +%y%m%d)-\#$(shell cat .buildno)\"
54 # Add or subtract whatever MSPGCC flags you want. There are plenty more
55 #######################################################################################
56 CFLAGS = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG) -DBUILDNO=$(BUILDNO)
57 ASFLAGS = -mmcu=$(MCU) $(MEMMODEL) -x assembler-with-cpp -Wa,-gstabs
58 LDFLAGS = -mmcu=$(MCU) $(MEMMODEL) -Wl,-gc-sections -Wl,-Map=$(TARGET).map
59 ########################################################################################
66 OBJCOPY = msp430-objcopy
67 RANLIB = msp430-ranlib
70 READELF = msp430-readelf
75 ########################################################################################
76 # the file which will include dependencies
77 DEPEND = $(SOURCES:.c=.d)
79 # all the object files
80 OBJECTS = $(SOURCES:.c=.o)
82 all: .buildno $(TARGET).elf $(TARGET).hex $(TARGET).txt
85 mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex"
87 prog_watch: $(TARGET).hex
88 mspdebug rf2500 -v 2500 "prog $(TARGET).hex"
90 $(TARGET).elf: $(OBJECTS)
92 $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
94 echo ">>>> Size of Firmware <<<<"
99 $(OBJCOPY) -O ihex $< $@
102 $(MAKETXT) -O $@ -TITXT $< -I
103 unix2dos $(TARGET).txt
104 # 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.
108 $(CC) -c $(CFLAGS) -o $@ $<
110 # rule for making assembler source listing, to see the code
112 $(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
114 # include the dependencies unless we're going to clean, then forget about them.
115 ifneq ($(MAKECMDGOALS), clean)
119 # includes also considered, since some of these are our own
120 # (otherwise use -MM instead of -M)
122 echo "Generating dependencies $@ from $<"
123 $(CC) -M ${CFLAGS} $< >$@
130 -$(RM) $(SOURCES:.c=.lst)
134 @if ! test -f .buildno; then echo 0 > .buildno; fi
135 @echo $$(($$(cat .buildno) + 1)) > .buildno