3 GOODFET?=/dev/tty.usbser*
6 #BSL?=avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/tty.usbserial-* -U flash:w:blink.hex
7 #For tos-bsl, use --invert-reset --invert-test
8 MSP430BSL?=goodfet.bsl --speed=38400
10 #One of these should be defined explicitly.
11 #Default removed because of confusion.
27 #N.B., gcc WILL NOT BITCH if this file doesn't exist.
28 GCCINC?=-T ldscripts/$(mcu).x
33 CCEXTRA?= -D$(mcu) -D$(platform) -Dplatform=$(platform) -DGCC $(GCCINC) -I include -I platforms
34 CC=$(GCC) -Wall -Os -fno-strict-aliasing -g -mmcu=$(mcu) $(CCEXTRA)
36 # Available Applications
37 # ======================
38 # Below is a list of available applications and their descriptions.
41 # None have made it to production grade quality
44 # monitor -- Basic monitor
45 # spi -- Turns GF into USB-to-SPI adapter
46 # jtag -- Low level JTAG (needed by all other JTAG code)
47 # sbw -- Makes JTAG Spy-by-wire multiplexable
50 # jtag430 -- 16-bit MSP430 JTAG
51 # jtag430x2 -- 20-bit MSP430 JTAG
55 # i2c -- Turns GF into USB-to-i2c adapter
56 # jtagarm7 -- ARM7TDMI JTAG
58 # jtagxscale -- XScale JTAG
59 # openocd -- OpenOCD bitbang device
62 # chipcon -- Chipcon radio 8051 debugging
64 # pic -- PIC24H/dsPIC33F debugger
65 # adc -- ADC10 (still specific to x2274, GoodFET32)
68 # nrf -- Nordic RF SPI
69 # ccspi -- Chipcon SPI
72 # glitch -- Glitch research tool
73 # smartcard -- Smartcard IO
79 # This is what you need to customize to specify which apps you want in your
80 # firmware. The "config" variable is just a space-delimited list of apps you
81 # want included. The makefile will take the list of apps and include all of
82 # the proper code needed to build your desired firmware.
88 # config = monitor jtag
91 # config = monitor chipcon ccspi
94 # config = monitor glitch
97 # config = monitor jtagxscale
99 # OpenOCD bit-bang device
100 #config = monitor openocd
103 # config = monitor sbw chipcon nrf ccspi spi jtagarm7 jtag430 jtag430x2 avr
106 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi
108 # Build the needed list of app and lib object files from the config
110 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
126 # include base jtag if they specified it explicitly
127 ifeq ($(filter jtag, $(config)), jtag)
128 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
129 apps+= apps/jtag/jtag.o
134 # include the sbw defs if they specified it
135 ifeq ($(filter sbw, $(config)), sbw)
136 # if they only specify sbw, include jtag
137 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
138 apps+= apps/jtag/jtag.o
141 apps+= apps/jtag/sbw.o
145 # include jtag430 app
146 ifeq ($(filter jtag430, $(config)), jtag430)
147 # add in base jtag code if not already
148 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
149 apps+= apps/jtag/jtag.o
152 # add in the jtag430asm code if needed
153 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
154 apps+= apps/jtag/jtag430asm.o
156 apps+= apps/jtag/jtag430.o
160 # include jtag430x2 app
161 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
162 # add in base jtag code if not already
163 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
164 apps+= apps/jtag/jtag.o
167 # add in the jtag430asm code if needed
168 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
169 libs+= apps/jtag/jtag430asm.o
171 #add in the jtag430 app if not already
172 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
173 apps+= apps/jtag/jtag430.o
176 apps+= apps/jtag/jtag430x2.o
181 ifeq ($(filter i2c, $(config)), i2c)
182 apps+= apps/i2c/i2c.o
186 # include jtagarm7 app
187 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
188 # add in base jtag code if not already
189 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
190 apps+= apps/jtag/jtag.o
193 apps+= apps/jtag/jtagarm7.o
197 # include jtagarm7tdmi app
198 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
199 # add in base jtag code if not already
200 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
201 #apps+= apps/jtag/jtag.o
204 #apps+= apps/jtag/jtagarm7tdmi.o
205 #hdrs+= jtagarm7tdmi.h
209 ifeq ($(filter ejtag, $(config)), ejtag)
210 # add in base jtag code if not already
211 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
212 apps+= apps/jtag/jtag.o
215 apps+= apps/jtag/ejtag.o
219 # include jtagxscale app
220 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
221 # add in base jtag code if not already
222 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
223 apps+= apps/jtag/jtag.o
226 apps+= apps/jtag/jtagxscale.o
230 # include openocd app
231 ifeq ($(filter openocd, $(config)), openocd)
232 # add in base jtag code if not already
233 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
234 apps+= apps/jtag/jtag.o
237 apps+= apps/jtag/openocd.o
241 # include chipcon app
242 ifeq ($(filter chipcon, $(config)), chipcon)
243 apps+= apps/chipcon/chipcon.o
248 ifeq ($(filter avr, $(config)), avr)
249 apps+= apps/avr/avr.o
254 ifeq ($(filter pic, $(config)), pic)
255 apps+= apps/pic/pic.o
260 ifeq ($(filter adc, $(config)), adc)
261 ifeq ($(mcu), msp430x2274)
262 apps+= apps/adc/adc.o
265 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
269 # include chipcon radio spi app
270 ifeq ($(filter ccspi, $(config)), ccspi)
271 apps+= apps/radios/ccspi.o
276 ifeq ($(filter nrf, $(config)), nrf)
277 apps+= apps/radios/nrf.o
282 ifeq ($(filter glitch, $(config)), glitch)
283 apps+= apps/glitch/glitch.o
287 # include smartcard app
288 ifeq ($(filter smartcard, $(config)), smartcard)
289 apps+= apps/smartcard/smartcard.o
294 ifeq ($(filter ps2, $(config)), ps2)
295 apps+= apps/plugins/ps2.o
312 cp platforms/$(platform).h include/config.h
321 ../client/goodfet.msp430 test
323 avrinstall: $(app).hex
325 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
327 $(MSP430BSL) -e -p $(app).hex
329 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
331 $(MSP430BSL) -P $(app).hex -v $(app).hex
333 $(MSP430BSL) --dumpinfo
334 $(app).c: config builddate appsfiles err
335 $(app): $(libs) $(apps)
337 msp430-objcopy goodfet -O ihex goodfet.hex
339 msp430-objdump -D -m msp430 $(app).hex | m4s init
343 rm -f $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
347 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/