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 ../ui/Fonts.c ../ui/LcdDisplay.c \
29 ../ui/oswald_strings.c ../ui/calendar.c \
32 SOURCES = mw_main.c mw_uart.c mw_lcd.c mw_adc.c mw_bt.c \
33 bluetooth_init_cc2560_2.44.c \
35 oswald_hal.c $(OSWALD_SRC)
36 # $(BT_SMALLTOOTH_SRC)
39 #BT_STACK_INC = -Ibtstack/ -Ibtstack/include/
40 #BT_SMALLTOOTH_INV = -IBluetooth/
41 # Include are located in the Include directory
42 #INCLUDES = $(BT_STACK_INC)
43 #INCLUDES = $(BT_SMALLTOOTH_INV)
44 INCLUDES = -I../ui/ -I../ui/bitmaps/
46 # Add or subtract whatever MSPGCC flags you want. There are plenty more
47 #######################################################################################
48 CFLAGS = -mmcu=$(MCU) $(MEMMODEL) -g -Os -Wall -Wunused $(INCLUDES) $(APPCONFIG)
49 ASFLAGS = -mmcu=$(MCU) $(MEMMODEL) -x assembler-with-cpp -Wa,-gstabs
50 LDFLAGS = -mmcu=$(MCU) $(MEMMODEL) -Wl,-gc-sections -Wl,-Map=$(TARGET).map
51 ########################################################################################
58 OBJCOPY = msp430-objcopy
59 RANLIB = msp430-ranlib
62 READELF = msp430-readelf
67 ########################################################################################
68 # the file which will include dependencies
69 DEPEND = $(SOURCES:.c=.d)
71 # all the object files
72 OBJECTS = $(SOURCES:.c=.o)
74 all: $(TARGET).elf $(TARGET).hex $(TARGET).txt
77 mspdebug tilib -d /dev/ttyACM3 -v 2500 "prog $(TARGET).hex"
79 prog_watch: $(TARGET).hex
80 mspdebug rf2500 -v 2500 "prog $(TARGET).hex"
82 $(TARGET).elf: $(OBJECTS)
84 $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
86 echo ">>>> Size of Firmware <<<<"
91 $(OBJCOPY) -O ihex $< $@
94 $(MAKETXT) -O $@ -TITXT $< -I
95 unix2dos $(TARGET).txt
96 # 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.
100 $(CC) -c $(CFLAGS) -o $@ $<
102 # rule for making assembler source listing, to see the code
104 $(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
106 # include the dependencies unless we're going to clean, then forget about them.
107 ifneq ($(MAKECMDGOALS), clean)
111 # includes also considered, since some of these are our own
112 # (otherwise use -MM instead of -M)
114 echo "Generating dependencies $@ from $<"
115 $(CC) -M ${CFLAGS} $< >$@
122 -$(RM) $(SOURCES:.c=.lst)