-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
autopilot.makefile
232 lines (186 loc) · 5.44 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
# Hey Emacs, this is a -*- makefile -*-
#
# 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 ...)
##
#
# 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
#
# frequencies
#
PERIODIC_FREQUENCY ?= 60
$(TARGET).CFLAGS += -DPERIODIC_FREQUENCY=$(PERIODIC_FREQUENCY)
ifdef AHRS_PROPAGATE_FREQUENCY
$(TARGET).CFLAGS += -DAHRS_PROPAGATE_FREQUENCY=$(AHRS_PROPAGATE_FREQUENCY)
endif
ifdef AHRS_CORRECT_FREQUENCY
$(TARGET).CFLAGS += -DAHRS_CORRECT_FREQUENCY=$(AHRS_CORRECT_FREQUENCY)
endif
ifdef AHRS_MAG_CORRECT_FREQUENCY
$(TARGET).CFLAGS += -DAHRS_MAG_CORRECT_FREQUENCY=$(AHRS_MAG_CORRECT_FREQUENCY)
endif
#
# Sys-time
#
$(TARGET).srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c
ifeq ($(ARCH), linux)
# seems that we need to link against librt for glibc < 2.17
$(TARGET).LDFLAGS += -lrt
endif
#
# InterMCU & Commands
#
$(TARGET).CFLAGS += -DINTER_MCU
$(TARGET).srcs += $(SRC_FIXEDWING)/inter_mcu.c
#
# Math functions
#
ifneq ($(TARGET),fbw)
$(TARGET).srcs += math/pprz_geodetic_int.c math/pprz_geodetic_float.c math/pprz_geodetic_double.c math/pprz_trig_int.c math/pprz_orientation_conversion.c math/pprz_algebra_int.c math/pprz_algebra_float.c math/pprz_algebra_double.c
endif
#
# I2C
#
ifneq ($(TARGET),fbw)
$(TARGET).srcs += mcu_periph/i2c.c
$(TARGET).srcs += $(SRC_ARCH)/mcu_periph/i2c_arch.c
endif
######################################################################
##
## COMMON FOR ALL NON-SIMULATION TARGETS
##
#
# Interrupt Vectors
#
ifeq ($(ARCH), lpc21)
ns_srcs += $(SRC_ARCH)/armVIC.c
endif
ifeq ($(ARCH), stm32)
ns_srcs += $(SRC_ARCH)/mcu_periph/gpio_arch.c
endif
#
# Main
#
ifeq ($(RTOS), chibios)
ns_srcs += $(SRC_FIRMWARE)/main_chibios.c
else
ns_srcs += $(SRC_FIRMWARE)/main.c
endif
#
# LEDs
#
SYS_TIME_LED ?= none
ns_CFLAGS += -DUSE_LED
ifneq ($(SYS_TIME_LED),none)
ns_CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED)
endif
ifeq ($(ARCH), $(filter $(ARCH), stm32 sim))
ns_srcs += $(SRC_ARCH)/led_hw.c
endif
#
# UARTS
#
ns_srcs += mcu_periph/uart.c
ns_srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
#
# ANALOG
#
ns_CFLAGS += -DUSE_ADC
ns_srcs += $(SRC_ARCH)/mcu_periph/adc_arch.c
######################################################################
##
## FLY BY WIRE THREAD SPECIFIC
##
fbw_CFLAGS += -DFBW
fbw_srcs += $(SRC_FIRMWARE)/main_fbw.c
fbw_srcs += subsystems/electrical.c
fbw_srcs += subsystems/commands.c
fbw_srcs += subsystems/actuators.c
######################################################################
##
## AUTOPILOT THREAD SPECIFIC
##
ap_CFLAGS += -DAP
ap_srcs += $(SRC_FIRMWARE)/main_ap.c
ap_srcs += $(SRC_FIRMWARE)/autopilot.c
ap_srcs += state.c
ap_srcs += subsystems/settings.c
ap_srcs += $(SRC_ARCH)/subsystems/settings_arch.c
# BARO
include $(CFG_SHARED)/baro_board.makefile
######################################################################
##
## SIMULATOR THREAD SPECIFIC
##
UNAME = $(shell uname -s)
ifeq ("$(UNAME)","Darwin")
sim.CFLAGS += $(shell if test -d /opt/paparazzi/include; then echo "-I/opt/paparazzi/include"; elif test -d /opt/local/include; then echo "-I/opt/local/include"; fi)
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 -DPERIODIC_TELEMETRY -DDOWNLINK_TRANSPORT=ivy_tp -DDOWNLINK_DEVICE=ivy_tp -DDefaultPeriodic='&telemetry_Ap'
sim.srcs += subsystems/datalink/downlink.c $(SRC_FIRMWARE)/datalink.c subsystems/datalink/ivy_transport.c subsystems/datalink/telemetry.c $(SRC_FIRMWARE)/ap_downlink.c $(SRC_FIRMWARE)/fbw_downlink.c
sim.srcs += $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/sim_adc_generic.c
# hack: always compile some of the sim functions, so ocaml sim does not complain about no-existing functions
sim.srcs += $(SRC_ARCH)/sim_ahrs.c $(SRC_ARCH)/sim_ir.c
######################################################################
##
## Final Target Allocations
##
#
# SINGLE MCU / DUAL MCU
#
ifeq ($(BOARD),classix)
include $(CFG_FIXEDWING)/intermcu_spi.makefile
else
# Single MCU's run both
ifeq ($(SEPARATE_FBW),)
ap.CFLAGS += $(fbw_CFLAGS)
ap.srcs += $(fbw_srcs)
endif
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)