Merge pull request #5959 from mikeller/remove_unneeded_include
[betaflight.git] / make / source.mk
blobc0e3b57d3cffd0c3efb7bfca3d4827e33dfc0ecb
1 COMMON_SRC = \
2 build/build_config.c \
3 build/debug.c \
4 build/version.c \
5 $(TARGET_DIR_SRC) \
6 main.c \
7 $(addprefix pg/,$(notdir $(wildcard $(SRC_DIR)/pg/*.c))) \
8 $(addprefix common/,$(notdir $(wildcard $(SRC_DIR)/common/*.c))) \
9 $(addprefix config/,$(notdir $(wildcard $(SRC_DIR)/config/*.c))) \
10 drivers/adc.c \
11 drivers/buf_writer.c \
12 drivers/bus.c \
13 drivers/bus_i2c_config.c \
14 drivers/bus_i2c_busdev.c \
15 drivers/bus_i2c_soft.c \
16 drivers/bus_spi.c \
17 drivers/bus_spi_config.c \
18 drivers/bus_spi_pinconfig.c \
19 drivers/buttons.c \
20 drivers/display.c \
21 drivers/exti.c \
22 drivers/io.c \
23 drivers/light_led.c \
24 drivers/pinio.c \
25 drivers/resource.c \
26 drivers/rcc.c \
27 drivers/serial.c \
28 drivers/serial_pinconfig.c \
29 drivers/serial_uart.c \
30 drivers/serial_uart_pinconfig.c \
31 drivers/sound_beeper.c \
32 drivers/stack_check.c \
33 drivers/system.c \
34 drivers/timer_common.c \
35 drivers/timer.c \
36 drivers/transponder_ir_arcitimer.c \
37 drivers/transponder_ir_ilap.c \
38 drivers/transponder_ir_erlt.c \
39 fc/config.c \
40 fc/fc_dispatch.c \
41 fc/fc_hardfaults.c \
42 fc/fc_tasks.c \
43 fc/runtime_config.c \
44 interface/msp.c \
45 interface/msp_box.c \
46 interface/tramp_protocol.c \
47 interface/smartaudio_protocol.c \
48 io/beeper.c \
49 io/piniobox.c \
50 io/serial.c \
51 io/statusindicator.c \
52 io/transponder_ir.c \
53 msp/msp_serial.c \
54 scheduler/scheduler.c \
55 sensors/adcinternal.c \
56 sensors/battery.c \
57 sensors/current.c \
58 sensors/voltage.c \
59 target/config_helper.c
61 OSD_SLAVE_SRC = \
62 io/displayport_max7456.c \
63 osd_slave/osd_slave_init.c \
64 io/osd_slave.c
66 FC_SRC = \
67 fc/fc_init.c \
68 fc/controlrate_profile.c \
69 drivers/camera_control.c \
70 drivers/accgyro/gyro_sync.c \
71 drivers/pwm_esc_detect.c \
72 drivers/pwm_output.c \
73 drivers/rx/rx_spi.c \
74 drivers/rx/rx_xn297.c \
75 drivers/rx/rx_pwm.c \
76 drivers/serial_softserial.c \
77 fc/fc_core.c \
78 fc/fc_rc.c \
79 fc/rc_adjustments.c \
80 fc/rc_controls.c \
81 fc/rc_modes.c \
82 flight/position.c \
83 flight/failsafe.c \
84 flight/gps_rescue.c \
85 flight/imu.c \
86 flight/mixer.c \
87 flight/mixer_tricopter.c \
88 flight/pid.c \
89 flight/servos.c \
90 flight/servos_tricopter.c \
91 interface/cli.c \
92 interface/settings.c \
93 io/serial_4way.c \
94 io/serial_4way_avrootloader.c \
95 io/serial_4way_stk500v2.c \
96 rx/ibus.c \
97 rx/jetiexbus.c \
98 rx/msp.c \
99 rx/pwm.c \
100 rx/rx.c \
101 rx/rx_spi.c \
102 rx/crsf.c \
103 rx/sbus.c \
104 rx/sbus_channels.c \
105 rx/spektrum.c \
106 io/spektrum_vtx_control.c \
107 io/spektrum_rssi.c \
108 rx/sumd.c \
109 rx/sumh.c \
110 rx/xbus.c \
111 rx/fport.c \
112 sensors/acceleration.c \
113 sensors/boardalignment.c \
114 sensors/compass.c \
115 sensors/gyro.c \
116 sensors/gyroanalyse.c \
117 sensors/initialisation.c \
118 blackbox/blackbox.c \
119 blackbox/blackbox_encoding.c \
120 blackbox/blackbox_io.c \
121 cms/cms.c \
122 cms/cms_menu_blackbox.c \
123 cms/cms_menu_builtin.c \
124 cms/cms_menu_imu.c \
125 cms/cms_menu_ledstrip.c \
126 cms/cms_menu_misc.c \
127 cms/cms_menu_osd.c \
128 cms/cms_menu_power.c \
129 cms/cms_menu_vtx_rtc6705.c \
130 cms/cms_menu_vtx_smartaudio.c \
131 cms/cms_menu_vtx_tramp.c \
132 drivers/display_ug2864hsweg01.c \
133 drivers/light_ws2811strip.c \
134 drivers/rangefinder/rangefinder_hcsr04.c \
135 drivers/rangefinder/rangefinder_lidartf.c \
136 drivers/serial_escserial.c \
137 drivers/vtx_common.c \
138 io/dashboard.c \
139 io/displayport_max7456.c \
140 io/displayport_msp.c \
141 io/displayport_oled.c \
142 io/displayport_rcdevice.c \
143 io/displayport_srxl.c \
144 io/displayport_crsf.c \
145 io/rcdevice_cam.c \
146 io/rcdevice.c \
147 io/rcdevice_osd.c \
148 io/gps.c \
149 io/ledstrip.c \
150 io/osd.c \
151 io/pidaudio.c \
152 sensors/barometer.c \
153 sensors/rangefinder.c \
154 telemetry/telemetry.c \
155 telemetry/crsf.c \
156 telemetry/srxl.c \
157 telemetry/frsky_hub.c \
158 telemetry/hott.c \
159 telemetry/jetiexbus.c \
160 telemetry/smartport.c \
161 telemetry/ltm.c \
162 telemetry/mavlink.c \
163 telemetry/msp_shared.c \
164 telemetry/ibus.c \
165 telemetry/ibus_shared.c \
166 sensors/esc_sensor.c \
167 io/vtx_string.c \
168 io/vtx.c \
169 io/vtx_rtc6705.c \
170 io/vtx_smartaudio.c \
171 io/vtx_tramp.c \
172 io/vtx_control.c
174 COMMON_DEVICE_SRC = \
175 $(CMSIS_SRC) \
176 $(DEVICE_STDPERIPH_SRC)
178 ifeq ($(OSD_SLAVE),yes)
179 TARGET_FLAGS := -DUSE_OSD_SLAVE $(TARGET_FLAGS)
180 COMMON_SRC := $(COMMON_SRC) $(OSD_SLAVE_SRC) $(COMMON_DEVICE_SRC)
181 else
182 COMMON_SRC := $(COMMON_SRC) $(FC_SRC) $(COMMON_DEVICE_SRC)
183 endif
185 ifeq ($(SIMULATOR_BUILD),yes)
186 TARGET_FLAGS := -DSIMULATOR_BUILD $(TARGET_FLAGS)
187 endif
189 SPEED_OPTIMISED_SRC := ""
190 SIZE_OPTIMISED_SRC := ""
192 ifneq ($(TARGET),$(filter $(TARGET),$(F1_TARGETS)))
193 SPEED_OPTIMISED_SRC := $(SPEED_OPTIMISED_SRC) \
194 common/encoding.c \
195 common/filter.c \
196 common/maths.c \
197 common/typeconversion.c \
198 drivers/accgyro/accgyro_fake.c \
199 drivers/accgyro/accgyro_mpu.c \
200 drivers/accgyro/accgyro_mpu3050.c \
201 drivers/accgyro/accgyro_mpu6050.c \
202 drivers/accgyro/accgyro_mpu6500.c \
203 drivers/accgyro/accgyro_spi_bmi160.c \
204 drivers/accgyro/accgyro_spi_icm20689.c \
205 drivers/accgyro/accgyro_spi_mpu6000.c \
206 drivers/accgyro/accgyro_spi_mpu6500.c \
207 drivers/accgyro/accgyro_spi_mpu9250.c \
208 drivers/accgyro_legacy/accgyro_adxl345.c \
209 drivers/accgyro_legacy/accgyro_bma280.c \
210 drivers/accgyro_legacy/accgyro_l3g4200d.c \
211 drivers/accgyro_legacy/accgyro_l3gd20.c \
212 drivers/accgyro_legacy/accgyro_lsm303dlhc.c \
213 drivers/accgyro_legacy/accgyro_mma845x.c \
214 drivers/adc.c \
215 drivers/buf_writer.c \
216 drivers/bus.c \
217 drivers/bus_spi.c \
218 drivers/exti.c \
219 drivers/io.c \
220 drivers/pwm_output.c \
221 drivers/rcc.c \
222 drivers/serial.c \
223 drivers/serial_uart.c \
224 drivers/system.c \
225 drivers/timer.c \
226 fc/fc_core.c \
227 fc/fc_tasks.c \
228 fc/fc_rc.c \
229 fc/rc_controls.c \
230 fc/runtime_config.c \
231 flight/imu.c \
232 flight/mixer.c \
233 flight/pid.c \
234 rx/ibus.c \
235 rx/rx.c \
236 rx/rx_spi.c \
237 rx/crsf.c \
238 rx/sbus.c \
239 rx/sbus_channels.c \
240 rx/spektrum.c \
241 rx/sumd.c \
242 rx/xbus.c \
243 rx/fport.c \
244 scheduler/scheduler.c \
245 sensors/acceleration.c \
246 sensors/boardalignment.c \
247 sensors/gyro.c \
248 sensors/gyroanalyse.c \
249 $(CMSIS_SRC) \
250 $(DEVICE_STDPERIPH_SRC) \
252 SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
253 bus_bst_stm32f30x.c \
254 drivers/barometer/barometer_bmp085.c \
255 drivers/barometer/barometer_bmp280.c \
256 drivers/barometer/barometer_fake.c \
257 drivers/barometer/barometer_ms5611.c \
258 drivers/barometer/barometer_lps.c \
259 drivers/barometer/barometer_qmp6988.c \
260 drivers/bus_i2c_config.c \
261 drivers/bus_spi_config.c \
262 drivers/bus_spi_pinconfig.c \
263 drivers/compass/compass_ak8963.c \
264 drivers/compass/compass_ak8975.c \
265 drivers/compass/compass_fake.c \
266 drivers/compass/compass_hmc5883l.c \
267 drivers/compass/compass_qmc5883l.c \
268 drivers/display_ug2864hsweg01.c \
269 drivers/inverter.c \
270 drivers/light_ws2811strip.c \
271 drivers/light_ws2811strip_hal.c \
272 drivers/light_ws2811strip_stdperiph.c \
273 drivers/serial_escserial.c \
274 drivers/serial_pinconfig.c \
275 drivers/serial_tcp.c \
276 drivers/serial_uart_init.c \
277 drivers/serial_uart_pinconfig.c \
278 drivers/serial_usb_vcp.c \
279 drivers/transponder_ir_io_hal.c \
280 drivers/transponder_ir_io_stdperiph.c \
281 drivers/vtx_rtc6705_soft_spi.c \
282 drivers/vtx_rtc6705.c \
283 drivers/vtx_common.c \
284 fc/fc_init.c \
285 config/config_eeprom.c \
286 config/feature.c \
287 config/config_streamer.c \
288 i2c_bst.c \
289 interface/cli.c \
290 interface/settings.c \
291 io/dashboard.c \
292 io/osd.c \
293 io/serial.c \
294 io/serial_4way.c \
295 io/serial_4way_avrootloader.c \
296 io/serial_4way_stk500v2.c \
297 io/transponder_ir.c \
298 msp/msp_serial.c \
299 cms/cms.c \
300 cms/cms_menu_blackbox.c \
301 cms/cms_menu_builtin.c \
302 cms/cms_menu_imu.c \
303 cms/cms_menu_ledstrip.c \
304 cms/cms_menu_misc.c \
305 cms/cms_menu_osd.c \
306 cms/cms_menu_power.c \
307 cms/cms_menu_vtx_rtc6705.c \
308 cms/cms_menu_vtx_smartaudio.c \
309 cms/cms_menu_vtx_tramp.c \
310 io/vtx_string.c \
311 io/vtx.c \
312 io/vtx_rtc6705.c \
313 io/vtx_smartaudio.c \
314 io/vtx_tramp.c \
315 io/vtx_control.c \
316 io/spektrum_vtx_control.c \
317 pg/pg.h
319 # F4 and F7 optimizations
320 ifneq ($(TARGET),$(filter $(TARGET),$(F3_TARGETS)))
321 SPEED_OPTIMISED_SRC := $(SPEED_OPTIMISED_SRC) \
322 drivers/bus_i2c_hal.c \
323 drivers/bus_spi_ll.c \
324 drivers/max7456.c \
325 drivers/pwm_output_dshot.c \
326 drivers/pwm_output_dshot_hal.c
327 endif #!F3
328 endif #!F1
330 # check if target.mk supplied
331 SRC := $(STARTUP_SRC) $(MCU_COMMON_SRC) $(TARGET_SRC) $(VARIANT_SRC)
333 ifneq ($(DSP_LIB),)
335 INCLUDE_DIRS += $(DSP_LIB)/Include
337 SRC += $(DSP_LIB)/Source/BasicMathFunctions/arm_mult_f32.c
338 SRC += $(DSP_LIB)/Source/TransformFunctions/arm_rfft_fast_f32.c
339 SRC += $(DSP_LIB)/Source/TransformFunctions/arm_cfft_f32.c
340 SRC += $(DSP_LIB)/Source/TransformFunctions/arm_rfft_fast_init_f32.c
341 SRC += $(DSP_LIB)/Source/TransformFunctions/arm_cfft_radix8_f32.c
342 SRC += $(DSP_LIB)/Source/CommonTables/arm_common_tables.c
344 SRC += $(DSP_LIB)/Source/ComplexMathFunctions/arm_cmplx_mag_f32.c
345 SRC += $(DSP_LIB)/Source/StatisticsFunctions/arm_max_f32.c
347 SRC += $(wildcard $(DSP_LIB)/Source/*/*.S)
348 endif
350 ifneq ($(filter ONBOARDFLASH,$(FEATURES)),)
351 SRC += \
352 drivers/flash.c \
353 drivers/flash_m25p16.c \
354 drivers/flash_w25m.c \
355 io/flashfs.c \
356 pg/flash.c \
357 $(MSC_SRC)
358 endif
360 SRC += $(COMMON_SRC)
362 #excludes
363 SRC := $(filter-out $(MCU_EXCLUDES), $(SRC))
365 ifneq ($(filter SDCARD,$(FEATURES)),)
366 SRC += \
367 drivers/sdcard.c \
368 drivers/sdcard_standard.c \
369 io/asyncfatfs/asyncfatfs.c \
370 io/asyncfatfs/fat_standard.c \
371 $(MSC_SRC)
372 endif
374 ifneq ($(filter SDIO,$(FEATURES)),)
375 SRC += \
376 drivers/sdcard_sdio_baremetal.c \
377 drivers/sdcard_standard.c \
378 io/asyncfatfs/asyncfatfs.c \
379 io/asyncfatfs/fat_standard.c \
380 pg/sdio.c \
381 $(MSC_SRC)
382 endif
384 ifneq ($(filter VCP,$(FEATURES)),)
385 SRC += $(VCP_SRC)
386 endif
388 ifneq ($(filter MSC,$(FEATURES)),)
389 SRC += $(MSC_SRC)
390 endif
391 # end target specific make file checks
393 # Search path and source files for the ST stdperiph library
394 VPATH := $(VPATH):$(STDPERIPH_DIR)/src