13 ifeq ($(platform),tilaunchpad)
15 CFLAGS+=-DDEBUG_LEVEL=3 -DDEBUG_START=1 -DINBAND_DEBUG
20 GOODFET?=/dev/tty.usbser*
23 #BSL?=avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/tty.usbserial-* -U flash:w:blink.hex
24 #For tos-bsl, use --invert-reset --invert-test
25 MSP430BSL?=goodfet.bsl --speed=38400
28 #One of these should be defined explicitly.
29 #Default removed because of confusion.
37 #N.B., gcc WILL NOT BITCH if this file doesn't exist.
41 GCC?=msp430-gcc -T ldscripts/$(mcu).x
43 CCEXTRA?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) -DGCC $(GCCINC) -I include -I platforms
44 CC=$(GCC) -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA)
46 # Available Applications
47 # ======================
48 # Below is a list of available applications and their descriptions.
51 # None have made it to production grade quality
54 # monitor -- Basic monitor
55 # spi -- Turns GF into USB-to-SPI adapter
56 # jtag -- Low level JTAG (needed by all other JTAG code)
57 # sbw -- Makes JTAG Spy-by-wire multiplexable
60 # jtag430 -- 16-bit MSP430 JTAG
61 # jtag430x2 -- 20-bit MSP430 JTAG
65 # i2c -- Turns GF into USB-to-i2c adapter
66 # jtagarm7 -- ARM7TDMI JTAG
68 # jtagxscale -- XScale JTAG
69 # openocd -- OpenOCD bitbang device
72 # chipcon -- Chipcon radio 8051 debugging
74 # pic -- PIC24H/dsPIC33F debugger
75 # adc -- ADC10 (still specific to x2274, GoodFET32)
78 # nrf -- Nordic RF SPI
79 # ccspi -- Chipcon SPI
82 # glitch -- Glitch research tool
83 # smartcard -- Smartcard IO
89 # This is what you need to customize to specify which apps you want in your
90 # firmware. The "config" variable is just a space-delimited list of apps you
91 # want included. The makefile will take the list of apps and include all of
92 # the proper code needed to build your desired firmware.
98 # config = monitor jtag
101 # config = monitor chipcon ccspi
104 # config = monitor glitch
107 # config = monitor jtagxscale
109 # OpenOCD bit-bang device
110 #config = monitor openocd
113 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
116 ifeq ($(platform),tilaunchpad)
117 config ?= monitor chipcon i2c
119 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi
122 # Build the needed list of app and lib object files from the config
125 ifeq ($(platform),tilaunchpad)
126 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
129 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o
135 # include monitor app
136 ifeq ($(filter monitor, $(config)), monitor)
137 apps+= apps/monitor/monitor.o
142 ifeq ($(filter spi, $(config)), spi)
143 apps+= apps/spi/spi.o
147 # include base jtag if they specified it explicitly
148 ifeq ($(filter jtag, $(config)), jtag)
149 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
150 apps+= apps/jtag/jtag.o
155 # include the sbw defs if they specified it
156 ifeq ($(filter sbw, $(config)), sbw)
157 # if they only specify sbw, include jtag
158 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
159 apps+= apps/jtag/jtag.o
162 apps+= apps/jtag/sbw.o
166 # include jtag430 app
167 ifeq ($(filter jtag430, $(config)), jtag430)
168 # add in base jtag code if not already
169 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
170 apps+= apps/jtag/jtag.o
173 # add in the jtag430asm code if needed
174 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
175 apps+= apps/jtag/jtag430asm.o
177 apps+= apps/jtag/jtag430.o
181 # include jtag430x2 app
182 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
183 # add in base jtag code if not already
184 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
185 apps+= apps/jtag/jtag.o
188 # add in the jtag430asm code if needed
189 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
190 libs+= apps/jtag/jtag430asm.o
192 #add in the jtag430 app if not already
193 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
194 apps+= apps/jtag/jtag430.o
197 apps+= apps/jtag/jtag430x2.o
202 ifeq ($(filter i2c, $(config)), i2c)
203 apps+= apps/i2c/i2c.o
207 # include jtagarm7 app
208 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
209 # add in base jtag code if not already
210 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
211 apps+= apps/jtag/jtag.o
214 apps+= apps/jtag/jtagarm7.o
218 # include jtagarm7tdmi app
219 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
220 # add in base jtag code if not already
221 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
222 #apps+= apps/jtag/jtag.o
225 #apps+= apps/jtag/jtagarm7tdmi.o
226 #hdrs+= jtagarm7tdmi.h
230 ifeq ($(filter ejtag, $(config)), ejtag)
231 # add in base jtag code if not already
232 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
233 apps+= apps/jtag/jtag.o
236 apps+= apps/jtag/ejtag.o
240 # include jtagxscale app
241 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
242 # add in base jtag code if not already
243 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
244 apps+= apps/jtag/jtag.o
247 apps+= apps/jtag/jtagxscale.o
251 # include openocd app
252 ifeq ($(filter openocd, $(config)), openocd)
253 # add in base jtag code if not already
254 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
255 apps+= apps/jtag/jtag.o
258 apps+= apps/jtag/openocd.o
262 # include chipcon app
263 ifeq ($(filter chipcon, $(config)), chipcon)
264 apps+= apps/chipcon/chipcon.o
269 ifeq ($(filter avr, $(config)), avr)
270 apps+= apps/avr/avr.o
275 ifeq ($(filter pic, $(config)), pic)
276 apps+= apps/pic/pic.o
281 ifeq ($(filter adc, $(config)), adc)
282 ifeq ($(mcu), msp430x2274)
283 apps+= apps/adc/adc.o
286 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
290 # include chipcon radio spi app
291 ifeq ($(filter ccspi, $(config)), ccspi)
292 apps+= apps/radios/ccspi.o
297 ifeq ($(filter nrf, $(config)), nrf)
298 apps+= apps/radios/nrf.o
303 ifeq ($(filter glitch, $(config)), glitch)
304 apps+= apps/glitch/glitch.o
308 # include smartcard app
309 ifeq ($(filter smartcard, $(config)), smartcard)
310 apps+= apps/smartcard/smartcard.o
315 ifeq ($(filter ps2, $(config)), ps2)
316 apps+= apps/plugins/ps2.o
333 cp platforms/$(platform).h include/config.h
342 ../client/goodfet.msp430 test
344 avrinstall: $(app).hex
346 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
348 ifeq ($(platform),tilaunchpad)
350 $(JTAG) -e -p $(app).hex
352 $(JTAG) -v $(app).hex
354 $(JTAG) -e $(app).hex
357 $(MSP430BSL) -e -p $(app).hex
359 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
361 $(MSP430BSL) -P $(app).hex -v $(app).hex
364 $(MSP430BSL) --dumpinfo
367 $(app).c: config builddate appsfiles err
368 $(app): $(libs) $(apps)
370 msp430-objcopy goodfet -O ihex goodfet.hex
372 msp430-objdump -D -m msp430 $(app).hex | m4s init
374 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
378 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/