8 GOODFET?=/dev/tty.usbser*
10 #For tos-bsl, use --invert-reset --invert-test
11 MSP430BSL?=goodfet.bsl --speed=38400
15 #N.B., gcc WILL NOT BITCH if this file doesn't exist.
19 # We use -Wl,-dT because gcc adds the msp430mcu definitions at the
20 # very end of the command line, so they only have an effect for a
21 # default linker script
23 LDFLAGS?=-mmcu=$(mcu) #-Wl,-dT ldscripts/$(mcu).x
25 CCEXTRA?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) -Dboard=$(board) $(GCCINC) -I include -I platforms
26 CC=$(GCC) -Wall -O1 -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA)
28 # Available Applications
29 # ======================
30 # Below is a list of available applications and their descriptions.
33 # None have made it to production grade quality
36 # monitor -- Basic monitor
37 # spi -- Turns GF into USB-to-SPI adapter
38 # jtag -- Low level JTAG (needed by all other JTAG code)
39 # sbw -- Makes JTAG Spy-by-wire multiplexable
42 # jtag430 -- 16-bit MSP430 JTAG
43 # jtag430x2 -- 20-bit MSP430 JTAG
47 # i2c -- Turns GF into USB-to-i2c adapter
48 # jtagarm7 -- ARM7TDMI JTAG
50 # jtagxscale -- XScale JTAG
51 # openocd -- OpenOCD bitbang device
54 # chipcon -- Chipcon radio 8051 debugging
56 # pic -- PIC24H/dsPIC33F debugger
57 # adc -- ADC10 (still specific to x2274, GoodFET32)
60 # nrf -- Nordic RF SPI
61 # ccspi -- Chipcon SPI
64 # glitch -- Glitch research tool
65 # smartcard -- Smartcard IO
71 # This is what you need to customize to specify which apps you want in your
72 # firmware. The "config" variable is just a space-delimited list of apps you
73 # want included. The makefile will take the list of apps and include all of
74 # the proper code needed to build your desired firmware.
80 # config = monitor jtag
83 # config = monitor chipcon ccspi
86 # config = monitor glitch
89 # config = monitor jtagxscale
91 # OpenOCD bit-bang device
92 #config = monitor openocd
95 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
98 ifeq ($(platform),tilaunchpad)
99 config ?= monitor chipcon i2c
101 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi
105 # Build the needed list of app and lib object files from the config
108 ifeq ($(platform),tilaunchpad)
109 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
112 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o
118 # include monitor app
119 ifeq ($(filter monitor, $(config)), monitor)
120 apps+= apps/monitor/monitor.o
125 ifeq ($(filter spi, $(config)), spi)
126 apps+= apps/spi/spi.o
131 ifeq ($(filter twe, $(config)), twe)
132 apps+= apps/twe/twe.o
136 # include base jtag if they specified it explicitly
137 ifeq ($(filter jtag, $(config)), jtag)
138 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
139 apps+= apps/jtag/jtag.o
144 # include MAX342x USB drivers.
145 ifeq ($(filter maxusb, $(config)), maxusb)
146 ifneq ($(filter apps/usb/maxusb.o, $(apps)), apps/usb/maxusb.o)
147 apps+= apps/usb/maxusb.o
152 # include the sbw defs if they specified it
153 ifeq ($(filter sbw, $(config)), sbw)
154 # if they only specify sbw, include jtag
155 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
156 apps+= apps/jtag/jtag.o
159 apps+= apps/jtag/sbw.o
163 # include jtag430 app
164 ifeq ($(filter jtag430, $(config)), jtag430)
165 # add in base jtag code if not already
166 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
167 apps+= apps/jtag/jtag.o
170 # add in the jtag430asm code if needed
171 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
172 apps+= apps/jtag/jtag430asm.o
174 apps+= apps/jtag/jtag430.o
178 # include jtag430x2 app
179 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
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 jtag430asm.o, $(libs)), jtag430asm.o)
187 libs+= apps/jtag/jtag430asm.o
189 #add in the jtag430 app if not already
190 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
191 apps+= apps/jtag/jtag430.o
194 apps+= apps/jtag/jtag430x2.o
199 ifeq ($(filter i2c, $(config)), i2c)
200 apps+= apps/i2c/i2c.o
204 # include jtagarm7 app
205 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
206 # add in base jtag code if not already
207 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
208 apps+= apps/jtag/jtag.o
211 apps+= apps/jtag/jtagarm7.o
215 # include jtagarm7tdmi app
216 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
217 # add in base jtag code if not already
218 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
219 #apps+= apps/jtag/jtag.o
222 #apps+= apps/jtag/jtagarm7tdmi.o
223 #hdrs+= jtagarm7tdmi.h
227 ifeq ($(filter ejtag, $(config)), ejtag)
228 # add in base jtag code if not already
229 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
230 apps+= apps/jtag/jtag.o
233 apps+= apps/jtag/ejtag.o
237 # include jtagxscale app
238 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
239 # add in base jtag code if not already
240 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
241 apps+= apps/jtag/jtag.o
244 apps+= apps/jtag/jtagxscale.o
248 # include openocd app
249 ifeq ($(filter openocd, $(config)), openocd)
250 # add in base jtag code if not already
251 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
252 apps+= apps/jtag/jtag.o
255 apps+= apps/jtag/openocd.o
259 # include chipcon app
260 ifeq ($(filter chipcon, $(config)), chipcon)
261 apps+= apps/chipcon/chipcon.o
266 ifeq ($(filter avr, $(config)), avr)
267 apps+= apps/avr/avr.o
272 ifeq ($(filter pic, $(config)), pic)
273 apps+= apps/pic/pic.o
278 ifeq ($(filter adc, $(config)), adc)
279 ifeq ($(mcu), msp430f2274)
280 apps+= apps/adc/adc.o
283 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
287 # include chipcon radio spi app
288 ifeq ($(filter ccspi, $(config)), ccspi)
289 apps+= apps/radios/ccspi.o
294 ifeq ($(filter nrf, $(config)), nrf)
295 apps+= apps/radios/nrf.o
300 ifeq ($(filter glitch, $(config)), glitch)
301 apps+= apps/glitch/glitch.o
305 # include smartcard app
306 ifeq ($(filter smartcard, $(config)), smartcard)
307 apps+= apps/smartcard/smartcard.o
312 ifeq ($(filter ps2, $(config)), ps2)
313 apps+= apps/plugins/ps2.o
318 ifeq ($(filter jscan, $(config)), jscan)
319 apps+= apps/jscan/jscan.o
336 cp platforms/$(platform).h include/config.h
345 ../client/goodfet.msp430 test
347 avrinstall: $(app).hex
349 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
351 ifeq ($(platform),tilaunchpad)
353 $(JTAG) -e -p $(app).hex
355 $(JTAG) -v $(app).hex
357 $(JTAG) -e $(app).hex
360 $(MSP430BSL) -e -p $(app).hex
362 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
364 $(MSP430BSL) -P $(app).hex -v $(app).hex
370 $(MSP430BSL) --dumpinfo
371 $(app).c: config builddate appsfiles err
372 $(app): $(libs) $(apps)
374 ifeq ($(platform),donbfet)
376 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
379 msp430-objcopy goodfet -O ihex goodfet.hex
382 msp430-objdump -D -m msp430 $(app).hex | m4s init
384 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
388 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/