-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
autopilot.makefile
238 lines (188 loc) · 5.42 KB
/
autopilot.makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#
# $Id: autopilot.makefile 4827 2010-04-21 08:02:18Z poine $
#
# Copyright (C) 2008 Antoine Drouin
#
# This file is part of paparazzi.
#tin
# paparazzi is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# paparazzi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with paparazzi; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
#
######################################################################
##
## COMMON FIXEDWING ALL TARGETS (SIM + AP + FBW ...)
##
# temporary hack for ADCs
ifeq ($(ARCH), stm32)
# FIXME : this is for the battery
$(TARGET).CFLAGS += -DUSE_AD1_3
endif
#
# Board config + Include paths
#
$(TARGET).CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
$(TARGET).CFLAGS += -DPERIPHERALS_AUTO_INIT
$(TARGET).CFLAGS += $(FIXEDWING_INC)
$(TARGET).srcs += mcu.c
$(TARGET).srcs += $(SRC_ARCH)/mcu_arch.c
#
# Common Options
#
ifeq ($(OPTIONS), minimal)
else
$(TARGET).CFLAGS += -DWIND_INFO
endif
$(TARGET).CFLAGS += -DTRAFFIC_INFO
#
# LEDs
#
$(TARGET).CFLAGS += -DUSE_LED
ifneq ($(ARCH), lpc21)
ifneq ($(ARCH), jsbsim)
$(TARGET).srcs += $(SRC_ARCH)/led_hw.c
endif
endif
#
# Sys-time
#
ifndef PERIODIC_FREQUENCY
PERIODIC_FREQUENCY = 60
endif
$(TARGET).CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./$(PERIODIC_FREQUENCY).))' -DPERIODIC_FREQUENCY=$(PERIODIC_FREQUENCY)
$(TARGET).srcs += sys_time.c
#
# InterMCU & Commands
#
$(TARGET).CFLAGS += -DINTER_MCU
$(TARGET).srcs += $(SRC_FIXEDWING)/inter_mcu.c
######################################################################
##
## COMMON FOR ALL NON-SIMULATION TARGETS
##
#
# Interrupt Vectors
#
ifeq ($(ARCH), lpc21)
ns_srcs += $(SRC_ARCH)/armVIC.c
else ifeq ($(ARCH), stm32)
ns_srcs += $(SRC_ARCH)/stm32_exceptions.c
ns_srcs += $(SRC_ARCH)/stm32_vector_table.c
# ns_CFLAGS += -DPERIPHERALS_AUTO_INIT
endif
ifeq ($(ARCH), stm32)
ns_srcs += lisa/plug_sys.c
endif
#
# Main
#
ns_srcs += $(SRC_FIRMWARE)/main.c
#
# LEDs
#
ns_CFLAGS += -DUSE_LED
ifeq ($(ARCH), stm32)
ns_CFLAGS += -DSYS_TIME_LED=1
else
ns_CFLAGS += -DTIME_LED=1
endif
#
# Sys-time
#
ns_CFLAGS += -DUSE_SYS_TIME
ns_srcs += $(SRC_ARCH)/sys_time_hw.c
#
# UARTS
#
ns_srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
#
# ANALOG
#
ns_CFLAGS += -DUSE_ADC
#ifeq ($(ARCH), lpc21)
ns_srcs += $(SRC_ARCH)/mcu_periph/adc_arch.c
ifeq ($(ARCH), stm32)
ns_CFLAGS += -DUSE_ADC1_2_IRQ_HANDLER
endif
######################################################################
##
## FLY BY WIRE THREAD SPECIFIC
##
fbw_CFLAGS += -DFBW
fbw_srcs += $(SRC_FIRMWARE)/main_fbw.c
fbw_srcs += subsystems/electrical.c
fbw_srcs += $(SRC_FIXEDWING)/commands.c
######################################################################
##
## AUTOPILOT THREAD SPECIFIC
##
ap_CFLAGS += -DAP
ap_srcs += $(SRC_FIRMWARE)/main_ap.c
ap_srcs += $(SRC_FIXEDWING)/estimator.c
######################################################################
##
## SIMULATOR THREAD SPECIFIC
##
UNAME = $(shell uname -s)
ifeq ("$(UNAME)","Darwin")
sim.CFLAGS += -I/opt/local/include/
endif
sim.CFLAGS += $(CPPFLAGS)
sim.CFLAGS += $(fbw_CFLAGS) $(ap_CFLAGS)
sim.srcs += $(fbw_srcs) $(ap_srcs)
sim.CFLAGS += -DSITL
sim.srcs += $(SRC_ARCH)/sim_ap.c
sim.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport
sim.srcs += downlink.c $(SRC_FIRMWARE)/datalink.c $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/sim_adc_generic.c
######################################################################
##
## JSBSIM THREAD SPECIFIC
##
OCAMLLIBDIR=$(shell ocamlc -where)
JSBSIM_INC = /usr/include/JSBSim
#JSBSIM_LIB = /usr/lib
jsbsim.CFLAGS += $(fbw_CFLAGS) $(ap_CFLAGS)
jsbsim.srcs += $(fbw_srcs) $(ap_srcs)
jsbsim.CFLAGS += -DSITL
jsbsim.srcs += $(SIMDIR)/sim_ac_jsbsim.c $(SIMDIR)/sim_ac_fw.c $(SIMDIR)/sim_ac_flightgear.c
# external libraries
jsbsim.CFLAGS += -I$(SIMDIR) -I/usr/include -I$(JSBSIM_INC) -I$(OCAMLLIBDIR) `pkg-config glib-2.0 --cflags`
jsbsim.LDFLAGS += `pkg-config glib-2.0 --libs` -lm -lpcre -lglibivy -L/usr/lib -lJSBSim
jsbsim.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport
jsbsim.srcs += downlink.c $(SRC_FIRMWARE)/datalink.c $(SRC_ARCH)/jsbsim_hw.c $(SRC_ARCH)/jsbsim_gps.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/jsbsim_transport.c
######################################################################
##
## Final Target Allocations
##
#
# SINGLE MCU / DUAL MCU
#
ifeq ($(BOARD),classix)
fbw.CFLAGS += -DMCU_SPI_LINK -DUSE_SPI -DSPI_SLAVE
fbw.srcs += $(SRC_FIXEDWING)/link_mcu.c mcu_periph/spi.c $(SRC_ARCH)/mcu_periph/spi_arch.c
ap.CFLAGS += -DMCU_SPI_LINK -DUSE_SPI -DSPI_MASTER -DUSE_SPI_SLAVE0
ap.srcs += $(SRC_FIXEDWING)/link_mcu.c mcu_periph/spi.c $(SRC_ARCH)/mcu_periph/spi_arch.c
else
# Single MCU's run both
ap.CFLAGS += $(fbw_CFLAGS)
ap.srcs += $(fbw_srcs)
endif
#
# No-Sim parameters
#
fbw.CFLAGS += $(fbw_CFLAGS) $(ns_CFLAGS)
fbw.srcs += $(fbw_srcs) $(ns_srcs)
ap.CFLAGS += $(ap_CFLAGS) $(ns_CFLAGS)
ap.srcs += $(ap_srcs) $(ns_srcs)