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 the sbw defs if they specified it
145 ifeq ($(filter sbw, $(config)), sbw)
146 # if they only specify sbw, include jtag
147 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
148 apps+= apps/jtag/jtag.o
151 apps+= apps/jtag/sbw.o
155 # include jtag430 app
156 ifeq ($(filter jtag430, $(config)), jtag430)
157 # add in base jtag code if not already
158 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
159 apps+= apps/jtag/jtag.o
162 # add in the jtag430asm code if needed
163 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
164 apps+= apps/jtag/jtag430asm.o
166 apps+= apps/jtag/jtag430.o
170 # include jtag430x2 app
171 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
172 # add in base jtag code if not already
173 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
174 apps+= apps/jtag/jtag.o
177 # add in the jtag430asm code if needed
178 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
179 libs+= apps/jtag/jtag430asm.o
181 #add in the jtag430 app if not already
182 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
183 apps+= apps/jtag/jtag430.o
186 apps+= apps/jtag/jtag430x2.o
191 ifeq ($(filter i2c, $(config)), i2c)
192 apps+= apps/i2c/i2c.o
196 # include jtagarm7 app
197 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
198 # add in base jtag code if not already
199 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
200 apps+= apps/jtag/jtag.o
203 apps+= apps/jtag/jtagarm7.o
207 # include jtagarm7tdmi app
208 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
209 # add in base jtag code if not already
210 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
211 #apps+= apps/jtag/jtag.o
214 #apps+= apps/jtag/jtagarm7tdmi.o
215 #hdrs+= jtagarm7tdmi.h
219 ifeq ($(filter ejtag, $(config)), ejtag)
220 # add in base jtag code if not already
221 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
222 apps+= apps/jtag/jtag.o
225 apps+= apps/jtag/ejtag.o
229 # include jtagxscale app
230 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
231 # add in base jtag code if not already
232 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
233 apps+= apps/jtag/jtag.o
236 apps+= apps/jtag/jtagxscale.o
240 # include openocd app
241 ifeq ($(filter openocd, $(config)), openocd)
242 # add in base jtag code if not already
243 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
244 apps+= apps/jtag/jtag.o
247 apps+= apps/jtag/openocd.o
251 # include chipcon app
252 ifeq ($(filter chipcon, $(config)), chipcon)
253 apps+= apps/chipcon/chipcon.o
258 ifeq ($(filter avr, $(config)), avr)
259 apps+= apps/avr/avr.o
264 ifeq ($(filter pic, $(config)), pic)
265 apps+= apps/pic/pic.o
270 ifeq ($(filter adc, $(config)), adc)
271 ifeq ($(mcu), msp430f2274)
272 apps+= apps/adc/adc.o
275 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
279 # include chipcon radio spi app
280 ifeq ($(filter ccspi, $(config)), ccspi)
281 apps+= apps/radios/ccspi.o
286 ifeq ($(filter nrf, $(config)), nrf)
287 apps+= apps/radios/nrf.o
292 ifeq ($(filter glitch, $(config)), glitch)
293 apps+= apps/glitch/glitch.o
297 # include smartcard app
298 ifeq ($(filter smartcard, $(config)), smartcard)
299 apps+= apps/smartcard/smartcard.o
304 ifeq ($(filter ps2, $(config)), ps2)
305 apps+= apps/plugins/ps2.o
310 ifeq ($(filter jscan, $(config)), jscan)
311 apps+= apps/jscan/jscan.o
328 cp platforms/$(platform).h include/config.h
337 ../client/goodfet.msp430 test
339 avrinstall: $(app).hex
341 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
343 ifeq ($(platform),tilaunchpad)
345 $(JTAG) -e -p $(app).hex
347 $(JTAG) -v $(app).hex
349 $(JTAG) -e $(app).hex
352 $(MSP430BSL) -e -p $(app).hex
354 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
356 $(MSP430BSL) -P $(app).hex -v $(app).hex
362 $(MSP430BSL) --dumpinfo
363 $(app).c: config builddate appsfiles err
364 $(app): $(libs) $(apps)
366 ifeq ($(platform),donbfet)
368 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
371 msp430-objcopy goodfet -O ihex goodfet.hex
374 msp430-objdump -D -m msp430 $(app).hex | m4s init
376 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
380 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/