8 GOODFET?=/dev/tty.usbser*
10 #For tos-bsl, use --invert-reset --invert-test
11 MSP430BSL?=goodfet.bsl --speed=38400
17 #All of these are ?= in order ot allow overriding.
18 GCC?=msp430-gcc -mmcu=$(mcu)
19 LDFLAGS?=-mmcu=$(mcu) #-Wl,-dT ldscripts/$(mcu).x
21 CCEXTRA ?= $(CFLAGS) -D$(mcu) -D$(platform) -Dplatform=$(platform) -Dboard=$(board) $(GCCINC) -I include -I platforms
22 CC =$(GCC) -Wall -O1 -fno-strict-aliasing -g $(CCEXTRA)
24 # Available Applications
25 # ======================
26 # Below is a list of available applications and their descriptions.
29 # None have made it to production grade quality
32 # monitor -- Basic monitor
33 # spi -- Turns GF into USB-to-SPI adapter
34 # jtag -- Low level JTAG (needed by all other JTAG code)
35 # sbw -- Makes JTAG Spy-by-wire multiplexable
38 # jtag430 -- 16-bit MSP430 JTAG
39 # jtag430x2 -- 20-bit MSP430 JTAG
40 # jtagarm7 -- ARM7TDMI JTAG
44 # i2c -- Turns GF into USB-to-i2c adapter
46 # jtagxscale -- XScale JTAG
47 # openocd -- OpenOCD bitbang device
50 # chipcon -- Chipcon radio 8051 debugging
52 # pic -- PIC24H/dsPIC33F debugger
53 # adc -- ADC10 (still specific to x2274, GoodFET32)
56 # nrf -- Nordic RF SPI
57 # ccspi -- Chipcon SPI
58 # cc2500 -- Chipcon SPI CC2500
59 # atmel_radio -- Atmel radio
62 # glitch -- Glitch research tool
63 # smartcard -- Smartcard IO
69 # This is what you need to customize to specify which apps you want in
70 # your firmware. The "config" variable is just a space-delimited list
71 # of apps you want included. The makefile will take the list of apps
72 # and include all of the proper code needed to build your desired
73 # firmware. $(config) is generated by config.mk.
77 # Build the needed list of app and lib object files from the config
80 ifeq ($(platform),tilaunchpad)
81 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
84 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o $(extralibs)
91 ifeq ($(filter monitor, $(config)), monitor)
92 apps+= apps/monitor/monitor.o
97 ifeq ($(filter spi, $(config)), spi)
103 ifeq ($(filter twe, $(config)), twe)
104 apps+= apps/twe/twe.o
108 # include base jtag if they specified it explicitly
109 ifeq ($(filter jtag, $(config)), jtag)
110 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
111 apps+= apps/jtag/jtag.o
116 # include MAX342x USB drivers.
117 ifeq ($(filter maxusb, $(config)), maxusb)
118 ifneq ($(filter apps/usb/maxusb.o, $(apps)), apps/usb/maxusb.o)
119 apps+= apps/usb/maxusb.o
124 # include the sbw defs if they specified it
125 ifeq ($(filter sbw, $(config)), sbw)
126 # if they only specify sbw, include jtag
127 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
128 apps+= apps/jtag/jtag.o
131 apps+= apps/jtag/sbw.o
135 # include jtag430 app
136 ifeq ($(filter jtag430, $(config)), jtag430)
137 # add in base jtag code if not already
138 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
139 apps+= apps/jtag/jtag.o
142 # add in the jtag430asm code if needed
143 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
144 apps+= apps/jtag/jtag430asm.o
146 apps+= apps/jtag/jtag430.o
150 # include jtag430x2 app
151 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
152 # add in base jtag code if not already
153 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
154 apps+= apps/jtag/jtag.o
157 # add in the jtag430asm code if needed
158 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
159 libs+= apps/jtag/jtag430asm.o
161 #add in the jtag430 app if not already
162 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
163 apps+= apps/jtag/jtag430.o
166 apps+= apps/jtag/jtag430x2.o
171 ifeq ($(filter i2c, $(config)), i2c)
172 apps+= apps/i2c/i2c.o
176 # include jtagarm7 app
177 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
178 # add in base jtag code if not already
179 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
180 apps+= apps/jtag/jtag.o
183 apps+= apps/jtag/jtagarm7.o
187 # include jtagarm7tdmi app
188 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
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 #apps+= apps/jtag/jtagarm7tdmi.o
195 #hdrs+= jtagarm7tdmi.h
199 ifeq ($(filter ejtag, $(config)), ejtag)
200 # add in base jtag code if not already
201 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
202 apps+= apps/jtag/jtag.o
205 apps+= apps/jtag/ejtag.o
209 # include jtagxscale app
210 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
211 # add in base jtag code if not already
212 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
213 apps+= apps/jtag/jtag.o
216 apps+= apps/jtag/jtagxscale.o
220 # include openocd app
221 ifeq ($(filter openocd, $(config)), openocd)
222 # add in base jtag code if not already
223 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
224 apps+= apps/jtag/jtag.o
227 apps+= apps/jtag/openocd.o
231 # include chipcon app
232 ifeq ($(filter chipcon, $(config)), chipcon)
233 apps+= apps/chipcon/chipcon.o
238 ifeq ($(filter avr, $(config)), avr)
239 apps+= apps/avr/avr.o
244 ifeq ($(filter pic, $(config)), pic)
245 apps+= apps/pic/pic.o
250 ifeq ($(filter adc, $(config)), adc)
251 ifeq ($(mcu), msp430f2274)
252 apps+= apps/adc/adc.o
255 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
259 # include chipcon radio spi app
260 ifeq ($(filter ccspi, $(config)), ccspi)
261 apps+= apps/radios/ccspi.o
265 # include chipcon CC2500 radio spi app
266 ifeq ($(filter cc2500, $(config)), cc2500)
267 apps+= apps/radios/cc2500.o
272 ifeq ($(filter nrf, $(config)), nrf)
273 apps+= apps/radios/nrf.o
277 # include atmel_radio app
278 ifeq ($(filter atmel_radio, $(config)), atmel_radio)
279 apps+= apps/radios/atmel_radio.o
284 ifeq ($(filter glitch, $(config)), glitch)
285 apps+= apps/glitch/glitch.o
289 # include smartcard app
290 ifeq ($(filter smartcard, $(config)), smartcard)
291 apps+= apps/smartcard/smartcard.o
296 ifeq ($(filter plugin, $(config)), plugin)
302 ifeq ($(filter jscan, $(config)), jscan)
303 apps+= apps/jscan/jscan.o
320 cp platforms/$(platform).h include/config.h
329 ../client/goodfet.msp430 test
331 avrinstall: $(app).hex
334 avrdude -V -F -c stk500v1 -p $(AVR_PLATFORM) -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
336 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
339 ifeq ($(platform),tilaunchpad)
341 $(JTAG) -e -p $(app).hex
343 $(JTAG) -v $(app).hex
345 $(JTAG) -e $(app).hex
348 #Note that 'make install' no longer erases the chip.
349 #Use 'make reinstall' if you want that.
350 $(MSP430BSL) -p $(app).hex
351 reinstall: $(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): $(app).o $(libs) $(apps)
365 armlink: $(app).o $(libs) $(apps) $(platformlibs)
366 arm-none-eabi-ld -v -Tlinkers/stm32f407.cmd -nostartfiles -o goodfet.elf $(app).o $(libs) $(apps)
367 arm-none-eabi-objcopy -Obinary goodfet.elf goodfet.bin
368 ifeq ($(platform),donbfet)
370 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
373 msp430-objcopy goodfet -O ihex goodfet.hex
376 msp430-objdump -D -m msp430 $(app).hex | m4s init
378 rm -f *.o $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
382 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/