7 ifeq ($(platform),donbfet)
10 CFLAGS=$(DEBUG) -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
15 GOODFET?=/dev/tty.usbser*
18 #BSL?=avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/tty.usbserial-* -U flash:w:blink.hex
19 #For tos-bsl, use --invert-reset --invert-test
20 MSP430BSL?=goodfet.bsl --speed=38400
23 #One of these should be defined explicitly.
24 #Default removed because of confusion.
32 #N.B., gcc WILL NOT BITCH if this file doesn't exist.
36 # We use -Wl,-dT because gcc adds the msp430mcu definitions at the
37 # very end of the command line, so they only have an effect for a
38 # default linker script
40 LDFLAGS?=-Wl,-dT ldscripts/$(mcu).x
42 CCEXTRA?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) $(GCCINC) -I include -I platforms
43 CC=$(GCC) -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA)
45 # Available Applications
46 # ======================
47 # Below is a list of available applications and their descriptions.
50 # None have made it to production grade quality
53 # monitor -- Basic monitor
54 # spi -- Turns GF into USB-to-SPI adapter
55 # jtag -- Low level JTAG (needed by all other JTAG code)
56 # sbw -- Makes JTAG Spy-by-wire multiplexable
59 # jtag430 -- 16-bit MSP430 JTAG
60 # jtag430x2 -- 20-bit MSP430 JTAG
64 # i2c -- Turns GF into USB-to-i2c adapter
65 # jtagarm7 -- ARM7TDMI JTAG
67 # jtagxscale -- XScale JTAG
68 # openocd -- OpenOCD bitbang device
71 # chipcon -- Chipcon radio 8051 debugging
73 # pic -- PIC24H/dsPIC33F debugger
74 # adc -- ADC10 (still specific to x2274, GoodFET32)
77 # nrf -- Nordic RF SPI
78 # ccspi -- Chipcon SPI
81 # glitch -- Glitch research tool
82 # smartcard -- Smartcard IO
88 # This is what you need to customize to specify which apps you want in your
89 # firmware. The "config" variable is just a space-delimited list of apps you
90 # want included. The makefile will take the list of apps and include all of
91 # the proper code needed to build your desired firmware.
97 # config = monitor jtag
100 # config = monitor chipcon ccspi
103 # config = monitor glitch
106 # config = monitor jtagxscale
108 # OpenOCD bit-bang device
109 #config = monitor openocd
112 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
115 ifeq ($(platform),tilaunchpad)
116 config ?= monitor chipcon i2c
118 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
148 ifeq ($(filter twe, $(config)), twe)
149 apps+= apps/twe/twe.o
153 # include base jtag if they specified it explicitly
154 ifeq ($(filter jtag, $(config)), jtag)
155 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
156 apps+= apps/jtag/jtag.o
161 # include the sbw defs if they specified it
162 ifeq ($(filter sbw, $(config)), sbw)
163 # if they only specify sbw, include jtag
164 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
165 apps+= apps/jtag/jtag.o
168 apps+= apps/jtag/sbw.o
172 # include jtag430 app
173 ifeq ($(filter jtag430, $(config)), jtag430)
174 # add in base jtag code if not already
175 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
176 apps+= apps/jtag/jtag.o
179 # add in the jtag430asm code if needed
180 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
181 apps+= apps/jtag/jtag430asm.o
183 apps+= apps/jtag/jtag430.o
187 # include jtag430x2 app
188 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
189 # add in base jtag code if not already
190 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
191 apps+= apps/jtag/jtag.o
194 # add in the jtag430asm code if needed
195 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
196 libs+= apps/jtag/jtag430asm.o
198 #add in the jtag430 app if not already
199 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
200 apps+= apps/jtag/jtag430.o
203 apps+= apps/jtag/jtag430x2.o
208 ifeq ($(filter i2c, $(config)), i2c)
209 apps+= apps/i2c/i2c.o
213 # include jtagarm7 app
214 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
215 # add in base jtag code if not already
216 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
217 apps+= apps/jtag/jtag.o
220 apps+= apps/jtag/jtagarm7.o
224 # include jtagarm7tdmi app
225 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
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/jtagarm7tdmi.o
232 #hdrs+= jtagarm7tdmi.h
236 ifeq ($(filter ejtag, $(config)), ejtag)
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/ejtag.o
246 # include jtagxscale app
247 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
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/jtagxscale.o
257 # include openocd app
258 ifeq ($(filter openocd, $(config)), openocd)
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/openocd.o
268 # include chipcon app
269 ifeq ($(filter chipcon, $(config)), chipcon)
270 apps+= apps/chipcon/chipcon.o
275 ifeq ($(filter avr, $(config)), avr)
276 apps+= apps/avr/avr.o
281 ifeq ($(filter pic, $(config)), pic)
282 apps+= apps/pic/pic.o
287 ifeq ($(filter adc, $(config)), adc)
288 ifeq ($(mcu), msp430x2274)
289 apps+= apps/adc/adc.o
292 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
296 # include chipcon radio spi app
297 ifeq ($(filter ccspi, $(config)), ccspi)
298 apps+= apps/radios/ccspi.o
303 ifeq ($(filter nrf, $(config)), nrf)
304 apps+= apps/radios/nrf.o
309 ifeq ($(filter glitch, $(config)), glitch)
310 apps+= apps/glitch/glitch.o
314 # include smartcard app
315 ifeq ($(filter smartcard, $(config)), smartcard)
316 apps+= apps/smartcard/smartcard.o
321 ifeq ($(filter ps2, $(config)), ps2)
322 apps+= apps/plugins/ps2.o
327 ifeq ($(filter jscan, $(config)), jscan)
328 apps+= apps/jscan/jscan.o
345 cp platforms/$(platform).h include/config.h
354 ../client/goodfet.msp430 test
356 avrinstall: $(app).hex
358 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
360 ifeq ($(platform),tilaunchpad)
362 $(JTAG) -e -p $(app).hex
364 $(JTAG) -v $(app).hex
366 $(JTAG) -e $(app).hex
369 $(MSP430BSL) -e -p $(app).hex
371 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
373 $(MSP430BSL) -P $(app).hex -v $(app).hex
379 $(MSP430BSL) --dumpinfo
380 $(app).c: config builddate appsfiles err
381 $(app): $(libs) $(apps)
383 ifeq ($(platform),donbfet)
385 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
388 msp430-objcopy goodfet -O ihex goodfet.hex
391 msp430-objdump -D -m msp430 $(app).hex | m4s init
393 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
397 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/