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