13 ifeq ($(platform),donbfet)
16 CFLAGS=$(DEBUG) -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
19 ifeq ($(platform),tilaunchpad)
21 CFLAGS+=-DDEBUG_LEVEL=3 -DDEBUG_START=1 -DINBAND_DEBUG
26 GOODFET?=/dev/tty.usbser*
29 #BSL?=avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/tty.usbserial-* -U flash:w:blink.hex
30 #For tos-bsl, use --invert-reset --invert-test
31 MSP430BSL?=goodfet.bsl --speed=38400
34 #One of these should be defined explicitly.
35 #Default removed because of confusion.
43 #N.B., gcc WILL NOT BITCH if this file doesn't exist.
47 # We use -Wl,-dT because gcc adds the msp430mcu definitions at the
48 # very end of the command line, so they only have an effect for a
49 # default linker script
51 LDFLAGS?=-Wl,-dT ldscripts/msp430.x
53 CCEXTRA?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) $(GCCINC) -I include -I platforms
54 CC=$(GCC) -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA)
56 # Available Applications
57 # ======================
58 # Below is a list of available applications and their descriptions.
61 # None have made it to production grade quality
64 # monitor -- Basic monitor
65 # spi -- Turns GF into USB-to-SPI adapter
66 # jtag -- Low level JTAG (needed by all other JTAG code)
67 # sbw -- Makes JTAG Spy-by-wire multiplexable
70 # jtag430 -- 16-bit MSP430 JTAG
71 # jtag430x2 -- 20-bit MSP430 JTAG
75 # i2c -- Turns GF into USB-to-i2c adapter
76 # jtagarm7 -- ARM7TDMI JTAG
78 # jtagxscale -- XScale JTAG
79 # openocd -- OpenOCD bitbang device
82 # chipcon -- Chipcon radio 8051 debugging
84 # pic -- PIC24H/dsPIC33F debugger
85 # adc -- ADC10 (still specific to x2274, GoodFET32)
88 # nrf -- Nordic RF SPI
89 # ccspi -- Chipcon SPI
92 # glitch -- Glitch research tool
93 # smartcard -- Smartcard IO
99 # This is what you need to customize to specify which apps you want in your
100 # firmware. The "config" variable is just a space-delimited list of apps you
101 # want included. The makefile will take the list of apps and include all of
102 # the proper code needed to build your desired firmware.
108 # config = monitor jtag
111 # config = monitor chipcon ccspi
114 # config = monitor glitch
117 # config = monitor jtagxscale
119 # OpenOCD bit-bang device
120 #config = monitor openocd
123 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
126 ifeq ($(platform),tilaunchpad)
127 config ?= monitor chipcon i2c
129 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi
133 ifeq ($(platform),donbfet)
134 config=monitor avr spi jscan
137 # Build the needed list of app and lib object files from the config
140 ifeq ($(platform),tilaunchpad)
141 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
144 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o
150 # include monitor app
151 ifeq ($(filter monitor, $(config)), monitor)
152 apps+= apps/monitor/monitor.o
157 ifeq ($(filter spi, $(config)), spi)
158 apps+= apps/spi/spi.o
163 ifeq ($(filter twe, $(config)), twe)
164 apps+= apps/twe/twe.o
168 # include base jtag if they specified it explicitly
169 ifeq ($(filter jtag, $(config)), jtag)
170 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
171 apps+= apps/jtag/jtag.o
176 # include the sbw defs if they specified it
177 ifeq ($(filter sbw, $(config)), sbw)
178 # if they only specify sbw, include jtag
179 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
180 apps+= apps/jtag/jtag.o
183 apps+= apps/jtag/sbw.o
187 # include jtag430 app
188 ifeq ($(filter jtag430, $(config)), jtag430)
189 # add in base jtag code if not already
190 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
191 apps+= apps/jtag/jtag.o
194 # add in the jtag430asm code if needed
195 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
196 apps+= apps/jtag/jtag430asm.o
198 apps+= apps/jtag/jtag430.o
202 # include jtag430x2 app
203 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
204 # add in base jtag code if not already
205 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
206 apps+= apps/jtag/jtag.o
209 # add in the jtag430asm code if needed
210 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
211 libs+= apps/jtag/jtag430asm.o
213 #add in the jtag430 app if not already
214 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
215 apps+= apps/jtag/jtag430.o
218 apps+= apps/jtag/jtag430x2.o
223 ifeq ($(filter i2c, $(config)), i2c)
224 apps+= apps/i2c/i2c.o
228 # include jtagarm7 app
229 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
230 # add in base jtag code if not already
231 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
232 apps+= apps/jtag/jtag.o
235 apps+= apps/jtag/jtagarm7.o
239 # include jtagarm7tdmi app
240 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
241 # add in base jtag code if not already
242 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
243 #apps+= apps/jtag/jtag.o
246 #apps+= apps/jtag/jtagarm7tdmi.o
247 #hdrs+= jtagarm7tdmi.h
251 ifeq ($(filter ejtag, $(config)), ejtag)
252 # add in base jtag code if not already
253 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
254 apps+= apps/jtag/jtag.o
257 apps+= apps/jtag/ejtag.o
261 # include jtagxscale app
262 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
263 # add in base jtag code if not already
264 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
265 apps+= apps/jtag/jtag.o
268 apps+= apps/jtag/jtagxscale.o
272 # include openocd app
273 ifeq ($(filter openocd, $(config)), openocd)
274 # add in base jtag code if not already
275 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
276 apps+= apps/jtag/jtag.o
279 apps+= apps/jtag/openocd.o
283 # include chipcon app
284 ifeq ($(filter chipcon, $(config)), chipcon)
285 apps+= apps/chipcon/chipcon.o
290 ifeq ($(filter avr, $(config)), avr)
291 apps+= apps/avr/avr.o
296 ifeq ($(filter pic, $(config)), pic)
297 apps+= apps/pic/pic.o
302 ifeq ($(filter adc, $(config)), adc)
303 ifeq ($(mcu), msp430x2274)
304 apps+= apps/adc/adc.o
307 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
311 # include chipcon radio spi app
312 ifeq ($(filter ccspi, $(config)), ccspi)
313 apps+= apps/radios/ccspi.o
318 ifeq ($(filter nrf, $(config)), nrf)
319 apps+= apps/radios/nrf.o
324 ifeq ($(filter glitch, $(config)), glitch)
325 apps+= apps/glitch/glitch.o
329 # include smartcard app
330 ifeq ($(filter smartcard, $(config)), smartcard)
331 apps+= apps/smartcard/smartcard.o
336 ifeq ($(filter ps2, $(config)), ps2)
337 apps+= apps/plugins/ps2.o
342 ifeq ($(filter jscan, $(config)), jscan)
343 apps+= apps/jscan/jscan.o
360 cp platforms/$(platform).h include/config.h
369 ../client/goodfet.msp430 test
371 avrinstall: $(app).hex
373 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
375 ifeq ($(platform),tilaunchpad)
377 $(JTAG) -e -p $(app).hex
379 $(JTAG) -v $(app).hex
381 $(JTAG) -e $(app).hex
384 $(MSP430BSL) -e -p $(app).hex
386 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
388 $(MSP430BSL) -P $(app).hex -v $(app).hex
391 $(MSP430BSL) --dumpinfo
394 $(app).c: config builddate appsfiles err
395 $(app): $(libs) $(apps)
397 ifeq ($(platform),donbfet)
399 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
402 msp430-objcopy goodfet -O ihex goodfet.hex
405 msp430-objdump -D -m msp430 $(app).hex | m4s init
407 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
411 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/