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 # atmel_radio -- Atmel radio
61 # glitch -- Glitch research tool
62 # smartcard -- Smartcard IO
68 # This is what you need to customize to specify which apps you want in
69 # your firmware. The "config" variable is just a space-delimited list
70 # of apps you want included. The makefile will take the list of apps
71 # and include all of the proper code needed to build your desired
72 # firmware. $(config) is generated by config.mk.
76 # Build the needed list of app and lib object files from the config
79 ifeq ($(platform),tilaunchpad)
80 libs= lib/$(platform).o lib/command.o lib/apps.o lib/msp430_serial.o
83 libs= lib/$(mcu).o lib/command.o lib/dco_calib.o lib/apps.o lib/msp430.o lib/arduino.o $(extralibs)
90 ifeq ($(filter monitor, $(config)), monitor)
91 apps+= apps/monitor/monitor.o
96 ifeq ($(filter spi, $(config)), spi)
102 ifeq ($(filter twe, $(config)), twe)
103 apps+= apps/twe/twe.o
107 # include base jtag if they specified it explicitly
108 ifeq ($(filter jtag, $(config)), jtag)
109 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
110 apps+= apps/jtag/jtag.o
115 # include MAX342x USB drivers.
116 ifeq ($(filter maxusb, $(config)), maxusb)
117 ifneq ($(filter apps/usb/maxusb.o, $(apps)), apps/usb/maxusb.o)
118 apps+= apps/usb/maxusb.o
123 # include the sbw defs if they specified it
124 ifeq ($(filter sbw, $(config)), sbw)
125 # if they only specify sbw, include jtag
126 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
127 apps+= apps/jtag/jtag.o
130 apps+= apps/jtag/sbw.o
134 # include jtag430 app
135 ifeq ($(filter jtag430, $(config)), jtag430)
136 # add in base jtag code if not already
137 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
138 apps+= apps/jtag/jtag.o
141 # add in the jtag430asm code if needed
142 ifneq ($(filter apps/jtag/jtag430asm.o, $(libs)), apps/jtag/jtag430asm.o)
143 apps+= apps/jtag/jtag430asm.o
145 apps+= apps/jtag/jtag430.o
149 # include jtag430x2 app
150 ifeq ($(filter jtag430x2, $(config)), jtag430x2)
151 # add in base jtag code if not already
152 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
153 apps+= apps/jtag/jtag.o
156 # add in the jtag430asm code if needed
157 ifneq ($(filter jtag430asm.o, $(libs)), jtag430asm.o)
158 libs+= apps/jtag/jtag430asm.o
160 #add in the jtag430 app if not already
161 ifneq ($(filter apps/jtag/jtag430.o, $(apps)), apps/jtag/jtag430.0)
162 apps+= apps/jtag/jtag430.o
165 apps+= apps/jtag/jtag430x2.o
170 ifeq ($(filter i2c, $(config)), i2c)
171 apps+= apps/i2c/i2c.o
175 # include jtagarm7 app
176 ifeq ($(filter jtagarm7, $(config)), jtagarm7)
177 # add in base jtag code if not already
178 ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
179 apps+= apps/jtag/jtag.o
182 apps+= apps/jtag/jtagarm7.o
186 # include jtagarm7tdmi app
187 #ifeq ($(filter jtagarm7tdmi, $(config)), jtagarm7tdmi)
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/jtagarm7tdmi.o
194 #hdrs+= jtagarm7tdmi.h
198 ifeq ($(filter ejtag, $(config)), ejtag)
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/ejtag.o
208 # include jtagxscale app
209 ifeq ($(filter jtagxscale, $(config)), jtagxscale)
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/jtagxscale.o
219 # include openocd app
220 ifeq ($(filter openocd, $(config)), openocd)
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/openocd.o
230 # include chipcon app
231 ifeq ($(filter chipcon, $(config)), chipcon)
232 apps+= apps/chipcon/chipcon.o
237 ifeq ($(filter avr, $(config)), avr)
238 apps+= apps/avr/avr.o
243 ifeq ($(filter pic, $(config)), pic)
244 apps+= apps/pic/pic.o
249 ifeq ($(filter adc, $(config)), adc)
250 ifeq ($(mcu), msp430f2274)
251 apps+= apps/adc/adc.o
254 ERR= $(error The ADC app only works on GoodFET boards with the msp430x2274 processor)
258 # include chipcon radio spi app
259 ifeq ($(filter ccspi, $(config)), ccspi)
260 apps+= apps/radios/ccspi.o
265 ifeq ($(filter nrf, $(config)), nrf)
266 apps+= apps/radios/nrf.o
270 # include atmel_radio app
271 ifeq ($(filter atmel_radio, $(config)), atmel_radio)
272 apps+= apps/radios/atmel_radio.o
277 ifeq ($(filter glitch, $(config)), glitch)
278 apps+= apps/glitch/glitch.o
282 # include smartcard app
283 ifeq ($(filter smartcard, $(config)), smartcard)
284 apps+= apps/smartcard/smartcard.o
289 ifeq ($(filter plugin, $(config)), plugin)
295 ifeq ($(filter jscan, $(config)), jscan)
296 apps+= apps/jscan/jscan.o
313 cp platforms/$(platform).h include/config.h
322 ../client/goodfet.msp430 test
324 avrinstall: $(app).hex
327 avrdude -V -F -c stk500v1 -p $(AVR_PLATFORM) -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
329 avrdude -V -F -c stk500v1 -p m328p -b 57600 -P $(GOODFET) -U flash:w:$(app).hex
332 ifeq ($(platform),tilaunchpad)
334 $(JTAG) -e -p $(app).hex
336 $(JTAG) -v $(app).hex
338 $(JTAG) -e $(app).hex
341 #Note that 'make install' no longer erases the chip.
342 #Use 'make reinstall' if you want that.
343 $(MSP430BSL) -p $(app).hex
344 reinstall: $(app).hex
345 $(MSP430BSL) -e -p $(app).hex
347 $(MSP430BSL) -P $(app).hex -p info.txt || true #MSP430F2xx targets only, inelegant.
349 $(MSP430BSL) -P $(app).hex -v $(app).hex
355 $(MSP430BSL) --dumpinfo
356 $(app).c: config builddate appsfiles err
357 $(app): $(app).o $(libs) $(apps)
358 armlink: $(app).o $(libs) $(apps) $(platformlibs)
359 arm-none-eabi-ld -v -Tlinkers/stm32f407.cmd -nostartfiles -o goodfet.elf $(app).o $(libs) $(apps)
360 arm-none-eabi-objcopy -Obinary goodfet.elf goodfet.bin
361 ifeq ($(platform),donbfet)
363 avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
366 msp430-objcopy goodfet -O ihex goodfet.hex
369 msp430-objdump -D -m msp430 $(app).hex | m4s init
371 rm -f *.o $(app) $(app).hex $(libs) $(apps) lib/apps.c include/config.h include/builddate.h include/apps.h
375 rsync --exclude .svn -ave ssh doc/html/* travisutk,goodfet@web.sourceforge.net:htdocs/docs/