Moving BARO and MAG activation to CLOUD_BUILD (#11986)
[betaflight.git] / make / source.mk
blob1797b2faf1f38c3ee9e27e3d3e43b0aff9a5c7fe
1 COMMON_SRC = \
2 build/build_config.c \
3 build/debug.c \
4 build/debug_pin.c \
5 build/version.c \
6 $(TARGET_DIR_SRC) \
7 main.c \
8 $(addprefix pg/, $(notdir $(wildcard $(SRC_DIR)/pg/*.c))) \
9 $(addprefix common/,$(notdir $(wildcard $(SRC_DIR)/common/*.c))) \
10 $(addprefix config/,$(notdir $(wildcard $(SRC_DIR)/config/*.c))) \
11 cli/cli.c \
12 cli/settings.c \
13 config/config.c \
14 drivers/adc.c \
15 drivers/dshot.c \
16 drivers/dshot_dpwm.c \
17 drivers/dshot_command.c \
18 drivers/buf_writer.c \
19 drivers/bus.c \
20 drivers/bus_i2c_config.c \
21 drivers/bus_i2c_busdev.c \
22 drivers/bus_i2c_soft.c \
23 drivers/bus_quadspi.c \
24 drivers/bus_spi.c \
25 drivers/bus_spi_config.c \
26 drivers/bus_spi_pinconfig.c \
27 drivers/buttons.c \
28 drivers/display.c \
29 drivers/display_canvas.c \
30 drivers/dma_common.c \
31 drivers/dma_reqmap.c \
32 drivers/exti.c \
33 drivers/io.c \
34 drivers/light_led.c \
35 drivers/mco.c \
36 drivers/motor.c \
37 drivers/pinio.c \
38 drivers/pin_pull_up_down.c \
39 drivers/resource.c \
40 drivers/rcc.c \
41 drivers/serial.c \
42 drivers/serial_pinconfig.c \
43 drivers/serial_uart.c \
44 drivers/serial_uart_pinconfig.c \
45 drivers/sound_beeper.c \
46 drivers/stack_check.c \
47 drivers/system.c \
48 drivers/timer_common.c \
49 drivers/timer.c \
50 drivers/transponder_ir_arcitimer.c \
51 drivers/transponder_ir_ilap.c \
52 drivers/transponder_ir_erlt.c \
53 fc/board_info.c \
54 fc/dispatch.c \
55 fc/hardfaults.c \
56 fc/tasks.c \
57 fc/runtime_config.c \
58 fc/stats.c \
59 io/beeper.c \
60 io/piniobox.c \
61 io/serial.c \
62 io/smartaudio_protocol.c \
63 io/statusindicator.c \
64 io/tramp_protocol.c \
65 io/transponder_ir.c \
66 io/usb_cdc_hid.c \
67 io/usb_msc.c \
68 msp/msp.c \
69 msp/msp_box.c \
70 msp/msp_serial.c \
71 scheduler/scheduler.c \
72 sensors/adcinternal.c \
73 sensors/battery.c \
74 sensors/current.c \
75 sensors/voltage.c \
76 target/config_helper.c \
77 fc/init.c \
78 fc/controlrate_profile.c \
79 drivers/camera_control.c \
80 drivers/accgyro/gyro_sync.c \
81 drivers/pwm_esc_detect.c \
82 drivers/pwm_output.c \
83 drivers/rx/rx_spi.c \
84 drivers/rx/rx_xn297.c \
85 drivers/rx/rx_pwm.c \
86 drivers/serial_softserial.c \
87 fc/core.c \
88 fc/rc.c \
89 fc/rc_adjustments.c \
90 fc/rc_controls.c \
91 fc/rc_modes.c \
92 flight/position.c \
93 flight/failsafe.c \
94 flight/gps_rescue.c \
95 flight/dyn_notch_filter.c \
96 flight/imu.c \
97 flight/feedforward.c \
98 flight/mixer.c \
99 flight/mixer_init.c \
100 flight/mixer_tricopter.c \
101 flight/pid.c \
102 flight/pid_init.c \
103 flight/rpm_filter.c \
104 flight/servos.c \
105 flight/servos_tricopter.c \
106 io/serial_4way.c \
107 io/serial_4way_avrootloader.c \
108 io/serial_4way_stk500v2.c \
109 rx/ibus.c \
110 rx/jetiexbus.c \
111 rx/msp.c \
112 rx/pwm.c \
113 rx/frsky_crc.c \
114 rx/rx.c \
115 rx/rx_bind.c \
116 rx/rx_spi.c \
117 rx/rx_spi_common.c \
118 rx/crsf.c \
119 rx/ghst.c \
120 rx/sbus.c \
121 rx/sbus_channels.c \
122 rx/spektrum.c \
123 rx/srxl2.c \
124 io/spektrum_vtx_control.c \
125 io/spektrum_rssi.c \
126 rx/sumd.c \
127 rx/sumh.c \
128 rx/xbus.c \
129 rx/fport.c \
130 rx/msp_override.c \
131 sensors/acceleration.c \
132 sensors/acceleration_init.c \
133 sensors/boardalignment.c \
134 sensors/compass.c \
135 sensors/gyro.c \
136 sensors/gyro_init.c \
137 sensors/initialisation.c \
138 blackbox/blackbox.c \
139 blackbox/blackbox_encoding.c \
140 blackbox/blackbox_io.c \
141 cms/cms.c \
142 cms/cms_menu_blackbox.c \
143 cms/cms_menu_failsafe.c \
144 cms/cms_menu_firmware.c \
145 cms/cms_menu_gps_rescue.c\
146 cms/cms_menu_imu.c \
147 cms/cms_menu_ledstrip.c \
148 cms/cms_menu_main.c \
149 cms/cms_menu_misc.c \
150 cms/cms_menu_osd.c \
151 cms/cms_menu_power.c \
152 cms/cms_menu_saveexit.c \
153 cms/cms_menu_vtx_common.c \
154 cms/cms_menu_vtx_rtc6705.c \
155 cms/cms_menu_vtx_smartaudio.c \
156 cms/cms_menu_vtx_tramp.c \
157 cms/cms_menu_persistent_stats.c \
158 drivers/display_ug2864hsweg01.c \
159 drivers/light_ws2811strip.c \
160 drivers/rangefinder/rangefinder_hcsr04.c \
161 drivers/rangefinder/rangefinder_lidartf.c \
162 drivers/serial_escserial.c \
163 drivers/vtx_common.c \
164 drivers/vtx_table.c \
165 io/dashboard.c \
166 io/displayport_frsky_osd.c \
167 io/displayport_max7456.c \
168 io/displayport_msp.c \
169 io/displayport_oled.c \
170 io/displayport_srxl.c \
171 io/displayport_crsf.c \
172 io/displayport_hott.c \
173 io/frsky_osd.c \
174 io/rcdevice_cam.c \
175 io/rcdevice.c \
176 io/gps.c \
177 io/ledstrip.c \
178 io/pidaudio.c \
179 osd/osd.c \
180 osd/osd_elements.c \
181 osd/osd_warnings.c \
182 sensors/barometer.c \
183 sensors/rangefinder.c \
184 telemetry/telemetry.c \
185 telemetry/crsf.c \
186 telemetry/ghst.c \
187 telemetry/srxl.c \
188 telemetry/frsky_hub.c \
189 telemetry/hott.c \
190 telemetry/jetiexbus.c \
191 telemetry/smartport.c \
192 telemetry/ltm.c \
193 telemetry/mavlink.c \
194 telemetry/msp_shared.c \
195 telemetry/ibus.c \
196 telemetry/ibus_shared.c \
197 sensors/esc_sensor.c \
198 io/vtx.c \
199 io/vtx_rtc6705.c \
200 io/vtx_smartaudio.c \
201 io/vtx_tramp.c \
202 io/vtx_control.c \
203 io/vtx_msp.c \
204 cms/cms_menu_vtx_msp.c
206 COMMON_DEVICE_SRC = \
207 $(CMSIS_SRC) \
208 $(DEVICE_STDPERIPH_SRC)
210 COMMON_SRC := $(COMMON_SRC) $(COMMON_DEVICE_SRC)
212 ifeq ($(EXST),yes)
213 TARGET_FLAGS := -DUSE_EXST $(TARGET_FLAGS)
214 endif
216 ifeq ($(RAM_BASED),yes)
217 TARGET_FLAGS := -DUSE_EXST -DCONFIG_IN_RAM -DRAMBASED $(TARGET_FLAGS)
218 endif
220 ifeq ($(SIMULATOR_BUILD),yes)
221 TARGET_FLAGS := -DSIMULATOR_BUILD $(TARGET_FLAGS)
222 endif
224 SPEED_OPTIMISED_SRC := ""
225 SIZE_OPTIMISED_SRC := ""
227 SPEED_OPTIMISED_SRC := $(SPEED_OPTIMISED_SRC) \
228 common/encoding.c \
229 common/filter.c \
230 common/maths.c \
231 common/sdft.c \
232 common/typeconversion.c \
233 drivers/accgyro/accgyro_mpu.c \
234 drivers/accgyro/accgyro_mpu3050.c \
235 drivers/accgyro/accgyro_spi_bmi160.c \
236 drivers/accgyro/accgyro_spi_bmi270.c \
237 drivers/accgyro/accgyro_spi_lsm6dso.c \
238 drivers/accgyro_legacy/accgyro_adxl345.c \
239 drivers/accgyro_legacy/accgyro_bma280.c \
240 drivers/accgyro_legacy/accgyro_l3g4200d.c \
241 drivers/accgyro_legacy/accgyro_l3gd20.c \
242 drivers/accgyro_legacy/accgyro_lsm303dlhc.c \
243 drivers/accgyro_legacy/accgyro_mma845x.c \
244 drivers/adc.c \
245 drivers/buf_writer.c \
246 drivers/bus.c \
247 drivers/bus_quadspi.c \
248 drivers/bus_spi.c \
249 drivers/exti.c \
250 drivers/io.c \
251 drivers/pwm_output.c \
252 drivers/rcc.c \
253 drivers/serial.c \
254 drivers/serial_uart.c \
255 drivers/system.c \
256 drivers/timer.c \
257 fc/core.c \
258 fc/tasks.c \
259 fc/rc.c \
260 fc/rc_controls.c \
261 fc/runtime_config.c \
262 flight/dyn_notch_filter.c \
263 flight/imu.c \
264 flight/mixer.c \
265 flight/pid.c \
266 flight/rpm_filter.c \
267 rx/ibus.c \
268 rx/rx.c \
269 rx/rx_spi.c \
270 rx/crsf.c \
271 rx/frsky_crc.c \
272 rx/sbus.c \
273 rx/sbus_channels.c \
274 rx/spektrum.c \
275 rx/srxl2.c \
276 rx/sumd.c \
277 rx/xbus.c \
278 rx/fport.c \
279 scheduler/scheduler.c \
280 sensors/acceleration.c \
281 sensors/boardalignment.c \
282 sensors/gyro.c \
283 $(CMSIS_SRC) \
284 $(DEVICE_STDPERIPH_SRC) \
286 SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
287 $(shell find $(SRC_DIR) -name '*_init.c') \
288 bus_bst_stm32f30x.c \
289 cli/cli.c \
290 cli/settings.c \
291 drivers/accgyro/accgyro_fake.c \
292 drivers/barometer/barometer_bmp085.c \
293 drivers/barometer/barometer_bmp280.c \
294 drivers/barometer/barometer_fake.c \
295 drivers/barometer/barometer_ms5611.c \
296 drivers/barometer/barometer_lps.c \
297 drivers/barometer/barometer_qmp6988.c \
298 drivers/bus_i2c_config.c \
299 drivers/bus_i2c_timing.c \
300 drivers/bus_spi_config.c \
301 drivers/bus_spi_pinconfig.c \
302 drivers/compass/compass_ak8963.c \
303 drivers/compass/compass_ak8975.c \
304 drivers/compass/compass_fake.c \
305 drivers/compass/compass_hmc5883l.c \
306 drivers/compass/compass_qmc5883l.c \
307 drivers/compass/compass_lis3mdl.c \
308 drivers/display_ug2864hsweg01.c \
309 drivers/inverter.c \
310 drivers/light_ws2811strip.c \
311 drivers/light_ws2811strip_hal.c \
312 drivers/light_ws2811strip_stdperiph.c \
313 drivers/serial_escserial.c \
314 drivers/serial_pinconfig.c \
315 drivers/serial_tcp.c \
316 drivers/serial_uart_pinconfig.c \
317 drivers/serial_usb_vcp.c \
318 drivers/transponder_ir_io_hal.c \
319 drivers/transponder_ir_io_stdperiph.c \
320 drivers/vtx_rtc6705_soft_spi.c \
321 drivers/vtx_rtc6705.c \
322 drivers/vtx_common.c \
323 fc/init.c \
324 fc/board_info.c \
325 config/config_eeprom.c \
326 config/feature.c \
327 config/config_streamer.c \
328 config/simplified_tuning.c \
329 i2c_bst.c \
330 io/dashboard.c \
331 io/serial.c \
332 io/serial_4way.c \
333 io/serial_4way_avrootloader.c \
334 io/serial_4way_stk500v2.c \
335 io/transponder_ir.c \
336 io/usb_cdc_hid.c \
337 msp/msp_serial.c \
338 cms/cms.c \
339 cms/cms_menu_blackbox.c \
340 cms/cms_menu_failsafe.c \
341 cms/cms_menu_firmware.c \
342 cms/cms_menu_gps_rescue.c\
343 cms/cms_menu_imu.c \
344 cms/cms_menu_ledstrip.c \
345 cms/cms_menu_main.c \
346 cms/cms_menu_misc.c \
347 cms/cms_menu_osd.c \
348 cms/cms_menu_power.c \
349 cms/cms_menu_saveexit.c \
350 cms/cms_menu_vtx_common.c \
351 cms/cms_menu_vtx_rtc6705.c \
352 cms/cms_menu_vtx_smartaudio.c \
353 cms/cms_menu_vtx_tramp.c \
354 cms/cms_menu_persistent_stats.c \
355 io/vtx.c \
356 io/vtx_rtc6705.c \
357 io/vtx_smartaudio.c \
358 io/vtx_tramp.c \
359 io/vtx_control.c \
360 io/spektrum_vtx_control.c \
361 osd/osd.c \
362 osd/osd_elements.c \
363 osd/osd_warnings.c \
364 rx/rx_bind.c \
365 io/vtx_msp.c \
366 cms/cms_menu_vtx_msp.c
368 # Gyro driver files that only contain initialization and configuration code - not runtime code
369 SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
370 drivers/accgyro/accgyro_mpu6050.c \
371 drivers/accgyro/accgyro_mpu6500.c \
372 drivers/accgyro/accgyro_spi_mpu6000.c \
373 drivers/accgyro/accgyro_spi_mpu6500.c \
374 drivers/accgyro/accgyro_spi_mpu9250.c \
375 drivers/accgyro/accgyro_spi_icm20689.c \
376 drivers/accgyro/accgyro_spi_icm426xx.c \
377 drivers/accgyro/accgyro_spi_lsm6dso_init.c
380 # F4 and F7 optimizations
381 SPEED_OPTIMISED_SRC := $(SPEED_OPTIMISED_SRC) \
382 drivers/bus_i2c_hal.c \
383 drivers/bus_spi_ll.c \
384 rx/frsky_crc.c \
385 drivers/max7456.c \
386 drivers/pwm_output_dshot.c \
387 drivers/pwm_output_dshot_shared.c \
388 drivers/pwm_output_dshot_hal.c
390 SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
391 drivers/bus_i2c_hal_init.c
393 # check if target.mk supplied
394 SRC := $(STARTUP_SRC) $(MCU_COMMON_SRC) $(TARGET_SRC) $(VARIANT_SRC)
396 # Files that should not be optimized, useful for debugging IMPRECISE cpu faults.
397 # Specify FULL PATH, e.g. "./lib/main/STM32F7/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_sdmmc.c"
398 NOT_OPTIMISED_SRC := $(NOT_OPTIMISED_SRC) \
400 ifneq ($(DSP_LIB),)
402 INCLUDE_DIRS += $(DSP_LIB)/Include
404 SRC += $(wildcard $(DSP_LIB)/Source/*/*.S)
405 endif
407 ifneq ($(filter ONBOARDFLASH,$(FEATURES)),)
408 SRC += \
409 drivers/flash.c \
410 drivers/flash_m25p16.c \
411 drivers/flash_w25n01g.c \
412 drivers/flash_w25q128fv.c \
413 drivers/flash_w25m.c \
414 io/flashfs.c \
415 $(MSC_SRC)
416 endif
418 SRC += $(COMMON_SRC)
420 #excludes
421 SRC := $(filter-out $(MCU_EXCLUDES), $(SRC))
423 ifneq ($(filter SDCARD_SPI,$(FEATURES)),)
424 SRC += \
425 drivers/sdcard.c \
426 drivers/sdcard_spi.c \
427 drivers/sdcard_standard.c \
428 io/asyncfatfs/asyncfatfs.c \
429 io/asyncfatfs/fat_standard.c \
430 $(MSC_SRC)
431 endif
433 ifneq ($(filter SDCARD_SDIO,$(FEATURES)),)
434 SRC += \
435 drivers/sdcard.c \
436 drivers/sdcard_sdio_baremetal.c \
437 drivers/sdcard_standard.c \
438 io/asyncfatfs/asyncfatfs.c \
439 io/asyncfatfs/fat_standard.c \
440 $(MSC_SRC)
441 endif
443 ifneq ($(filter VCP,$(FEATURES)),)
444 SRC += $(VCP_SRC)
445 endif
447 ifneq ($(filter MSC,$(FEATURES)),)
448 SRC += $(MSC_SRC)
449 endif
450 # end target specific make file checks
452 ifneq ($(BOARD),)
453 SRC += board/$(BOARD)/board.c
454 INCLUDE_DIRS += $(ROOT)/src/main/board/$(BOARD)
455 TARGET_FLAGS := -D'__BOARD__="$(BOARD)"' $(TARGET_FLAGS)
456 endif
458 # Search path and source files for the ST stdperiph library
459 VPATH := $(VPATH):$(STDPERIPH_DIR)/src
461 # Search path and source files for the Open Location Code library
462 OLC_DIR = $(ROOT)/lib/main/google/olc
464 ifneq ($(OLC_DIR),)
465 INCLUDE_DIRS += $(OLC_DIR)
466 SRC += $(OLC_DIR)/olc.c
467 SIZE_OPTIMISED_SRC += $(OLC_DIR)/olc.c
468 endif