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
43 # i2c -- Turns GF into USB-to-i2c adapter
44 # jtagarm7 -- ARM7TDMI JTAG
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
60 # glitch -- Glitch research tool
61 # smartcard -- Smartcard IO
67 # This is what you need to customize to specify which apps you want in
68 # your firmware. The "config" variable is just a space-delimited list
69 # of apps you want included. The makefile will take the list of apps
70 # and include all of the proper code needed to build your desired
71 # firmware. $(config) is generated by config.mk.
75 # Build the needed list of app and lib object files from the config
78 ifeq ($(platform),tilaunchpad)
79 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
82 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o $(extralibs)
89 ifeq ($(filter monitor, $(config)), monitor)
90 apps+= apps/monitor/monitor.o
95 ifeq ($(filter spi, $(config)), spi)
101 ifeq ($(filter twe, $(config)), twe)
102 apps+= apps/twe/twe.o
106 # include base jtag if they specified it explicitly
107 ifeq ($(filter jtag, $(config)), jtag)
108 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
109 apps+= apps/jtag/jtag.o
114 # include MAX342x USB drivers.
115 ifeq ($(filter maxusb, $(config)), maxusb)
116 ifneq ($(filter apps/usb/maxusb.o, $(apps)), apps/usb/maxusb.o)
117 apps+= apps/usb/maxusb.o
122 # include the sbw defs if they specified it
123 ifeq ($(filter sbw, $(config)), sbw)
124 # if they only specify sbw, include jtag
125 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
126 apps+= apps/jtag/jtag.o
129 apps+= apps/jtag/sbw.o
133 # include jtag430 app
134 ifeq ($(filter jtag430, $(config)), jtag430)
135 # add in base jtag code if not already
136 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
137 apps+= apps/jtag/jtag.o
140 # add in the jtag430asm code if needed
141 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
142 apps+= apps/jtag/jtag430asm.o
144 apps+= apps/jtag/jtag430.o
148 # include jtag430x2 app
149 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
150 # add in base jtag code if not already
151 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
152 apps+= apps/jtag/jtag.o
155 # add in the jtag430asm code if needed
156 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
157 libs+= apps/jtag/jtag430asm.o
159 #add in the jtag430 app if not already
160 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
161 apps+= apps/jtag/jtag430.o
164 apps+= apps/jtag/jtag430x2.o
169 ifeq ($(filter i2c, $(config)), i2c)
170 apps+= apps/i2c/i2c.o
174 # include jtagarm7 app
175 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
176 # add in base jtag code if not already
177 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
178 apps+= apps/jtag/jtag.o
181 apps+= apps/jtag/jtagarm7.o
185 # include jtagarm7tdmi app
186 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
187 # add in base jtag code if not already
188 #ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
189 #apps+= apps/jtag/jtag.o
192 #apps+= apps/jtag/jtagarm7tdmi.o
193 #hdrs+= jtagarm7tdmi.h
197 ifeq ($(filter ejtag, $(config)), ejtag)
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/ejtag.o
207 # include jtagxscale app
208 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
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/jtagxscale.o
218 # include openocd app
219 ifeq ($(filter openocd, $(config)), openocd)
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/openocd.o
229 # include chipcon app
230 ifeq ($(filter chipcon, $(config)), chipcon)
231 apps+= apps/chipcon/chipcon.o
236 ifeq ($(filter avr, $(config)), avr)
237 apps+= apps/avr/avr.o
242 ifeq ($(filter pic, $(config)), pic)
243 apps+= apps/pic/pic.o
248 ifeq ($(filter adc, $(config)), adc)
249 ifeq ($(mcu), msp430f2274)
250 apps+= apps/adc/adc.o
253 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
257 # include chipcon radio spi app
258 ifeq ($(filter ccspi, $(config)), ccspi)
259 apps+= apps/radios/ccspi.o
264 ifeq ($(filter nrf, $(config)), nrf)
265 apps+= apps/radios/nrf.o
270 ifeq ($(filter glitch, $(config)), glitch)
271 apps+= apps/glitch/glitch.o
275 # include smartcard app
276 ifeq ($(filter smartcard, $(config)), smartcard)
277 apps+= apps/smartcard/smartcard.o
282 ifeq ($(filter ps2, $(config)), ps2)
283 apps+= apps/plugins/ps2.o
288 ifeq ($(filter jscan, $(config)), jscan)
289 apps+= apps/jscan/jscan.o
306 cp platforms/$(platform).h include/config.h
315 ../client/goodfet.msp430 test
317 avrinstall: $(app).hex
319 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
321 ifeq ($(platform),tilaunchpad)
323 $(JTAG) -e -p $(app).hex
325 $(JTAG) -v $(app).hex
327 $(JTAG) -e $(app).hex
330 $(MSP430BSL) -e -p $(app).hex
332 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
334 $(MSP430BSL) -P $(app).hex -v $(app).hex
340 $(MSP430BSL) --dumpinfo
341 $(app).c: config builddate appsfiles err
342 $(app): $(app).o $(libs) $(apps)
343 armlink: $(app).o $(libs) $(apps) $(platformlibs)
344 arm-none-eabi-ld -v -Tlinkers/stm32f407.cmd -nostartfiles -o goodfet.elf $(app).o $(libs) $(apps)
345 arm-none-eabi-objcopy -Obinary goodfet.elf goodfet.bin
346 ifeq ($(platform),donbfet)
348 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
351 msp430-objcopy goodfet -O ihex goodfet.hex
354 msp430-objdump -D -m msp430 $(app).hex | m4s init
356 rm -f *.o $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
360 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/