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 -DMW_DEBUG_UART
24 APPCONFIG = -DDIGITAL -DMW_DIGITAL_V2
26 #BTCC256x_SCRIPT = bluetooth_init_cc2560_2.44.c
27 BTCC256x_SCRIPT = bluetooth_init_cc2564_2.8.c
29 # List all the source files here
30 # eg if you have a source file foo.c then list it here
32 OSWALD_SRC = ../ui/oswald_main.c ../ui/oswald_screens.c \
33 ../ui/oswald_watch_faces.c \
34 ../ui/oswald_strings.c ../ui/calendar.c \
35 ../ui/oswald_graphics.c ../ui/oswald_fonts.c \
38 SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \
39 mw_acc.c $(BTCC256x_SCRIPT) \
41 oswald_hal.c $(OSWALD_SRC) \
42 F5xx_F6xx_Core_Lib/HAL_PMM.c \
43 F5xx_F6xx_Core_Lib/HAL_UCS.c
44 # $(BT_SMALLTOOTH_SRC)
47 #BT_STACK_INC = -Ibtstack/ -Ibtstack/include/
48 #BT_SMALLTOOTH_INV = -IBluetooth/
49 # Include are located in the Include directory
50 #INCLUDES = $(BT_STACK_INC)
51 #INCLUDES = $(BT_SMALLTOOTH_INV)
54 # BUILDNO = \"\#$(shell cat .buildno)-$(shell date +%y%m%d)\"
55 BUILDNO = \"$(shell date +%y%m%d)-\#$(shell cat .buildno)\"
57 # Add or subtract whatever MSPGCC flags you want. There are plenty more
58 #######################################################################################
59 CFLAGS = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG) -DBUILDNO=$(BUILDNO)
60 ASFLAGS = -mmcu=$(MCU) $(MEMMODEL) -x assembler-with-cpp -Wa,-gstabs
61 LDFLAGS = -mmcu=$(MCU) $(MEMMODEL) -Wl,-gc-sections -Wl,-Map=$(TARGET).map
62 ########################################################################################
69 OBJCOPY = msp430-objcopy
70 RANLIB = msp430-ranlib
73 READELF = msp430-readelf
78 ########################################################################################
79 # the file which will include dependencies
80 DEPEND = $(SOURCES:.c=.d)
82 # all the object files
83 OBJECTS = $(SOURCES:.c=.o)
85 all: .buildno $(TARGET).elf $(TARGET).hex $(TARGET).txt
88 mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex"
90 prog_watch: $(TARGET).hex
91 mspdebug rf2500 -v 2500 "prog $(TARGET).hex"
93 $(TARGET).elf: $(OBJECTS)
95 $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
97 echo ">>>> Size of Firmware <<<<"
102 $(OBJCOPY) -O ihex $< $@
105 $(MAKETXT) -O $@ -TITXT $< -I
106 unix2dos $(TARGET).txt
107 # 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.
111 $(CC) -c $(CFLAGS) -o $@ $<
113 # rule for making assembler source listing, to see the code
115 $(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
117 # include the dependencies unless we're going to clean, then forget about them.
118 ifneq ($(MAKECMDGOALS), clean)
122 # includes also considered, since some of these are our own
123 # (otherwise use -MM instead of -M)
125 echo "Generating dependencies $@ from $<"
126 $(CC) -M ${CFLAGS} $< >$@
133 -$(RM) $(SOURCES:.c=.lst)
137 @if ! test -f .buildno; then echo 0 > .buildno; fi
138 @echo $$(($$(cat .buildno) + 1)) > .buildno