8 GOODFET?=/dev/tty.usbser*
10 #For tos-bsl, use --invert-reset --invert-test
11 MSP430BSL?=goodfet.bsl --speed=38400
18 # We use -Wl,-dT because gcc adds the msp430mcu definitions at the
19 # very end of the command line, so they only have an effect for a
20 # default linker script
22 LDFLAGS?=-mmcu=$(mcu) #-Wl,-dT ldscripts/$(mcu).x
24 CCEXTRA?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) -Dboard=$(board) $(GCCINC) -I include -I platforms
25 CC=$(GCC) -Wall -O1 -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA)
27 # Available Applications
28 # ======================
29 # Below is a list of available applications and their descriptions.
32 # None have made it to production grade quality
35 # monitor -- Basic monitor
36 # spi -- Turns GF into USB-to-SPI adapter
37 # jtag -- Low level JTAG (needed by all other JTAG code)
38 # sbw -- Makes JTAG Spy-by-wire multiplexable
41 # jtag430 -- 16-bit MSP430 JTAG
42 # jtag430x2 -- 20-bit MSP430 JTAG
46 # i2c -- Turns GF into USB-to-i2c adapter
47 # jtagarm7 -- ARM7TDMI JTAG
49 # jtagxscale -- XScale JTAG
50 # openocd -- OpenOCD bitbang device
53 # chipcon -- Chipcon radio 8051 debugging
55 # pic -- PIC24H/dsPIC33F debugger
56 # adc -- ADC10 (still specific to x2274, GoodFET32)
59 # nrf -- Nordic RF SPI
60 # ccspi -- Chipcon SPI
63 # glitch -- Glitch research tool
64 # smartcard -- Smartcard IO
70 # This is what you need to customize to specify which apps you want in your
71 # firmware. The "config" variable is just a space-delimited list of apps you
72 # want included. The makefile will take the list of apps and include all of
73 # the proper code needed to build your desired firmware.
79 # config = monitor jtag
82 # config = monitor chipcon ccspi
85 # config = monitor glitch
88 # config = monitor jtagxscale
90 # OpenOCD bit-bang device
91 #config = monitor openocd
94 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
97 ifeq ($(platform),tilaunchpad)
98 config ?= monitor chipcon i2c
100 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi maxusb
104 # Build the needed list of app and lib object files from the config
107 ifeq ($(platform),tilaunchpad)
108 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
111 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o
117 # include monitor app
118 ifeq ($(filter monitor, $(config)), monitor)
119 apps+= apps/monitor/monitor.o
124 ifeq ($(filter spi, $(config)), spi)
125 apps+= apps/spi/spi.o
130 ifeq ($(filter twe, $(config)), twe)
131 apps+= apps/twe/twe.o
135 # include base jtag if they specified it explicitly
136 ifeq ($(filter jtag, $(config)), jtag)
137 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
138 apps+= apps/jtag/jtag.o
143 # include MAX342x USB drivers.
144 ifeq ($(filter maxusb, $(config)), maxusb)
145 ifneq ($(filter apps/usb/maxusb.o, $(apps)), apps/usb/maxusb.o)
146 apps+= apps/usb/maxusb.o
151 # include the sbw defs if they specified it
152 ifeq ($(filter sbw, $(config)), sbw)
153 # if they only specify sbw, include jtag
154 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
155 apps+= apps/jtag/jtag.o
158 apps+= apps/jtag/sbw.o
162 # include jtag430 app
163 ifeq ($(filter jtag430, $(config)), jtag430)
164 # add in base jtag code if not already
165 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
166 apps+= apps/jtag/jtag.o
169 # add in the jtag430asm code if needed
170 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
171 apps+= apps/jtag/jtag430asm.o
173 apps+= apps/jtag/jtag430.o
177 # include jtag430x2 app
178 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
179 # add in base jtag code if not already
180 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
181 apps+= apps/jtag/jtag.o
184 # add in the jtag430asm code if needed
185 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
186 libs+= apps/jtag/jtag430asm.o
188 #add in the jtag430 app if not already
189 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
190 apps+= apps/jtag/jtag430.o
193 apps+= apps/jtag/jtag430x2.o
198 ifeq ($(filter i2c, $(config)), i2c)
199 apps+= apps/i2c/i2c.o
203 # include jtagarm7 app
204 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
205 # add in base jtag code if not already
206 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
207 apps+= apps/jtag/jtag.o
210 apps+= apps/jtag/jtagarm7.o
214 # include jtagarm7tdmi app
215 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
216 # add in base jtag code if not already
217 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
218 #apps+= apps/jtag/jtag.o
221 #apps+= apps/jtag/jtagarm7tdmi.o
222 #hdrs+= jtagarm7tdmi.h
226 ifeq ($(filter ejtag, $(config)), ejtag)
227 # add in base jtag code if not already
228 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
229 apps+= apps/jtag/jtag.o
232 apps+= apps/jtag/ejtag.o
236 # include jtagxscale app
237 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
238 # add in base jtag code if not already
239 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
240 apps+= apps/jtag/jtag.o
243 apps+= apps/jtag/jtagxscale.o
247 # include openocd app
248 ifeq ($(filter openocd, $(config)), openocd)
249 # add in base jtag code if not already
250 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
251 apps+= apps/jtag/jtag.o
254 apps+= apps/jtag/openocd.o
258 # include chipcon app
259 ifeq ($(filter chipcon, $(config)), chipcon)
260 apps+= apps/chipcon/chipcon.o
265 ifeq ($(filter avr, $(config)), avr)
266 apps+= apps/avr/avr.o
271 ifeq ($(filter pic, $(config)), pic)
272 apps+= apps/pic/pic.o
277 ifeq ($(filter adc, $(config)), adc)
278 ifeq ($(mcu), msp430f2274)
279 apps+= apps/adc/adc.o
282 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
286 # include chipcon radio spi app
287 ifeq ($(filter ccspi, $(config)), ccspi)
288 apps+= apps/radios/ccspi.o
293 ifeq ($(filter nrf, $(config)), nrf)
294 apps+= apps/radios/nrf.o
299 ifeq ($(filter glitch, $(config)), glitch)
300 apps+= apps/glitch/glitch.o
304 # include smartcard app
305 ifeq ($(filter smartcard, $(config)), smartcard)
306 apps+= apps/smartcard/smartcard.o
311 ifeq ($(filter ps2, $(config)), ps2)
312 apps+= apps/plugins/ps2.o
317 ifeq ($(filter jscan, $(config)), jscan)
318 apps+= apps/jscan/jscan.o
335 cp platforms/$(platform).h include/config.h
344 ../client/goodfet.msp430 test
346 avrinstall: $(app).hex
348 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
350 ifeq ($(platform),tilaunchpad)
352 $(JTAG) -e -p $(app).hex
354 $(JTAG) -v $(app).hex
356 $(JTAG) -e $(app).hex
359 $(MSP430BSL) -e -p $(app).hex
361 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
363 $(MSP430BSL) -P $(app).hex -v $(app).hex
369 $(MSP430BSL) --dumpinfo
370 $(app).c: config builddate appsfiles err
371 $(app): $(libs) $(apps)
373 ifeq ($(platform),donbfet)
375 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
378 msp430-objcopy goodfet -O ihex goodfet.hex
381 msp430-objdump -D -m msp430 $(app).hex | m4s init
383 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
387 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/