MSP Range finder added (#13980)
[betaflight.git] / mk / source.mk
blobf1536360c83c6aed4eb213dc5052d32d99f0cdb2
1 PG_SRC = \
2 pg/adc.c \
3 pg/alt_hold.c \
4 pg/autopilot.c \
5 pg/beeper.c \
6 pg/beeper_dev.c \
7 pg/board.c \
8 pg/bus_i2c.c \
9 pg/bus_quadspi.c \
10 pg/bus_spi.c \
11 pg/dashboard.c \
12 pg/displayport_profiles.c \
13 pg/dyn_notch.c \
14 pg/flash.c \
15 pg/gps.c \
16 pg/gps_lap_timer.c \
17 pg/gps_rescue.c \
18 pg/gyrodev.c \
19 pg/max7456.c \
20 pg/mco.c \
21 pg/motor.c \
22 pg/msp.c \
23 pg/pg.c \
24 pg/piniobox.c \
25 pg/pinio.c \
26 pg/pin_pull_up_down.c \
27 pg/rcdevice.c \
28 pg/rpm_filter.c \
29 pg/rx.c \
30 pg/rx_pwm.c \
31 pg/rx_spi.c \
32 pg/rx_spi_cc2500.c \
33 pg/rx_spi_expresslrs.c \
34 pg/scheduler.c \
35 pg/sdcard.c \
36 pg/sdio.c \
37 pg/serial_uart.c \
38 pg/stats.c \
39 pg/timerio.c \
40 pg/timerup.c \
41 pg/usb.c \
42 pg/vcd.c \
43 pg/vtx_io.c \
44 pg/vtx_table.c
46 COMMON_SRC = \
47 build/build_config.c \
48 build/debug.c \
49 build/debug_pin.c \
50 build/version.c \
51 main.c \
52 $(PG_SRC) \
53 common/bitarray.c \
54 common/colorconversion.c \
55 common/crc.c \
56 common/encoding.c \
57 common/explog_approx.c \
58 common/filter.c \
59 common/gps_conversion.c \
60 common/huffman.c \
61 common/huffman_table.c \
62 common/maths.c \
63 common/printf.c \
64 common/printf_serial.c \
65 common/pwl.c \
66 common/sdft.c \
67 common/sensor_alignment.c \
68 common/stopwatch.c \
69 common/streambuf.c \
70 common/string_light.c \
71 common/strtol.c \
72 common/time.c \
73 common/typeconversion.c \
74 common/uvarint.c \
75 common/vector.c \
76 config/config.c \
77 config/config_eeprom.c \
78 config/config_streamer.c \
79 config/feature.c \
80 config/simplified_tuning.c \
81 cli/cli.c \
82 cli/settings.c \
83 config/config.c \
84 drivers/adc.c \
85 drivers/dshot.c \
86 drivers/dshot_dpwm.c \
87 drivers/dshot_command.c \
88 drivers/buf_writer.c \
89 drivers/bus.c \
90 drivers/bus_i2c_config.c \
91 drivers/bus_i2c_busdev.c \
92 drivers/bus_i2c_utils.c \
93 drivers/bus_i2c_soft.c \
94 drivers/bus_octospi.c \
95 drivers/bus_quadspi.c \
96 drivers/bus_spi.c \
97 drivers/bus_spi_config.c \
98 drivers/bus_spi_pinconfig.c \
99 drivers/buttons.c \
100 drivers/camera_control.c \
101 drivers/display.c \
102 drivers/display_canvas.c \
103 drivers/dma_common.c \
104 drivers/io.c \
105 drivers/light_led.c \
106 drivers/mco.c \
107 drivers/motor.c \
108 drivers/pinio.c \
109 drivers/pin_pull_up_down.c \
110 drivers/resource.c \
111 drivers/serial.c \
112 drivers/serial_impl.c \
113 drivers/serial_pinconfig.c \
114 drivers/serial_uart.c \
115 drivers/serial_uart_pinconfig.c \
116 drivers/serial_uart_hw.c \
117 drivers/sound_beeper.c \
118 drivers/stack_check.c \
119 drivers/system.c \
120 drivers/timer_common.c \
121 drivers/transponder_ir_arcitimer.c \
122 drivers/transponder_ir_ilap.c \
123 drivers/transponder_ir_erlt.c \
124 fc/board_info.c \
125 fc/dispatch.c \
126 fc/hardfaults.c \
127 fc/tasks.c \
128 fc/runtime_config.c \
129 fc/stats.c \
130 io/beeper.c \
131 io/piniobox.c \
132 io/serial.c \
133 io/serial_resource.c \
134 io/smartaudio_protocol.c \
135 io/statusindicator.c \
136 io/tramp_protocol.c \
137 io/transponder_ir.c \
138 io/usb_cdc_hid.c \
139 io/usb_msc.c \
140 msp/msp.c \
141 msp/msp_box.c \
142 msp/msp_build_info.c \
143 msp/msp_serial.c \
144 scheduler/scheduler.c \
145 sensors/adcinternal.c \
146 sensors/battery.c \
147 sensors/current.c \
148 sensors/voltage.c \
149 target/config_helper.c \
150 fc/init.c \
151 fc/controlrate_profile.c \
152 drivers/accgyro/gyro_sync.c \
153 drivers/rx/rx_spi.c \
154 drivers/rx/rx_xn297.c \
155 drivers/rx/rx_pwm.c \
156 drivers/serial_softserial.c \
157 fc/core.c \
158 fc/gps_lap_timer.c \
159 fc/rc.c \
160 fc/rc_adjustments.c \
161 fc/rc_controls.c \
162 fc/rc_modes.c \
163 flight/alt_hold.c \
164 flight/autopilot.c \
165 flight/dyn_notch_filter.c \
166 flight/failsafe.c \
167 flight/gps_rescue.c \
168 flight/imu.c \
169 flight/mixer.c \
170 flight/mixer_init.c \
171 flight/mixer_tricopter.c \
172 flight/pid.c \
173 flight/pid_init.c \
174 flight/position.c \
175 flight/rpm_filter.c \
176 flight/servos.c \
177 flight/servos_tricopter.c \
178 io/serial_4way.c \
179 io/serial_4way_avrootloader.c \
180 io/serial_4way_stk500v2.c \
181 rx/ibus.c \
182 rx/jetiexbus.c \
183 rx/msp.c \
184 rx/pwm.c \
185 rx/frsky_crc.c \
186 rx/rc_stats.c \
187 rx/rx.c \
188 rx/rx_bind.c \
189 rx/rx_spi.c \
190 rx/rx_spi_common.c \
191 rx/crsf.c \
192 rx/ghst.c \
193 rx/sbus.c \
194 rx/sbus_channels.c \
195 rx/spektrum.c \
196 rx/srxl2.c \
197 io/spektrum_vtx_control.c \
198 io/spektrum_rssi.c \
199 rx/sumd.c \
200 rx/sumh.c \
201 rx/xbus.c \
202 rx/fport.c \
203 rx/msp_override.c \
204 sensors/acceleration.c \
205 sensors/acceleration_init.c \
206 sensors/boardalignment.c \
207 sensors/compass.c \
208 sensors/gyro.c \
209 sensors/gyro_init.c \
210 sensors/initialisation.c \
211 blackbox/blackbox.c \
212 blackbox/blackbox_encoding.c \
213 blackbox/blackbox_io.c \
214 cms/cms.c \
215 cms/cms_menu_blackbox.c \
216 cms/cms_menu_failsafe.c \
217 cms/cms_menu_firmware.c \
218 cms/cms_menu_gps_rescue.c \
219 cms/cms_menu_gps_lap_timer.c \
220 cms/cms_menu_imu.c \
221 cms/cms_menu_ledstrip.c \
222 cms/cms_menu_main.c \
223 cms/cms_menu_misc.c \
224 cms/cms_menu_osd.c \
225 cms/cms_menu_power.c \
226 cms/cms_menu_saveexit.c \
227 cms/cms_menu_vtx_common.c \
228 cms/cms_menu_vtx_rtc6705.c \
229 cms/cms_menu_vtx_smartaudio.c \
230 cms/cms_menu_vtx_tramp.c \
231 cms/cms_menu_persistent_stats.c \
232 cms/cms_menu_rpm_limit.c \
233 cms/cms_menu_quick.c \
234 drivers/display_ug2864hsweg01.c \
235 drivers/light_ws2811strip.c \
236 drivers/rangefinder/rangefinder_hcsr04.c \
237 drivers/rangefinder/rangefinder_lidartf.c \
238 drivers/rangefinder/rangefinder_lidarmt.c \
239 drivers/serial_escserial.c \
240 drivers/vtx_common.c \
241 drivers/vtx_table.c \
242 io/dashboard.c \
243 io/displayport_frsky_osd.c \
244 io/displayport_max7456.c \
245 io/displayport_msp.c \
246 io/displayport_oled.c \
247 io/displayport_srxl.c \
248 io/displayport_crsf.c \
249 io/displayport_hott.c \
250 io/frsky_osd.c \
251 io/rcdevice_cam.c \
252 io/rcdevice.c \
253 io/gps.c \
254 io/ledstrip.c \
255 io/pidaudio.c \
256 osd/osd.c \
257 osd/osd_elements.c \
258 osd/osd_warnings.c \
259 sensors/barometer.c \
260 sensors/rangefinder.c \
261 telemetry/telemetry.c \
262 telemetry/crsf.c \
263 telemetry/ghst.c \
264 telemetry/srxl.c \
265 telemetry/frsky_hub.c \
266 telemetry/hott.c \
267 telemetry/jetiexbus.c \
268 telemetry/smartport.c \
269 telemetry/ltm.c \
270 telemetry/mavlink.c \
271 telemetry/msp_shared.c \
272 telemetry/ibus.c \
273 telemetry/ibus_shared.c \
274 sensors/esc_sensor.c \
275 io/vtx.c \
276 io/vtx_rtc6705.c \
277 io/vtx_smartaudio.c \
278 io/vtx_tramp.c \
279 io/vtx_control.c \
280 io/vtx_msp.c \
281 cms/cms_menu_vtx_msp.c
283 ifneq ($(SIMULATOR_BUILD),yes)
285 COMMON_SRC += \
286 drivers/accgyro/accgyro_mpu3050.c \
287 drivers/accgyro/accgyro_mpu6050.c \
288 drivers/accgyro/accgyro_mpu6500.c \
289 drivers/accgyro/accgyro_mpu.c \
290 drivers/accgyro/accgyro_spi_bmi160.c \
291 drivers/accgyro/accgyro_spi_bmi270.c \
292 drivers/accgyro/accgyro_spi_icm20649.c \
293 drivers/accgyro/accgyro_spi_icm20689.c \
294 drivers/accgyro/accgyro_spi_icm426xx.c \
295 drivers/accgyro/accgyro_spi_l3gd20.c \
296 drivers/accgyro/accgyro_spi_lsm6dso.c \
297 drivers/accgyro/accgyro_spi_lsm6dso_init.c \
298 drivers/accgyro/accgyro_spi_lsm6dsv16x.c \
299 drivers/accgyro/accgyro_spi_mpu6000.c \
300 drivers/accgyro/accgyro_spi_mpu6500.c \
301 drivers/accgyro/accgyro_spi_mpu9250.c \
302 drivers/accgyro/accgyro_virtual.c \
303 drivers/accgyro/gyro_sync.c \
304 $(ROOT)/lib/main/BoschSensortec/BMI270-Sensor-API/bmi270_maximum_fifo.c \
305 drivers/barometer/barometer_2smpb_02b.c \
306 drivers/barometer/barometer_bmp085.c \
307 drivers/barometer/barometer_bmp280.c \
308 drivers/barometer/barometer_bmp388.c \
309 drivers/barometer/barometer_dps310.c \
310 drivers/barometer/barometer_lps22df.c \
311 drivers/barometer/barometer_lps.c \
312 drivers/barometer/barometer_ms5611.c \
313 drivers/barometer/barometer_qmp6988.c \
314 drivers/barometer/barometer_virtual.c \
315 drivers/compass/compass_ak8963.c \
316 drivers/compass/compass_ak8975.c \
317 drivers/compass/compass_hmc5883l.c \
318 drivers/compass/compass_ist8310.c \
319 drivers/compass/compass_lis2mdl.c \
320 drivers/compass/compass_lis3mdl.c \
321 drivers/compass/compass_mpu925x_ak8963.c \
322 drivers/compass/compass_qmc5883l.c \
323 drivers/compass/compass_virtual.c \
324 drivers/max7456.c \
325 drivers/vtx_rtc6705.c \
326 drivers/vtx_rtc6705_soft_spi.c
328 ifneq ($(GYRO_DEFINE),)
330 LEGACY_GYRO_DEFINES := USE_GYRO_L3GD20
331 ifneq ($(findstring $(GYRO_DEFINE),$(LEGACY_GYRO_DEFINES)),)
333 COMMON_SRC += \
334 drivers/accgyro/legacy/accgyro_adxl345.c \
335 drivers/accgyro/legacy/accgyro_bma280.c \
336 drivers/accgyro/legacy/accgyro_l3g4200d.c \
337 drivers/accgyro/legacy/accgyro_lsm303dlhc.c \
338 drivers/accgyro/legacy/accgyro_mma845x.c
341 endif
342 endif
344 RX_SRC = \
345 drivers/rx/expresslrs_driver.c \
346 drivers/rx/rx_a7105.c \
347 drivers/rx/rx_cc2500.c \
348 drivers/rx/rx_cyrf6936.c \
349 drivers/rx/rx_nrf24l01.c \
350 drivers/rx/rx_pwm.c \
351 drivers/rx/rx_spi.c \
352 drivers/rx/rx_sx127x.c \
353 drivers/rx/rx_sx1280.c \
354 drivers/rx/rx_xn297.c \
355 rx/cc2500_common.c \
356 rx/cc2500_frsky_shared.c \
357 rx/cc2500_frsky_d.c \
358 rx/cc2500_frsky_x.c \
359 rx/cc2500_sfhss.c \
360 rx/cc2500_redpine.c \
361 rx/a7105_flysky.c \
362 rx/cyrf6936_spektrum.c \
363 rx/expresslrs.c \
364 rx/expresslrs_common.c \
365 rx/expresslrs_telemetry.c
367 FLASH_SRC += \
368 drivers/flash/flash.c \
369 drivers/flash/flash_m25p16.c \
370 drivers/flash/flash_w25m.c \
371 drivers/flash/flash_w25n.c \
372 drivers/flash/flash_w25q128fv.c \
373 io/flashfs.c
375 SDCARD_SRC += \
376 drivers/sdcard.c \
377 drivers/sdcard_spi.c \
378 drivers/sdcard_sdio_baremetal.c \
379 drivers/sdcard_standard.c \
380 io/asyncfatfs/asyncfatfs.c \
381 io/asyncfatfs/fat_standard.c
383 INCLUDE_DIRS := $(INCLUDE_DIRS) \
384 $(FATFS_DIR)
385 VPATH := $(VPATH):$(FATFS_DIR)
387 endif
389 COMMON_DEVICE_SRC = \
390 $(CMSIS_SRC) \
391 $(DEVICE_STDPERIPH_SRC)
393 COMMON_SRC := $(COMMON_SRC) $(COMMON_DEVICE_SRC) $(RX_SRC)
395 ifeq ($(EXST),yes)
396 TARGET_FLAGS := -DUSE_EXST $(TARGET_FLAGS)
397 endif
399 ifeq ($(RAM_BASED),yes)
400 TARGET_FLAGS := -DUSE_EXST -DCONFIG_IN_RAM -DRAMBASED $(TARGET_FLAGS)
401 endif
403 ifeq ($(SIMULATOR_BUILD),yes)
404 TARGET_FLAGS := -DSIMULATOR_BUILD $(TARGET_FLAGS)
405 endif
407 SPEED_OPTIMISED_SRC := ""
408 SIZE_OPTIMISED_SRC := ""
410 SPEED_OPTIMISED_SRC := $(SPEED_OPTIMISED_SRC) \
411 common/encoding.c \
412 common/filter.c \
413 common/maths.c \
414 common/pwl.c \
415 common/sdft.c \
416 common/stopwatch.c \
417 common/typeconversion.c \
418 common/vector.c \
419 drivers/accgyro/accgyro_mpu.c \
420 drivers/accgyro/accgyro_mpu3050.c \
421 drivers/accgyro/accgyro_spi_bmi160.c \
422 drivers/accgyro/accgyro_spi_bmi270.c \
423 drivers/accgyro/accgyro_spi_lsm6dso.c \
424 drivers/accgyro_legacy/accgyro_adxl345.c \
425 drivers/accgyro_legacy/accgyro_bma280.c \
426 drivers/accgyro_legacy/accgyro_l3g4200d.c \
427 drivers/accgyro_legacy/accgyro_l3gd20.c \
428 drivers/accgyro_legacy/accgyro_lsm303dlhc.c \
429 drivers/accgyro_legacy/accgyro_mma845x.c \
430 drivers/adc.c \
431 drivers/buf_writer.c \
432 drivers/bus.c \
433 drivers/bus_quadspi.c \
434 drivers/bus_spi.c \
435 drivers/exti.c \
436 drivers/io.c \
437 drivers/pwm_output.c \
438 drivers/rcc.c \
439 drivers/serial.c \
440 drivers/serial_uart.c \
441 drivers/system.c \
442 drivers/timer.c \
443 fc/core.c \
444 fc/tasks.c \
445 fc/rc.c \
446 fc/rc_controls.c \
447 fc/runtime_config.c \
448 flight/dyn_notch_filter.c \
449 flight/imu.c \
450 flight/mixer.c \
451 flight/pid.c \
452 flight/rpm_filter.c \
453 rx/ibus.c \
454 rx/rc_stats.c \
455 rx/rx.c \
456 rx/rx_spi.c \
457 rx/crsf.c \
458 rx/frsky_crc.c \
459 rx/sbus.c \
460 rx/sbus_channels.c \
461 rx/spektrum.c \
462 rx/srxl2.c \
463 rx/sumd.c \
464 rx/xbus.c \
465 rx/fport.c \
466 scheduler/scheduler.c \
467 sensors/acceleration.c \
468 sensors/boardalignment.c \
469 sensors/gyro.c \
470 $(CMSIS_SRC) \
471 $(DEVICE_STDPERIPH_SRC) \
473 SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
474 $(shell find $(SRC_DIR) -name '*_init.c') \
475 bus_bst_stm32f30x.c \
476 cli/cli.c \
477 cli/settings.c \
478 drivers/accgyro/accgyro_fake.c \
479 drivers/barometer/barometer_bmp085.c \
480 drivers/barometer/barometer_bmp280.c \
481 drivers/barometer/barometer_fake.c \
482 drivers/barometer/barometer_ms5611.c \
483 drivers/barometer/barometer_lps.c \
484 drivers/barometer/barometer_qmp6988.c \
485 drivers/barometer/barometer_2smpb_02b.c \
486 drivers/bus_i2c_config.c \
487 drivers/bus_i2c_timing.c \
488 drivers/bus_spi_config.c \
489 drivers/bus_spi_pinconfig.c \
490 drivers/compass/compass_ak8963.c \
491 drivers/compass/compass_ak8975.c \
492 drivers/compass/compass_fake.c \
493 drivers/compass/compass_hmc5883l.c \
494 drivers/compass/compass_qmc5883l.c \
495 drivers/compass/compass_lis2mdl.c \
496 drivers/compass/compass_lis3mdl.c \
497 drivers/compass/compass_ist8310.c \
498 drivers/display_ug2864hsweg01.c \
499 drivers/inverter.c \
500 drivers/light_ws2811strip.c \
501 drivers/serial_escserial.c \
502 drivers/serial_pinconfig.c \
503 drivers/serial_tcp.c \
504 drivers/serial_uart_pinconfig.c \
505 drivers/serial_usb_vcp.c \
506 drivers/vtx_rtc6705_soft_spi.c \
507 drivers/vtx_rtc6705.c \
508 drivers/vtx_common.c \
509 fc/init.c \
510 fc/board_info.c \
511 config/config_eeprom.c \
512 config/feature.c \
513 config/config_streamer.c \
514 config/simplified_tuning.c \
515 i2c_bst.c \
516 io/dashboard.c \
517 io/serial.c \
518 io/serial_4way.c \
519 io/serial_4way_avrootloader.c \
520 io/serial_4way_stk500v2.c \
521 io/transponder_ir.c \
522 io/usb_cdc_hid.c \
523 msp/msp_serial.c \
524 cms/cms.c \
525 cms/cms_menu_blackbox.c \
526 cms/cms_menu_failsafe.c \
527 cms/cms_menu_firmware.c \
528 cms/cms_menu_gps_rescue.c \
529 cms/cms_menu_gps_lap_timer.c \
530 cms/cms_menu_imu.c \
531 cms/cms_menu_ledstrip.c \
532 cms/cms_menu_main.c \
533 cms/cms_menu_misc.c \
534 cms/cms_menu_osd.c \
535 cms/cms_menu_power.c \
536 cms/cms_menu_saveexit.c \
537 cms/cms_menu_vtx_common.c \
538 cms/cms_menu_vtx_rtc6705.c \
539 cms/cms_menu_vtx_smartaudio.c \
540 cms/cms_menu_vtx_tramp.c \
541 cms/cms_menu_persistent_stats.c \
542 cms/cms_menu_rpm_limit.c \
543 cms/cms_menu_quick.c \
544 io/vtx.c \
545 io/vtx_rtc6705.c \
546 io/vtx_smartaudio.c \
547 io/vtx_tramp.c \
548 io/vtx_control.c \
549 io/spektrum_vtx_control.c \
550 osd/osd.c \
551 osd/osd_elements.c \
552 osd/osd_warnings.c \
553 rx/rx_bind.c \
554 io/vtx_msp.c \
555 cms/cms_menu_vtx_msp.c
557 # Gyro driver files that only contain initialization and configuration code - not runtime code
558 SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
559 drivers/accgyro/accgyro_mpu6050.c \
560 drivers/accgyro/accgyro_mpu6500.c \
561 drivers/accgyro/accgyro_spi_mpu6000.c \
562 drivers/accgyro/accgyro_spi_mpu6500.c \
563 drivers/accgyro/accgyro_spi_mpu9250.c \
564 drivers/accgyro/accgyro_spi_icm20689.c \
565 drivers/accgyro/accgyro_spi_icm426xx.c \
566 drivers/accgyro/accgyro_spi_lsm6dso_init.c
569 # F4 and F7 optimizations
570 SPEED_OPTIMISED_SRC := $(SPEED_OPTIMISED_SRC) \
571 drivers/bus_i2c_hal.c \
572 drivers/bus_spi_ll.c \
573 rx/frsky_crc.c \
574 drivers/max7456.c \
575 drivers/pwm_output_dshot.c \
576 drivers/pwm_output_dshot_shared.c \
577 drivers/pwm_output_dshot_hal.c
579 SIZE_OPTIMISED_SRC := $(SIZE_OPTIMISED_SRC) \
580 drivers/bus_i2c_hal_init.c
582 # check if target.mk supplied
583 SRC := $(STARTUP_SRC) $(MCU_COMMON_SRC) $(TARGET_SRC) $(VARIANT_SRC)
585 # Files that should not be optimized, useful for debugging IMPRECISE cpu faults.
586 # Specify FULL PATH, e.g. "./lib/main/STM32F7/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_sdmmc.c"
587 NOT_OPTIMISED_SRC := $(NOT_OPTIMISED_SRC) \
589 ifneq ($(DSP_LIB),)
591 INCLUDE_DIRS += $(DSP_LIB)/Include
592 SRC += $(wildcard $(DSP_LIB)/Source/*/*.S)
594 endif
596 SRC += $(FLASH_SRC) $(MSC_SRC) $(SDCARD_SRC) $(COMMON_SRC)
598 #excludes
599 SRC := $(filter-out $(MCU_EXCLUDES), $(SRC))
601 SRC += $(VCP_SRC)
603 # end target specific make file checks
605 # Search path and source files for the Open Location Code library
606 OLC_DIR = $(ROOT)/lib/main/google/olc
608 ifneq ($(OLC_DIR),)
609 INCLUDE_DIRS += $(OLC_DIR)
610 SRC += $(OLC_DIR)/olc.c
611 SIZE_OPTIMISED_SRC += $(OLC_DIR)/olc.c
612 endif