Improved configuration system somewhat
[goodfet] / firmware / Makefile
index 3dcd605..124e36f 100644 (file)
@@ -1,4 +1,4 @@
-
+-include config.mk
 
 #platform?=goodfet
 #platform?=telosb
@@ -9,6 +9,12 @@
 #platform?=tilaunchpad
 platform?=goodfet
 
+# donb 
+ifeq ($(platform),donbfet)
+GCC?=avr-gcc
+mcu?=atmega644p
+CFLAGS=$(DEBUG) -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
+endif
 
 ifeq ($(platform),tilaunchpad)
 mcu?=msp430x1612
@@ -119,6 +125,11 @@ else
 config ?= monitor chipcon spi jtag430 jtag430x2 avr openocd ccspi
 endif
 
+# donb 
+ifeq ($(platform),donbfet)
+config=monitor avr spi jscan
+endif
+
 # Build the needed list of app and lib object files from the config
 apps= 
 
@@ -144,6 +155,12 @@ ifeq ($(filter spi, $(config)), spi)
        hdrs+= spi.h
 endif
 
+# include twe app
+ifeq ($(filter twe, $(config)), twe)
+        apps+= apps/twe/twe.o
+        hdrs+= twe.h
+endif
+
 # include base jtag if they specified it explicitly
 ifeq ($(filter jtag, $(config)), jtag)
        ifneq ($(filter apps/jtag/jtag.o, $(apps)), apps/jtag/jtag.o)
@@ -317,6 +334,12 @@ ifeq ($(filter ps2, $(config)), ps2)
        hdrs+= ps2.h
 endif
 
+# include jscan app
+ifeq ($(filter jscan, $(config)), jscan)
+       apps+= apps/jscan/jscan.o
+       hdrs+= jscan.h
+endif
+
 # Rules
 
 app= goodfet
@@ -366,8 +389,14 @@ erase:
        $(MSP430BSL) -e 
 $(app).c: config builddate appsfiles err
 $(app): $(libs) $(apps)
+
+ifeq ($(platform),donbfet)
+$(app).hex: $(app)
+       avr-objcopy -j .text -j .data -O ihex goodfet goodfet.hex
+else
 $(app).hex: $(app)
        msp430-objcopy goodfet -O ihex goodfet.hex
+endif
 m4s: $(app).hex
        msp430-objdump -D -m msp430 $(app).hex | m4s init
 clean: