e9a5b5d0133abff78a98591a3bc79749c0e92d66
[goodfet] / firmware / config.mk
1 ##################################
2 ## These are production boards.
3 ##################################
4
5 #Unset by default, but can be explicitly overwritten.
6 config ?= undef
7
8 ifneq (,$(findstring $(board),apimote1 apimote))
9 mcu ?= msp430f2618
10 platform := apimote
11 config := monitor spi ccspi
12 MSP430BSL?=goodfet.bsl --speed=38400 --swap-reset-test
13 CFLAGS += -Duseuart1 -Dapimote
14 endif
15
16 ifneq (,$(findstring $(board),apimote2))
17 mcu ?= msp430f2618
18 platform := apimote2
19 config := monitor spi ccspi
20 MSP430BSL?=goodfet.bsl --speed=38400
21 CFLAGS += -Duseuart1 -Dapimote
22 endif
23
24 ifneq (,$(findstring $(board),goodthopter01 goodthopter10 goodthopter11))
25 mcu ?= msp430f2274
26 platform := goodfet
27 config := monitor spi
28 endif
29
30 ifneq (,$(findstring $(board),goodfet20 goodfet10 goodfet11))
31 mcu ?= msp430f1611
32 platform := goodfet
33 endif
34
35 ifneq (,$(findstring $(board),goodfet21,goodfet22))
36 mcu ?= msp430f2618
37 platform := goodfet
38 endif
39
40 ifneq (,$(findstring $(board),goodfet30 goodfet31 goodfet32))
41 mcu ?= msp430f2274
42 platform := goodfet
43 # This will link to fit in a '2254, so unneeded packages should be omited.
44 CONFIG_ccspi = n
45 CONFIG_nrf = y
46 endif
47
48 ifneq (,$(findstring $(board),goodfet40 goodfet41 goodfet42))
49 mcu ?= msp430f2618
50 platform := goodfet
51 CONFIG_nrf = y
52 CONFIG_ccspi = y
53 endif
54
55 ifneq (,$(findstring $(board),stm32f4discovery))
56
57 periph ?= /opt/STM32F4xx_StdPeriph_Driver
58 discovery ?= /opt/STM32F4-Discovery_FW_V1.1.0
59
60 usbcore ?= $(discovery)/Libraries/STM32_USB_Device_Library/Core
61 usbsrc ?= $(usbcore)/src
62 otginc ?= /opt/STM32F4-Discovery_FW_V1.1.0/Libraries/STM32_USB_OTG_Driver/inc
63 otgsrc ?= /opt/STM32F4-Discovery_FW_V1.1.0/Libraries/STM32_USB_OTG_Driver/src
64
65 pincs ?=  -I$(periph)/inc -I$(usbcore)/inc -I$(otginc) -I$(discovery)/Libraries/CMSIS/ST/STM32F4xx/Include  -I$(discovery)/Libraries/CMSIS/Include -Dassert_param\(x\)= -DUSE_USB_OTG_FS -I/opt/STM32F4-Discovery_FW_V1.1.0/Utilities/STM32F4-Discovery
66 psrc ?=  /opt/STM32F4xx_StdPeriph_Driver/src
67
68
69 GCC     = arm-none-eabi-gcc
70 CC      = arm-none-eabi-gcc
71 LD      = arm-none-eabi-ld -v
72 AR      = arm-none-eabi-ar
73 AS      = arm-none-eabi-as
74 CP      = arm-none-eabi-objcopy
75 OD      = arm-none-eabi-objdump
76 CFLAGS  = -c -fno-common -O1 -g -mcpu=cortex-m3 -mthumb $(pincs)
77 AFLAGS  = -ahls -mapcs-32
78 LFLAGS  = -Ttmplink.cmd -nostartfiles
79 CPFLAGS = -Obinary
80 ODFLAGS = -S
81 LDFLAGS = 
82
83
84 mcu ?= stm32f407
85 platform := stm32f4discovery
86 config = monitor
87
88 # This is a pain.
89 #usblibs =  $(usbsrc)/usbd_core.o $(usbsrc)/usbd_req.o $(usbsrc)/usbd_ioreq.o $(usbsrc)/usbd_core.o $(otgsrc)/usb_dcd.o $(otgsrc)/usb_dcd_int.o $(otgsrc)/usb_hcd.o $(otgsrc)/usb_hcd_int.o $(otgsrc)/usb_otg.o
90 extralibs = lib/cortexm3.o lib/system_stm32f4xx.o lib/stm32f4xx_rcc.o $(psrc)/stm32f4xx_gpio.o $(psrc)/stm32f4xx_usart.o $(usblibs) 
91
92 endif
93
94 ifneq (,$(findstring $(board),facedancer10 facedancer11 facedancer20 facedancer21))
95 mcu ?= msp430f2618
96 platform := goodfet
97 config = monitor spi maxusb
98 endif
99
100 ifeq ($(board),z1)
101 mcu ?= msp430f2617
102 platform := z1
103 config = monitor spi ccspi
104 MSP430BSL?=goodfet.bsl --z1  --speed=38400
105 endif
106
107 ifneq (,$(findstring $(board),goodfet24))
108 mcu ?= msp430f2618
109 platform := goodfet
110 CONFIG_glitch = y
111 CONFIG_nrf = y
112 endif
113
114 ifneq (,$(findstring $(board),nhb12b))
115 mcu ?= msp430f2618
116 CONFIG_nrf = y
117 platform := nhb12b
118 endif
119
120 ifneq (,$(findstring $(board),nhb12))
121 mcu ?= msp430f2618
122 CONFIG_nrf = y
123 platform := nhb12
124 endif
125
126 ifneq (,$(findstring $(board),goodfet50 goodfet51))
127 mcu ?= msp430f5510
128 platform := goodfet
129 endif
130
131 ifeq ($(board),telosb)
132 mcu ?= msp430f1611
133 platform := telosb
134 config := monitor spi ccspi
135 CFLAGS += -Duseuart1
136 endif
137
138 ifeq ($(board),telosbbt)
139 mcu ?=msp430f1612
140 platform := telosb
141 config := monitor spi ccspi
142 endif
143
144
145
146
147 ##################################
148 ## These are experimental boards.
149 ##################################
150
151 ifneq (,$(findstring $(board),donbfet))
152 GCC := avr-gcc
153 CC := avr-gcc
154 mcu ?= atmega644p
155 platform = donbfet
156 CFLAGS=$(DEBUG) -Iinclude -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
157 config := monitor avr spi jscan
158 endif
159
160 ifneq (,$(findstring $(board),zigduino))
161 GCC := avr-gcc
162 CC := avr-gcc
163 mcu ?= atmega128rfa1
164 platform = zigduino
165 CFLAGS=$(DEBUG) -Iinclude -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
166 config := monitor atmel_radio #avr spi
167 AVR_PLATFORM := m128rfa1
168 endif
169
170
171 ifneq (,$(findstring $(board),arduino))
172 GCC := avr-gcc
173 CP   = avr-objcopy
174 mcu ?= atmega168
175 platform ?= arduino
176 #BSL := avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/ttyACM0 -U flash:w:goodfet.hex
177 CFLAGS=$(DEBUG) -Iinclude -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
178 LDFLAGS := 
179 config := monitor
180 AVR_PLATFORM := m328p
181 endif
182
183 ifneq (,$(findstring $(board),tilaunchpad))
184 mcu ?=msp430f1612
185 CFLAGS := -DDEBUG_LEVEL=3 -DDEBUG_START=1 -DINBAND_DEBUG
186 CFLAGS+= -Wall
187 config := monitor chipcon i2c
188 endif
189
190
191
192 mcu ?= undef
193 ifeq ($(mcu),undef)
194 $(error Please define board, as explained in the README)
195 endif
196 #platform := $(board)
197
198 AVAILABLE_APPS = monitor spi jtag sbw jtag430 jtag430x2 i2c jtagarm7 ejtag jtagxscale openocd chipcon avr pic adc nrf ccspi glitch smartcard ps2 slc2  maxusb atmel_radio cc2500
199
200 # defaults
201 CONFIG_monitor    ?= y
202 CONFIG_spi        ?= y
203 CONFIG_maxusb     ?= y
204 CONFIG_jtag       ?= n
205 CONFIG_sbw        ?= n
206 CONFIG_jtag430    ?= y
207 CONFIG_jtag430x2  ?= y
208 CONFIG_i2c        ?= n
209 CONFIG_jtagarm7   ?= y
210 CONFIG_ejtag      ?= n
211 CONFIG_jtagxscale ?= n
212 CONFIG_openocd    ?= y
213 CONFIG_chipcon    ?= y
214 CONFIG_avr        ?= y
215 CONFIG_pic        ?= n
216 CONFIG_adc        ?= n
217 CONFIG_nrf        ?= n
218 CONFIG_ccspi      ?= n
219 CONFIG_cc2500     ?= y
220 CONFIG_glitch     ?= n
221 CONFIG_smartcard  ?= n
222 CONFIG_ps2        ?= n
223 CONFIG_slc2       ?= n
224 CONFIG_atmel_radio ?=n
225
226 #The CONFIG_foo vars are only interpreted if $(config) is "unset".
227 ifeq ($(config),undef)
228 config += $(foreach app,$(AVAILABLE_APPS),$(if $(findstring $(CONFIG_$(app)),y yes t true Y YES T TRUE),$(app)))
229 endif