8 GOODFET?=/dev/tty.usbser*
10 #For tos-bsl, use --invert-reset --invert-test
11 MSP430BSL?=goodfet.bsl --speed=38400
17 #All of these are ?= in order ot allow overriding.
18 GCC?=msp430-gcc -mmcu=$(mcu)
19 LDFLAGS?=-mmcu=$(mcu) #-Wl,-dT ldscripts/$(mcu).x
21 CCEXTRA ?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) -Dboard=$(board) $(GCCINC) -I include -I platforms
22 CC =$(GCC) -Wall -O1 -fno-strict-aliasing -g $(CCEXTRA)
24 # Available Applications
25 # ======================
26 # Below is a list of available applications and their descriptions.
29 # None have made it to production grade quality
32 # monitor -- Basic monitor
33 # spi -- Turns GF into USB-to-SPI adapter
34 # jtag -- Low level JTAG (needed by all other JTAG code)
35 # sbw -- Makes JTAG Spy-by-wire multiplexable
38 # jtag430 -- 16-bit MSP430 JTAG
39 # jtag430x2 -- 20-bit MSP430 JTAG
43 # i2c -- Turns GF into USB-to-i2c adapter
44 # jtagarm7 -- ARM7TDMI JTAG
46 # jtagxscale -- XScale JTAG
47 # openocd -- OpenOCD bitbang device
50 # chipcon -- Chipcon radio 8051 debugging
52 # pic -- PIC24H/dsPIC33F debugger
53 # adc -- ADC10 (still specific to x2274, GoodFET32)
56 # nrf -- Nordic RF SPI
57 # ccspi -- Chipcon SPI
60 # glitch -- Glitch research tool
61 # smartcard -- Smartcard IO
67 # This is what you need to customize to specify which apps you want in your
68 # firmware. The "config" variable is just a space-delimited list of apps you
69 # want included. The makefile will take the list of apps and include all of
70 # the proper code needed to build your desired firmware.
76 # config = monitor jtag
79 # config = monitor chipcon ccspi
82 # config = monitor glitch
85 # config = monitor jtagxscale
87 # OpenOCD bit-bang device
88 #config = monitor openocd
91 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
94 ifeq ($(platform),tilaunchpad)
95 config ?= monitor chipcon i2c
97 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi maxusb
101 # Build the needed list of app and lib object files from the config
104 ifeq ($(platform),tilaunchpad)
105 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
108 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o
114 # include monitor app
115 ifeq ($(filter monitor, $(config)), monitor)
116 apps+= apps/monitor/monitor.o
121 ifeq ($(filter spi, $(config)), spi)
122 apps+= apps/spi/spi.o
127 ifeq ($(filter twe, $(config)), twe)
128 apps+= apps/twe/twe.o
132 # include base jtag if they specified it explicitly
133 ifeq ($(filter jtag, $(config)), jtag)
134 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
135 apps+= apps/jtag/jtag.o
140 # include MAX342x USB drivers.
141 ifeq ($(filter maxusb, $(config)), maxusb)
142 ifneq ($(filter apps/usb/maxusb.o, $(apps)), apps/usb/maxusb.o)
143 apps+= apps/usb/maxusb.o
148 # include the sbw defs if they specified it
149 ifeq ($(filter sbw, $(config)), sbw)
150 # if they only specify sbw, include jtag
151 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
152 apps+= apps/jtag/jtag.o
155 apps+= apps/jtag/sbw.o
159 # include jtag430 app
160 ifeq ($(filter jtag430, $(config)), jtag430)
161 # add in base jtag code if not already
162 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
163 apps+= apps/jtag/jtag.o
166 # add in the jtag430asm code if needed
167 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
168 apps+= apps/jtag/jtag430asm.o
170 apps+= apps/jtag/jtag430.o
174 # include jtag430x2 app
175 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
176 # add in base jtag code if not already
177 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
178 apps+= apps/jtag/jtag.o
181 # add in the jtag430asm code if needed
182 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
183 libs+= apps/jtag/jtag430asm.o
185 #add in the jtag430 app if not already
186 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
187 apps+= apps/jtag/jtag430.o
190 apps+= apps/jtag/jtag430x2.o
195 ifeq ($(filter i2c, $(config)), i2c)
196 apps+= apps/i2c/i2c.o
200 # include jtagarm7 app
201 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
202 # add in base jtag code if not already
203 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
204 apps+= apps/jtag/jtag.o
207 apps+= apps/jtag/jtagarm7.o
211 # include jtagarm7tdmi app
212 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
213 # add in base jtag code if not already
214 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
215 #apps+= apps/jtag/jtag.o
218 #apps+= apps/jtag/jtagarm7tdmi.o
219 #hdrs+= jtagarm7tdmi.h
223 ifeq ($(filter ejtag, $(config)), ejtag)
224 # add in base jtag code if not already
225 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
226 apps+= apps/jtag/jtag.o
229 apps+= apps/jtag/ejtag.o
233 # include jtagxscale app
234 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
235 # add in base jtag code if not already
236 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
237 apps+= apps/jtag/jtag.o
240 apps+= apps/jtag/jtagxscale.o
244 # include openocd app
245 ifeq ($(filter openocd, $(config)), openocd)
246 # add in base jtag code if not already
247 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
248 apps+= apps/jtag/jtag.o
251 apps+= apps/jtag/openocd.o
255 # include chipcon app
256 ifeq ($(filter chipcon, $(config)), chipcon)
257 apps+= apps/chipcon/chipcon.o
262 ifeq ($(filter avr, $(config)), avr)
263 apps+= apps/avr/avr.o
268 ifeq ($(filter pic, $(config)), pic)
269 apps+= apps/pic/pic.o
274 ifeq ($(filter adc, $(config)), adc)
275 ifeq ($(mcu), msp430f2274)
276 apps+= apps/adc/adc.o
279 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
283 # include chipcon radio spi app
284 ifeq ($(filter ccspi, $(config)), ccspi)
285 apps+= apps/radios/ccspi.o
290 ifeq ($(filter nrf, $(config)), nrf)
291 apps+= apps/radios/nrf.o
296 ifeq ($(filter glitch, $(config)), glitch)
297 apps+= apps/glitch/glitch.o
301 # include smartcard app
302 ifeq ($(filter smartcard, $(config)), smartcard)
303 apps+= apps/smartcard/smartcard.o
308 ifeq ($(filter ps2, $(config)), ps2)
309 apps+= apps/plugins/ps2.o
314 ifeq ($(filter jscan, $(config)), jscan)
315 apps+= apps/jscan/jscan.o
332 cp platforms/$(platform).h include/config.h
341 ../client/goodfet.msp430 test
343 avrinstall: $(app).hex
345 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
347 ifeq ($(platform),tilaunchpad)
349 $(JTAG) -e -p $(app).hex
351 $(JTAG) -v $(app).hex
353 $(JTAG) -e $(app).hex
356 $(MSP430BSL) -e -p $(app).hex
358 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
360 $(MSP430BSL) -P $(app).hex -v $(app).hex
366 $(MSP430BSL) --dumpinfo
367 $(app).c: config builddate appsfiles err
368 $(app): $(libs) $(apps)
370 ifeq ($(platform),donbfet)
372 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
375 msp430-objcopy goodfet -O ihex goodfet.hex
378 msp430-objdump -D -m msp430 $(app).hex | m4s init
380 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
384 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/