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