13 ifeq ($(platform),donbfet)
16 CFLAGS=$(DEBUG) -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
19 ifeq ($(platform),tilaunchpad)
21 CFLAGS+=-DDEBUG_LEVEL=3 -DDEBUG_START=1 -DINBAND_DEBUG
26 GOODFET?=/dev/tty.usbser*
29 #BSL?=avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/tty.usbserial-* -U flash:w:blink.hex
30 #For tos-bsl, use --invert-reset --invert-test
31 MSP430BSL?=goodfet.bsl --speed=38400
34 #One of these should be defined explicitly.
35 #Default removed because of confusion.
43 #N.B., gcc WILL NOT BITCH if this file doesn't exist.
47 GCC?=msp430-gcc -T ldscripts/$(mcu).x
49 CCEXTRA?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) -DGCC $(GCCINC) -I include -I platforms
50 CC=$(GCC) -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA)
52 # Available Applications
53 # ======================
54 # Below is a list of available applications and their descriptions.
57 # None have made it to production grade quality
60 # monitor -- Basic monitor
61 # spi -- Turns GF into USB-to-SPI adapter
62 # jtag -- Low level JTAG (needed by all other JTAG code)
63 # sbw -- Makes JTAG Spy-by-wire multiplexable
66 # jtag430 -- 16-bit MSP430 JTAG
67 # jtag430x2 -- 20-bit MSP430 JTAG
71 # i2c -- Turns GF into USB-to-i2c adapter
72 # jtagarm7 -- ARM7TDMI JTAG
74 # jtagxscale -- XScale JTAG
75 # openocd -- OpenOCD bitbang device
78 # chipcon -- Chipcon radio 8051 debugging
80 # pic -- PIC24H/dsPIC33F debugger
81 # adc -- ADC10 (still specific to x2274, GoodFET32)
84 # nrf -- Nordic RF SPI
85 # ccspi -- Chipcon SPI
88 # glitch -- Glitch research tool
89 # smartcard -- Smartcard IO
95 # This is what you need to customize to specify which apps you want in your
96 # firmware. The "config" variable is just a space-delimited list of apps you
97 # want included. The makefile will take the list of apps and include all of
98 # the proper code needed to build your desired firmware.
104 # config = monitor jtag
107 # config = monitor chipcon ccspi
110 # config = monitor glitch
113 # config = monitor jtagxscale
115 # OpenOCD bit-bang device
116 #config = monitor openocd
119 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
122 ifeq ($(platform),tilaunchpad)
123 config ?= monitor chipcon i2c
125 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi
129 ifeq ($(platform),donbfet)
130 config=monitor avr spi jscan
133 # Build the needed list of app and lib object files from the config
136 ifeq ($(platform),tilaunchpad)
137 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
140 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o
146 # include monitor app
147 ifeq ($(filter monitor, $(config)), monitor)
148 apps+= apps/monitor/monitor.o
153 ifeq ($(filter spi, $(config)), spi)
154 apps+= apps/spi/spi.o
159 ifeq ($(filter twe, $(config)), twe)
160 apps+= apps/twe/twe.o
164 # include base jtag if they specified it explicitly
165 ifeq ($(filter jtag, $(config)), jtag)
166 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
167 apps+= apps/jtag/jtag.o
172 # include the sbw defs if they specified it
173 ifeq ($(filter sbw, $(config)), sbw)
174 # if they only specify sbw, include jtag
175 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
176 apps+= apps/jtag/jtag.o
179 apps+= apps/jtag/sbw.o
183 # include jtag430 app
184 ifeq ($(filter jtag430, $(config)), jtag430)
185 # add in base jtag code if not already
186 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
187 apps+= apps/jtag/jtag.o
190 # add in the jtag430asm code if needed
191 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
192 apps+= apps/jtag/jtag430asm.o
194 apps+= apps/jtag/jtag430.o
198 # include jtag430x2 app
199 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
200 # add in base jtag code if not already
201 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
202 apps+= apps/jtag/jtag.o
205 # add in the jtag430asm code if needed
206 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
207 libs+= apps/jtag/jtag430asm.o
209 #add in the jtag430 app if not already
210 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
211 apps+= apps/jtag/jtag430.o
214 apps+= apps/jtag/jtag430x2.o
219 ifeq ($(filter i2c, $(config)), i2c)
220 apps+= apps/i2c/i2c.o
224 # include jtagarm7 app
225 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
226 # add in base jtag code if not already
227 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
228 apps+= apps/jtag/jtag.o
231 apps+= apps/jtag/jtagarm7.o
235 # include jtagarm7tdmi app
236 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
237 # add in base jtag code if not already
238 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
239 #apps+= apps/jtag/jtag.o
242 #apps+= apps/jtag/jtagarm7tdmi.o
243 #hdrs+= jtagarm7tdmi.h
247 ifeq ($(filter ejtag, $(config)), ejtag)
248 # add in base jtag code if not already
249 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
250 apps+= apps/jtag/jtag.o
253 apps+= apps/jtag/ejtag.o
257 # include jtagxscale app
258 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
259 # add in base jtag code if not already
260 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
261 apps+= apps/jtag/jtag.o
264 apps+= apps/jtag/jtagxscale.o
268 # include openocd app
269 ifeq ($(filter openocd, $(config)), openocd)
270 # add in base jtag code if not already
271 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
272 apps+= apps/jtag/jtag.o
275 apps+= apps/jtag/openocd.o
279 # include chipcon app
280 ifeq ($(filter chipcon, $(config)), chipcon)
281 apps+= apps/chipcon/chipcon.o
286 ifeq ($(filter avr, $(config)), avr)
287 apps+= apps/avr/avr.o
292 ifeq ($(filter pic, $(config)), pic)
293 apps+= apps/pic/pic.o
298 ifeq ($(filter adc, $(config)), adc)
299 ifeq ($(mcu), msp430x2274)
300 apps+= apps/adc/adc.o
303 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
307 # include chipcon radio spi app
308 ifeq ($(filter ccspi, $(config)), ccspi)
309 apps+= apps/radios/ccspi.o
314 ifeq ($(filter nrf, $(config)), nrf)
315 apps+= apps/radios/nrf.o
320 ifeq ($(filter glitch, $(config)), glitch)
321 apps+= apps/glitch/glitch.o
325 # include smartcard app
326 ifeq ($(filter smartcard, $(config)), smartcard)
327 apps+= apps/smartcard/smartcard.o
332 ifeq ($(filter ps2, $(config)), ps2)
333 apps+= apps/plugins/ps2.o
338 ifeq ($(filter jscan, $(config)), jscan)
339 apps+= apps/jscan/jscan.o
356 cp platforms/$(platform).h include/config.h
365 ../client/goodfet.msp430 test
367 avrinstall: $(app).hex
369 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
371 ifeq ($(platform),tilaunchpad)
373 $(JTAG) -e -p $(app).hex
375 $(JTAG) -v $(app).hex
377 $(JTAG) -e $(app).hex
380 $(MSP430BSL) -e -p $(app).hex
382 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
384 $(MSP430BSL) -P $(app).hex -v $(app).hex
387 $(MSP430BSL) --dumpinfo
390 $(app).c: config builddate appsfiles err
391 $(app): $(libs) $(apps)
393 ifeq ($(platform),donbfet)
395 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
398 msp430-objcopy goodfet -O ihex goodfet.hex
401 msp430-objdump -D -m msp430 $(app).hex | m4s init
403 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
407 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/