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