13 ifeq ($(platform),donbfet)
16 CFLAGS=$(DEBUG) -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
21 GOODFET?=/dev/tty.usbser*
24 #BSL?=avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/tty.usbserial-* -U flash:w:blink.hex
25 #For tos-bsl, use --invert-reset --invert-test
26 MSP430BSL?=goodfet.bsl --speed=38400
29 #One of these should be defined explicitly.
30 #Default removed because of confusion.
38 #N.B., gcc WILL NOT BITCH if this file doesn't exist.
42 # We use -Wl,-dT because gcc adds the msp430mcu definitions at the
43 # very end of the command line, so they only have an effect for a
44 # default linker script
46 LDFLAGS?=-Wl,-dT ldscripts/$(mcu).x
48 CCEXTRA?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) $(GCCINC) -I include -I platforms
49 CC=$(GCC) -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA)
51 # Available Applications
52 # ======================
53 # Below is a list of available applications and their descriptions.
56 # None have made it to production grade quality
59 # monitor -- Basic monitor
60 # spi -- Turns GF into USB-to-SPI adapter
61 # jtag -- Low level JTAG (needed by all other JTAG code)
62 # sbw -- Makes JTAG Spy-by-wire multiplexable
65 # jtag430 -- 16-bit MSP430 JTAG
66 # jtag430x2 -- 20-bit MSP430 JTAG
70 # i2c -- Turns GF into USB-to-i2c adapter
71 # jtagarm7 -- ARM7TDMI JTAG
73 # jtagxscale -- XScale JTAG
74 # openocd -- OpenOCD bitbang device
77 # chipcon -- Chipcon radio 8051 debugging
79 # pic -- PIC24H/dsPIC33F debugger
80 # adc -- ADC10 (still specific to x2274, GoodFET32)
83 # nrf -- Nordic RF SPI
84 # ccspi -- Chipcon SPI
87 # glitch -- Glitch research tool
88 # smartcard -- Smartcard IO
94 # This is what you need to customize to specify which apps you want in your
95 # firmware. The "config" variable is just a space-delimited list of apps you
96 # want included. The makefile will take the list of apps and include all of
97 # the proper code needed to build your desired firmware.
103 # config = monitor jtag
106 # config = monitor chipcon ccspi
109 # config = monitor glitch
112 # config = monitor jtagxscale
114 # OpenOCD bit-bang device
115 #config = monitor openocd
118 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
121 ifeq ($(platform),tilaunchpad)
122 config ?= monitor chipcon i2c
124 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi
128 # Build the needed list of app and lib object files from the config
131 ifeq ($(platform),tilaunchpad)
132 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
135 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o
141 # include monitor app
142 ifeq ($(filter monitor, $(config)), monitor)
143 apps+= apps/monitor/monitor.o
148 ifeq ($(filter spi, $(config)), spi)
149 apps+= apps/spi/spi.o
154 ifeq ($(filter twe, $(config)), twe)
155 apps+= apps/twe/twe.o
159 # include base jtag if they specified it explicitly
160 ifeq ($(filter jtag, $(config)), jtag)
161 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
162 apps+= apps/jtag/jtag.o
167 # include the sbw defs if they specified it
168 ifeq ($(filter sbw, $(config)), sbw)
169 # if they only specify sbw, include jtag
170 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
171 apps+= apps/jtag/jtag.o
174 apps+= apps/jtag/sbw.o
178 # include jtag430 app
179 ifeq ($(filter jtag430, $(config)), jtag430)
180 # add in base jtag code if not already
181 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
182 apps+= apps/jtag/jtag.o
185 # add in the jtag430asm code if needed
186 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
187 apps+= apps/jtag/jtag430asm.o
189 apps+= apps/jtag/jtag430.o
193 # include jtag430x2 app
194 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
195 # add in base jtag code if not already
196 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
197 apps+= apps/jtag/jtag.o
200 # add in the jtag430asm code if needed
201 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
202 libs+= apps/jtag/jtag430asm.o
204 #add in the jtag430 app if not already
205 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
206 apps+= apps/jtag/jtag430.o
209 apps+= apps/jtag/jtag430x2.o
214 ifeq ($(filter i2c, $(config)), i2c)
215 apps+= apps/i2c/i2c.o
219 # include jtagarm7 app
220 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
221 # add in base jtag code if not already
222 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
223 apps+= apps/jtag/jtag.o
226 apps+= apps/jtag/jtagarm7.o
230 # include jtagarm7tdmi app
231 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
232 # add in base jtag code if not already
233 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
234 #apps+= apps/jtag/jtag.o
237 #apps+= apps/jtag/jtagarm7tdmi.o
238 #hdrs+= jtagarm7tdmi.h
242 ifeq ($(filter ejtag, $(config)), ejtag)
243 # add in base jtag code if not already
244 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
245 apps+= apps/jtag/jtag.o
248 apps+= apps/jtag/ejtag.o
252 # include jtagxscale app
253 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
254 # add in base jtag code if not already
255 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
256 apps+= apps/jtag/jtag.o
259 apps+= apps/jtag/jtagxscale.o
263 # include openocd app
264 ifeq ($(filter openocd, $(config)), openocd)
265 # add in base jtag code if not already
266 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
267 apps+= apps/jtag/jtag.o
270 apps+= apps/jtag/openocd.o
274 # include chipcon app
275 ifeq ($(filter chipcon, $(config)), chipcon)
276 apps+= apps/chipcon/chipcon.o
281 ifeq ($(filter avr, $(config)), avr)
282 apps+= apps/avr/avr.o
287 ifeq ($(filter pic, $(config)), pic)
288 apps+= apps/pic/pic.o
293 ifeq ($(filter adc, $(config)), adc)
294 ifeq ($(mcu), msp430x2274)
295 apps+= apps/adc/adc.o
298 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
302 # include chipcon radio spi app
303 ifeq ($(filter ccspi, $(config)), ccspi)
304 apps+= apps/radios/ccspi.o
309 ifeq ($(filter nrf, $(config)), nrf)
310 apps+= apps/radios/nrf.o
315 ifeq ($(filter glitch, $(config)), glitch)
316 apps+= apps/glitch/glitch.o
320 # include smartcard app
321 ifeq ($(filter smartcard, $(config)), smartcard)
322 apps+= apps/smartcard/smartcard.o
327 ifeq ($(filter ps2, $(config)), ps2)
328 apps+= apps/plugins/ps2.o
333 ifeq ($(filter jscan, $(config)), jscan)
334 apps+= apps/jscan/jscan.o
351 cp platforms/$(platform).h include/config.h
360 ../client/goodfet.msp430 test
362 avrinstall: $(app).hex
364 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
366 ifeq ($(platform),tilaunchpad)
368 $(JTAG) -e -p $(app).hex
370 $(JTAG) -v $(app).hex
372 $(JTAG) -e $(app).hex
375 $(MSP430BSL) -e -p $(app).hex
377 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
379 $(MSP430BSL) -P $(app).hex -v $(app).hex
382 $(MSP430BSL) --dumpinfo
385 $(app).c: config builddate appsfiles err
386 $(app): $(libs) $(apps)
388 ifeq ($(platform),donbfet)
390 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
393 msp430-objcopy goodfet -O ihex goodfet.hex
396 msp430-objdump -D -m msp430 $(app).hex | m4s init
398 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
402 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/