1 ###############################################################################
2 # "THE BEER-WARE LICENSE" (Revision 42):
3 # <msmith@FreeBSD.ORG> wrote this file. As long as you retain this notice you
4 # can do whatever you want with this stuff. If we meet some day, and you think
5 # this stuff is worth it, you can buy me a beer in return
6 ###############################################################################
8 # Makefile for building the cleanflight firmware.
10 # Invoke this with 'make help' to see the list of supported targets.
13 ###############################################################################
16 # Things that the user might override on the commandline
19 # The target to build, see VALID_TARGETS below
22 # Compile-time options
25 # compile for OpenPilot BootLoader support
28 # Debugger optons, must be empty or GDB
31 # Serial port/Device for flashing
32 SERIAL_DEVICE ?
= $(firstword $(wildcard /dev
/ttyUSB
*) no-port-found
)
34 # Flash size (KB). Some low-end chips actually have more flash than advertised, use this to override.
37 ###############################################################################
38 # Things that need to be maintained as the source changes
43 CC3D_TARGETS
= CC3D CC3D_OPBL
45 VALID_TARGETS
= NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3
$(CC3D_TARGETS
) CJMCU EUSTM32F103RC SPRACINGF3 PORT103R SPARKY ALIENFLIGHTF1 ALIENFLIGHTF3 COLIBRI_RACE LUX_RACE MOTOLAB RMDO IRCFUSIONF3 AFROMINI SPRACINGF3MINI SPRACINGF3EVO DOGE
47 # Valid targets for OP VCP support
48 VCP_VALID_TARGETS
= $(CC3D_TARGETS
)
50 # Valid targets for OP BootLoader support
51 OPBL_VALID_TARGETS
= CC3D_OPBL
54 128K_TARGETS
= ALIENFLIGHTF1
$(CC3D_TARGETS
) NAZE OLIMEXINO RMDO AFROMINI
55 256K_TARGETS
= EUSTM32F103RC PORT103R STM32F3DISCOVERY CHEBUZZF3 NAZE32PRO SPRACINGF3 IRCFUSIONF3 SPARKY ALIENFLIGHTF3 COLIBRI_RACE LUX_RACE MOTOLAB SPRACINGF3MINI SPRACINGF3EVO DOGE
57 F3_TARGETS
= STM32F3DISCOVERY CHEBUZZF3 NAZE32PRO SPRACINGF3 IRCFUSIONF3 SPARKY ALIENFLIGHTF3 COLIBRI_RACE LUX_RACE MOTOLAB RMDO SPRACINGF3MINI SPRACINGF3EVO DOGE
60 # Configure default flash sizes for the targets
62 ifeq ($(TARGET
),$(filter $(TARGET
),$(64K_TARGETS
)))
64 else ifeq ($(TARGET
),$(filter $(TARGET
),$(128K_TARGETS
)))
66 else ifeq ($(TARGET
),$(filter $(TARGET
),$(256K_TARGETS
)))
69 $(error FLASH_SIZE not configured for target
$(TARGET
))
73 REVISION
= $(shell git log
-1 --format
="%h")
75 FC_VER_MAJOR
:= $(shell grep
" FC_VERSION_MAJOR" src
/main
/version.h | awk
'{print $$3}' )
76 FC_VER_MINOR
:= $(shell grep
" FC_VERSION_MINOR" src
/main
/version.h | awk
'{print $$3}' )
77 FC_VER_PATCH
:= $(shell grep
" FC_VERSION_PATCH" src
/main
/version.h | awk
'{print $$3}' )
79 FC_VER
:= $(FC_VER_MAJOR
).
$(FC_VER_MINOR
).
$(FC_VER_PATCH
)
82 ROOT
:= $(patsubst %/,%,$(dir $(lastword
$(MAKEFILE_LIST
))))
83 SRC_DIR
= $(ROOT
)/src
/main
84 OBJECT_DIR
= $(ROOT
)/obj
/main
86 CMSIS_DIR
= $(ROOT
)/lib
/main
/CMSIS
87 INCLUDE_DIRS
= $(SRC_DIR
)
88 LINKER_DIR
= $(ROOT
)/src
/main
/target
90 # Search path for sources
91 VPATH
:= $(SRC_DIR
):$(SRC_DIR
)/startup
92 USBFS_DIR
= $(ROOT
)/lib
/main
/STM32_USB-FS-Device_Driver
93 USBPERIPH_SRC
= $(notdir $(wildcard $(USBFS_DIR
)/src
/*.c
))
94 FATFS_DIR
= $(ROOT
)/lib
/main
/FatFS
95 FATFS_SRC
= $(notdir $(wildcard $(FATFS_DIR
)/*.c
))
97 ifeq ($(TARGET
),$(filter $(TARGET
),$(F3_TARGETS
)))
99 CSOURCES
:= $(shell find
$(SRC_DIR
) -name
'*.c')
101 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F30x_StdPeriph_Driver
103 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/src
/*.c
))
105 EXCLUDES
= stm32f30x_crc.c \
108 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
110 DEVICE_STDPERIPH_SRC
= \
114 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM1
/CoreSupport
:$(CMSIS_DIR
)/CM1
/DeviceSupport
/ST
/STM32F30x
115 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM1
/CoreSupport
/*.c \
116 $(CMSIS_DIR
)/CM1
/DeviceSupport
/ST
/STM32F30x
/*.c
))
118 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
119 $(STDPERIPH_DIR
)/inc \
120 $(CMSIS_DIR
)/CM1
/CoreSupport \
121 $(CMSIS_DIR
)/CM1
/DeviceSupport
/ST
/STM32F30x
123 ifneq ($(TARGET
),$(filter $(TARGET
),SPRACINGF3 IRCFUSIONF3
))
124 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
128 VPATH
:= $(VPATH
):$(USBFS_DIR
)/src
130 DEVICE_STDPERIPH_SRC
:= $(DEVICE_STDPERIPH_SRC
)\
135 ifeq ($(TARGET
),SPRACINGF3MINI
)
136 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
139 VPATH
:= $(VPATH
):$(FATFS_DIR
)
142 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f303_
$(FLASH_SIZE
)k.
ld
144 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m4
-mfloat-abi
=hard
-mfpu
=fpv4-sp-d16
-fsingle-precision-constant
-Wdouble-promotion
145 DEVICE_FLAGS
= -DSTM32F303xC
-DSTM32F303
146 TARGET_FLAGS
= -D
$(TARGET
)
147 ifeq ($(TARGET
),CHEBUZZF3
)
148 # CHEBUZZ is a VARIANT of STM32F3DISCOVERY
149 TARGET_FLAGS
:= $(TARGET_FLAGS
) -DSTM32F3DISCOVERY
152 ifeq ($(TARGET
),$(filter $(TARGET
),RMDO IRCFUSIONF3
))
153 # RMDO and IRCFUSIONF3 are a VARIANT of SPRACINGF3
154 TARGET_FLAGS
:= $(TARGET_FLAGS
) -DSPRACINGF3
157 else ifeq ($(TARGET
),$(filter $(TARGET
),EUSTM32F103RC PORT103R
))
160 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F10x_StdPeriph_Driver
162 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/src
/*.c
))
164 EXCLUDES
= stm32f10x_crc.c \
168 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
170 # Search path and source files for the CMSIS sources
171 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM3
/CoreSupport
:$(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
172 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM3
/CoreSupport
/*.c \
173 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
/*.c
))
175 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
176 $(STDPERIPH_DIR
)/inc \
177 $(CMSIS_DIR
)/CM3
/CoreSupport \
178 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x \
180 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f103_
$(FLASH_SIZE
)k.
ld
182 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m3
183 TARGET_FLAGS
= -D
$(TARGET
) -pedantic
184 DEVICE_FLAGS
= -DSTM32F10X_HD
-DSTM32F10X
186 DEVICE_STDPERIPH_SRC
= $(STDPERIPH_SRC
)
190 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F10x_StdPeriph_Driver
192 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/src
/*.c
))
194 EXCLUDES
= stm32f10x_crc.c \
198 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
200 # Search path and source files for the CMSIS sources
201 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM3
/CoreSupport
:$(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
202 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM3
/CoreSupport
/*.c \
203 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
/*.c
))
205 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
206 $(STDPERIPH_DIR
)/inc \
207 $(CMSIS_DIR
)/CM3
/CoreSupport \
208 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x \
210 DEVICE_STDPERIPH_SRC
= $(STDPERIPH_SRC
)
212 ifeq ($(TARGET
),$(filter $(TARGET
), $(VCP_VALID_TARGETS
)))
213 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
217 VPATH
:= $(VPATH
):$(USBFS_DIR
)/src
219 DEVICE_STDPERIPH_SRC
:= $(DEVICE_STDPERIPH_SRC
) \
224 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f103_
$(FLASH_SIZE
)k.
ld
226 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m3
227 TARGET_FLAGS
= -D
$(TARGET
) -pedantic
228 DEVICE_FLAGS
= -DSTM32F10X_MD
-DSTM32F10X
232 ifneq ($(FLASH_SIZE
),)
233 DEVICE_FLAGS
:= $(DEVICE_FLAGS
) -DFLASH_SIZE
=$(FLASH_SIZE
)
236 TARGET_DIR
= $(ROOT
)/src
/main
/target
/$(TARGET
)
237 TARGET_SRC
= $(notdir $(wildcard $(TARGET_DIR
)/*.c
))
239 ifeq ($(TARGET
),ALIENFLIGHTF1
)
240 # ALIENFLIGHTF1 is a VARIANT of NAZE
241 TARGET_FLAGS
:= $(TARGET_FLAGS
) -DNAZE
-DALIENFLIGHT
242 TARGET_DIR
= $(ROOT
)/src
/main
/target
/NAZE
245 ifeq ($(TARGET
),$(filter $(TARGET
), $(CC3D_TARGETS
)))
246 TARGET_FLAGS
:= $(TARGET_FLAGS
) -DCC3D
247 TARGET_DIR
= $(ROOT
)/src
/main
/target
/CC3D
250 ifneq ($(filter $(TARGET
),$(OPBL_VALID_TARGETS
)),)
255 ifneq ($(filter $(TARGET
),$(OPBL_VALID_TARGETS
)),)
256 TARGET_FLAGS
:= -DOPBL
$(TARGET_FLAGS
)
257 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f103_
$(FLASH_SIZE
)k_opbl.
ld
258 .DEFAULT_GOAL
:= binary
260 $(error OPBL specified with a unsupported target
)
264 ifeq ($(TARGET
),AFROMINI
)
265 # AFROMINI is a VARIANT of NAZE being recognized as rev4, but needs to use rev5 config
266 TARGET_FLAGS
:= $(TARGET_FLAGS
) -DNAZE
-DAFROMINI
267 TARGET_DIR
= $(ROOT
)/src
/main
/target
/NAZE
270 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
273 VPATH
:= $(VPATH
):$(TARGET_DIR
)
275 COMMON_SRC
= build_config.c \
280 config
/runtime_config.c \
283 common
/typeconversion.c \
290 flight
/altitudehold.c \
295 drivers
/bus_i2c_soft.c \
297 drivers
/sound_beeper.c \
299 drivers
/gyro_sync.c \
301 drivers
/buf_writer.c \
307 io
/serial_4way_avrootloader.c \
308 io
/serial_4way_stk500v2.c \
311 io
/statusindicator.c \
322 sensors
/acceleration.c \
324 sensors
/boardalignment.c \
327 sensors
/initialisation.c \
329 $(DEVICE_STDPERIPH_SRC
)
333 flight
/navigation.c \
334 flight
/gps_conversion.c \
335 common
/colorconversion.c \
339 telemetry
/telemetry.c \
342 telemetry
/smartport.c \
345 sensors
/barometer.c \
346 blackbox
/blackbox.c \
347 blackbox
/blackbox_io.c
357 drivers
/serial_usb_vcp.c \
360 NAZE_SRC
= startup_stm32f10x_md_gcc.S \
361 drivers
/accgyro_adxl345.c \
362 drivers
/accgyro_bma280.c \
363 drivers
/accgyro_l3g4200d.c \
364 drivers
/accgyro_mma845x.c \
365 drivers
/accgyro_mpu.c \
366 drivers
/accgyro_mpu3050.c \
367 drivers
/accgyro_mpu6050.c \
368 drivers
/accgyro_mpu6500.c \
369 drivers
/accgyro_spi_mpu6500.c \
371 drivers
/adc_stm32f10x.c \
372 drivers
/barometer_bmp085.c \
373 drivers
/barometer_bmp280.c \
374 drivers
/barometer_ms5611.c \
375 drivers
/barometer_bmp280.c \
377 drivers
/bus_i2c_stm32f10x.c \
378 drivers
/compass_hmc5883l.c \
379 drivers
/display_ug2864hsweg01.h \
380 drivers
/flash_m25p16.c \
381 drivers
/gpio_stm32f10x.c \
383 drivers
/light_led_stm32f10x.c \
384 drivers
/light_ws2811strip.c \
385 drivers
/light_ws2811strip_stm32f10x.c \
386 drivers
/sonar_hcsr04.c \
387 drivers
/pwm_mapping.c \
388 drivers
/pwm_output.c \
390 drivers
/serial_softserial.c \
391 drivers
/serial_uart.c \
392 drivers
/serial_uart_stm32f10x.c \
393 drivers
/sound_beeper_stm32f10x.c \
394 drivers
/system_stm32f10x.c \
396 drivers
/timer_stm32f10x.c \
398 hardware_revision.c \
402 ALIENFLIGHTF1_SRC
= $(NAZE_SRC
)
404 AFROMINI_SRC
= $(NAZE_SRC
)
406 EUSTM32F103RC_SRC
= startup_stm32f10x_hd_gcc.S \
407 drivers
/accgyro_adxl345.c \
408 drivers
/accgyro_bma280.c \
409 drivers
/accgyro_l3g4200d.c \
410 drivers
/accgyro_mma845x.c \
411 drivers
/accgyro_mpu.c \
412 drivers
/accgyro_mpu3050.c \
413 drivers
/accgyro_mpu6050.c \
414 drivers
/accgyro_spi_mpu6000.c \
415 drivers
/accgyro_spi_mpu6500.c \
417 drivers
/adc_stm32f10x.c \
418 drivers
/barometer_bmp085.c \
419 drivers
/barometer_bmp280.c \
420 drivers
/barometer_ms5611.c \
421 drivers
/bus_i2c_stm32f10x.c \
423 drivers
/compass_ak8975.c \
424 drivers
/compass_hmc5883l.c \
425 drivers
/display_ug2864hsweg01.c \
426 drivers
/flash_m25p16.c \
427 drivers
/gpio_stm32f10x.c \
429 drivers
/light_led_stm32f10x.c \
430 drivers
/light_ws2811strip.c \
431 drivers
/light_ws2811strip_stm32f10x.c \
432 drivers
/pwm_mapping.c \
433 drivers
/pwm_output.c \
435 drivers
/serial_softserial.c \
436 drivers
/serial_uart.c \
437 drivers
/serial_uart_stm32f10x.c \
438 drivers
/sonar_hcsr04.c \
439 drivers
/sound_beeper_stm32f10x.c \
440 drivers
/system_stm32f10x.c \
442 drivers
/timer_stm32f10x.c \
447 PORT103R_SRC
= $(EUSTM32F103RC_SRC
)
449 OLIMEXINO_SRC
= startup_stm32f10x_md_gcc.S \
450 drivers
/accgyro_mpu.c \
451 drivers
/accgyro_mpu6050.c \
453 drivers
/adc_stm32f10x.c \
454 drivers
/barometer_bmp085.c \
455 drivers
/barometer_bmp280.c \
456 drivers
/bus_i2c_stm32f10x.c \
458 drivers
/compass_hmc5883l.c \
459 drivers
/gpio_stm32f10x.c \
460 drivers
/light_led_stm32f10x.c \
461 drivers
/light_ws2811strip.c \
462 drivers
/light_ws2811strip_stm32f10x.c \
463 drivers
/pwm_mapping.c \
464 drivers
/pwm_output.c \
466 drivers
/serial_softserial.c \
467 drivers
/serial_uart.c \
468 drivers
/serial_uart_stm32f10x.c \
469 drivers
/sonar_hcsr04.c \
470 drivers
/sound_beeper_stm32f10x.c \
471 drivers
/system_stm32f10x.c \
473 drivers
/timer_stm32f10x.c \
478 startup_stm32f10x_md_gcc.S \
480 drivers
/adc_stm32f10x.c \
481 drivers
/accgyro_mpu.c \
482 drivers
/accgyro_mpu6050.c \
483 drivers
/bus_i2c_stm32f10x.c \
484 drivers
/compass_hmc5883l.c \
485 drivers
/gpio_stm32f10x.c \
486 drivers
/light_led_stm32f10x.c \
487 drivers
/pwm_mapping.c \
488 drivers
/pwm_output.c \
490 drivers
/serial_uart.c \
491 drivers
/serial_uart_stm32f10x.c \
492 drivers
/sound_beeper_stm32f10x.c \
493 drivers
/system_stm32f10x.c \
495 drivers
/timer_stm32f10x.c \
496 hardware_revision.c \
498 blackbox
/blackbox.c \
499 blackbox
/blackbox_io.c \
503 startup_stm32f10x_md_gcc.S \
504 drivers
/accgyro_mpu.c \
505 drivers
/accgyro_spi_mpu6000.c \
507 drivers
/adc_stm32f10x.c \
508 drivers
/barometer_bmp085.c \
509 drivers
/barometer_bmp280.c \
510 drivers
/barometer_ms5611.c \
512 drivers
/bus_i2c_stm32f10x.c \
513 drivers
/compass_hmc5883l.c \
514 drivers
/display_ug2864hsweg01.c \
515 drivers
/flash_m25p16.c \
516 drivers
/gpio_stm32f10x.c \
518 drivers
/light_led_stm32f10x.c \
519 drivers
/light_ws2811strip.c \
520 drivers
/light_ws2811strip_stm32f10x.c \
521 drivers
/pwm_mapping.c \
522 drivers
/pwm_output.c \
524 drivers
/serial_softserial.c \
525 drivers
/serial_uart.c \
526 drivers
/serial_uart_stm32f10x.c \
527 drivers
/sonar_hcsr04.c \
528 drivers
/sound_beeper_stm32f10x.c \
529 drivers
/system_stm32f10x.c \
531 drivers
/timer_stm32f10x.c \
537 STM32F30x_COMMON_SRC
= \
538 startup_stm32f30x_md_gcc.S \
540 drivers
/adc_stm32f30x.c \
541 drivers
/bus_i2c_stm32f30x.c \
543 drivers
/display_ug2864hsweg01.h \
544 drivers
/gpio_stm32f30x.c \
545 drivers
/light_led_stm32f30x.c \
546 drivers
/pwm_mapping.c \
547 drivers
/pwm_output.c \
549 drivers
/serial_uart.c \
550 drivers
/serial_uart_stm32f30x.c \
551 drivers
/sound_beeper_stm32f30x.c \
552 drivers
/system_stm32f30x.c \
554 drivers
/timer_stm32f30x.c
557 $(STM32F30x_COMMON_SRC
) \
562 STM32F3DISCOVERY_COMMON_SRC
= \
563 $(STM32F30x_COMMON_SRC
) \
564 drivers
/light_ws2811strip.c \
565 drivers
/light_ws2811strip_stm32f30x.c \
566 drivers
/accgyro_l3gd20.c \
567 drivers
/accgyro_l3gd20.c \
568 drivers
/accgyro_lsm303dlhc.c \
569 drivers
/compass_hmc5883l.c \
572 STM32F3DISCOVERY_SRC
= \
573 $(STM32F3DISCOVERY_COMMON_SRC
) \
574 drivers
/accgyro_adxl345.c \
575 drivers
/accgyro_bma280.c \
576 drivers
/accgyro_mma845x.c \
577 drivers
/accgyro_mpu.c \
578 drivers
/accgyro_mpu3050.c \
579 drivers
/accgyro_mpu6050.c \
580 drivers
/accgyro_l3g4200d.c \
581 drivers
/barometer_ms5611.c \
582 drivers
/barometer_bmp280.c \
583 drivers
/compass_ak8975.c \
585 drivers
/sdcard_standard.c \
586 io
/asyncfatfs
/asyncfatfs.c \
587 io
/asyncfatfs
/fat_standard.c \
592 $(STM32F3DISCOVERY_SRC
) \
597 $(STM32F30x_COMMON_SRC
) \
599 drivers
/bus_bst_stm32f30x.c \
600 drivers
/accgyro_mpu.c \
601 drivers
/accgyro_mpu6500.c \
602 drivers
/accgyro_spi_mpu6500.c \
603 drivers
/accgyro_mpu6500.c \
604 drivers
/barometer_ms5611.c \
605 drivers
/compass_ak8975.c \
606 drivers
/compass_hmc5883l.c \
607 drivers
/display_ug2864hsweg01.c \
608 drivers
/light_ws2811strip.c \
609 drivers
/light_ws2811strip_stm32f30x.c \
610 drivers
/serial_usb_vcp.c \
616 $(STM32F30x_COMMON_SRC
) \
617 drivers
/accgyro_mpu.c \
618 drivers
/accgyro_mpu6500.c \
619 drivers
/accgyro_spi_mpu6500.c \
620 drivers
/accgyro_mpu6500.c \
621 drivers
/light_ws2811strip.c \
622 drivers
/light_ws2811strip_stm32f30x.c \
623 drivers
/serial_usb_vcp.c \
629 $(STM32F30x_COMMON_SRC
) \
630 drivers
/accgyro_mpu.c \
631 drivers
/accgyro_mpu6500.c \
632 drivers
/accgyro_spi_mpu6500.c \
633 drivers
/barometer_bmp280.c \
634 drivers
/barometer_spi_bmp280.c \
635 drivers
/light_ws2811strip.c \
636 drivers
/light_ws2811strip_stm32f30x.c \
637 drivers
/serial_usb_vcp.c \
643 $(STM32F30x_COMMON_SRC
) \
644 drivers
/display_ug2864hsweg01.c \
645 drivers
/accgyro_mpu.c \
646 drivers
/accgyro_mpu6050.c \
647 drivers
/barometer_ms5611.c \
648 drivers
/barometer_bmp280.c \
649 drivers
/compass_ak8975.c \
650 drivers
/light_ws2811strip.c \
651 drivers
/light_ws2811strip_stm32f30x.c \
652 drivers
/serial_usb_vcp.c \
657 ALIENFLIGHTF3_SRC
= \
658 $(STM32F30x_COMMON_SRC
) \
659 drivers
/accgyro_mpu.c \
660 drivers
/accgyro_mpu6050.c \
661 drivers
/accgyro_mpu.c \
662 drivers
/accgyro_mpu6500.c \
663 drivers
/accgyro_spi_mpu6500.c \
664 drivers
/compass_ak8963.c \
665 hardware_revision.c \
666 drivers
/serial_usb_vcp.c \
667 drivers
/sonar_hcsr04.c \
673 $(STM32F30x_COMMON_SRC
) \
674 drivers
/accgyro_mpu.c \
675 drivers
/accgyro_mpu6050.c \
676 drivers
/barometer_bmp280.c \
677 drivers
/display_ug2864hsweg01.h \
678 drivers
/flash_m25p16.c \
679 drivers
/light_ws2811strip.c \
680 drivers
/light_ws2811strip_stm32f30x.c \
681 drivers
/serial_softserial.c \
682 drivers
/sonar_hcsr04.c \
688 $(STM32F30x_COMMON_SRC
) \
689 drivers
/accgyro_mpu.c \
690 drivers
/accgyro_mpu6050.c \
691 drivers
/barometer_ms5611.c \
692 drivers
/compass_ak8975.c \
693 drivers
/barometer_bmp085.c \
694 drivers
/barometer_bmp280.c \
695 drivers
/compass_hmc5883l.c \
696 drivers
/display_ug2864hsweg01.h \
697 drivers
/flash_m25p16.c \
698 drivers
/light_ws2811strip.c \
699 drivers
/light_ws2811strip_stm32f30x.c \
700 drivers
/serial_softserial.c \
701 drivers
/sonar_hcsr04.c \
707 $(STM32F30x_COMMON_SRC
) \
708 drivers
/accgyro_mpu.c \
709 drivers
/accgyro_mpu6050.c \
710 drivers
/barometer_ms5611.c \
711 drivers
/compass_ak8975.c \
712 drivers
/barometer_bmp085.c \
713 drivers
/barometer_bmp280.c \
714 drivers
/compass_hmc5883l.c \
715 drivers
/display_ug2864hsweg01.h \
716 drivers
/flash_m25p16.c \
717 drivers
/light_ws2811strip.c \
718 drivers
/light_ws2811strip_stm32f30x.c \
719 drivers
/serial_softserial.c \
720 drivers
/sonar_hcsr04.c \
725 SPRACINGF3EVO_SRC
= \
726 $(STM32F30x_COMMON_SRC
) \
727 drivers
/accgyro_mpu.c \
728 drivers
/accgyro_mpu6500.c \
729 drivers
/accgyro_spi_mpu6500.c \
730 drivers
/barometer_bmp280.c \
731 drivers
/compass_ak8963.c \
732 drivers
/display_ug2864hsweg01.h \
733 drivers
/light_ws2811strip.c \
734 drivers
/light_ws2811strip_stm32f30x.c \
735 drivers
/serial_usb_vcp.c \
737 drivers
/sdcard_standard.c \
738 drivers
/transponder_ir.c \
739 drivers
/transponder_ir_stm32f30x.c \
740 io
/asyncfatfs
/asyncfatfs.c \
741 io
/asyncfatfs
/fat_standard.c \
742 io
/transponder_ir.c \
748 $(STM32F30x_COMMON_SRC
) \
749 drivers
/accgyro_mpu.c \
750 drivers
/display_ug2864hsweg01.c \
751 drivers
/accgyro_mpu6050.c \
752 drivers
/accgyro_spi_mpu6000.c \
753 drivers
/barometer_ms5611.c \
754 drivers
/compass_hmc5883l.c \
755 drivers
/light_ws2811strip.c \
756 drivers
/light_ws2811strip_stm32f30x.c \
757 drivers
/serial_softserial.c \
758 drivers
/serial_usb_vcp.c \
759 drivers
/flash_m25p16.c \
765 SPRACINGF3MINI_SRC
= \
766 $(STM32F30x_COMMON_SRC
) \
767 drivers
/accgyro_mpu.c \
768 drivers
/accgyro_mpu6500.c \
769 drivers
/barometer_bmp280.c \
770 drivers
/compass_ak8975.c \
771 drivers
/compass_hmc5883l.c \
772 drivers
/display_ug2864hsweg01.h \
773 drivers
/flash_m25p16.c \
774 drivers
/light_ws2811strip.c \
775 drivers
/light_ws2811strip_stm32f30x.c \
776 drivers
/serial_softserial.c \
777 drivers
/serial_usb_vcp.c \
778 drivers
/sonar_hcsr04.c \
780 drivers
/sdcard_standard.c \
781 drivers
/transponder_ir.c \
782 drivers
/transponder_ir_stm32f30x.c \
783 io
/asyncfatfs
/asyncfatfs.c \
784 io
/asyncfatfs
/fat_standard.c \
785 io
/transponder_ir.c \
791 # Search path and source files for the ST stdperiph library
792 VPATH
:= $(VPATH
):$(STDPERIPH_DIR
)/src
794 ###############################################################################
795 # Things that might need changing to use different tools
799 CC
= arm-none-eabi-gcc
800 OBJCOPY
= arm-none-eabi-objcopy
801 SIZE
= arm-none-eabi-size
809 LTO_FLAGS
= $(OPTIMIZE
)
812 LTO_FLAGS
= -flto
-fuse-linker-plugin
$(OPTIMIZE
)
815 DEBUG_FLAGS
= -ggdb3
-DDEBUG
817 CFLAGS
= $(ARCH_FLAGS
) \
819 $(addprefix -D
,$(OPTIONS
)) \
820 $(addprefix -I
,$(INCLUDE_DIRS
)) \
823 -Wall
-Wextra
-Wunsafe-loop-optimizations
-Wdouble-promotion \
824 -ffunction-sections \
827 -DUSE_STDPERIPH_DRIVER \
829 -D
'__FORKNAME__="$(FORKNAME)"' \
830 -D
'__TARGET__="$(TARGET)"' \
831 -D
'__REVISION__="$(REVISION)"' \
835 ASFLAGS
= $(ARCH_FLAGS
) \
836 -x assembler-with-cpp \
837 $(addprefix -I
,$(INCLUDE_DIRS
)) \
849 -Wl
,-gc-sections
,-Map
,$(TARGET_MAP
) \
850 -Wl
,-L
$(LINKER_DIR
) \
854 ###############################################################################
855 # No user-serviceable parts below
856 ###############################################################################
858 CPPCHECK
= cppcheck
$(CSOURCES
) --enable
=all --platform
=unix64 \
859 --std
=c99
--inline-suppr
--quiet
--force \
860 $(addprefix -I
,$(INCLUDE_DIRS
)) \
861 -I
/usr
/include -I
/usr
/include/linux
864 # Things we will build
866 ifeq ($(filter $(TARGET
),$(VALID_TARGETS
)),)
867 $(error Target
'$(TARGET)' is not valid
, must be one of
$(VALID_TARGETS
))
870 CC3D_OPBL_SRC
= $(CC3D_SRC
)
872 TARGET_BIN
= $(BIN_DIR
)/$(FORKNAME
)_
$(FC_VER
)_
$(TARGET
).bin
873 TARGET_HEX
= $(BIN_DIR
)/$(FORKNAME
)_
$(FC_VER
)_
$(TARGET
).hex
874 TARGET_ELF
= $(OBJECT_DIR
)/$(FORKNAME
)_
$(TARGET
).elf
875 TARGET_OBJS
= $(addsuffix .o
,$(addprefix $(OBJECT_DIR
)/$(TARGET
)/,$(basename $($(TARGET
)_SRC
))))
876 TARGET_DEPS
= $(addsuffix .d
,$(addprefix $(OBJECT_DIR
)/$(TARGET
)/,$(basename $($(TARGET
)_SRC
))))
877 TARGET_MAP
= $(OBJECT_DIR
)/$(FORKNAME
)_
$(TARGET
).map
881 CLEAN_ARTIFACTS
:= $(TARGET_BIN
)
883 CLEAN_ARTIFACTS
:= $(TARGET_HEX
)
885 CLEAN_ARTIFACTS
+= $(TARGET_ELF
) $(TARGET_OBJS
) $(TARGET_MAP
)
887 # List of buildable ELF files and their object dependencies.
888 # It would be nice to compute these lists, but that seems to be just beyond make.
890 $(TARGET_HEX
): $(TARGET_ELF
)
891 $(OBJCOPY
) -O ihex
--set-start
0x8000000 $< $@
893 $(TARGET_BIN
): $(TARGET_ELF
)
894 $(OBJCOPY
) -O binary
$< $@
896 $(TARGET_ELF
): $(TARGET_OBJS
)
897 $(CC
) -o
$@
$^
$(LDFLAGS
)
898 $(SIZE
) $(TARGET_ELF
)
901 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.c
903 @echo
%% $(notdir $<)
904 @
$(CC
) -c
-o
$@
$(CFLAGS
) $<
907 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.s
909 @echo
%% $(notdir $<)
910 @
$(CC
) -c
-o
$@
$(ASFLAGS
) $<
912 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.S
914 @echo
%% $(notdir $<)
915 @
$(CC
) -c
-o
$@
$(ASFLAGS
) $<
918 ## all : default task; compile C code, build firmware
921 ## clean : clean up all temporary / machine-generated files
923 rm -f
$(CLEAN_ARTIFACTS
)
924 rm -rf
$(OBJECT_DIR
)/$(TARGET
)
925 cd src
/test && $(MAKE
) clean || true
927 flash_
$(TARGET
): $(TARGET_HEX
)
928 stty
-F
$(SERIAL_DEVICE
) raw speed
115200 -crtscts cs8
-parenb
-cstopb
-ixon
929 echo
-n
'R' >$(SERIAL_DEVICE
)
930 stm32flash
-w
$(TARGET_HEX
) -v
-g
0x0 -b
115200 $(SERIAL_DEVICE
)
932 ## flash : flash firmware (.hex) onto flight controller
933 flash
: flash_
$(TARGET
)
935 st-flash_
$(TARGET
): $(TARGET_BIN
)
936 st-flash
--reset write
$< 0x08000000
938 ## st-flash : flash firmware (.bin) onto flight controller
939 st-flash
: st-flash_
$(TARGET
)
941 binary
: $(TARGET_BIN
)
944 unbrick_
$(TARGET
): $(TARGET_HEX
)
945 stty
-F
$(SERIAL_DEVICE
) raw speed
115200 -crtscts cs8
-parenb
-cstopb
-ixon
946 stm32flash
-w
$(TARGET_HEX
) -v
-g
0x0 -b
115200 $(SERIAL_DEVICE
)
948 ## unbrick : unbrick flight controller
949 unbrick
: unbrick_
$(TARGET
)
951 ## cppcheck : run static analysis on C source code
952 cppcheck
: $(CSOURCES
)
955 cppcheck-result.xml
: $(CSOURCES
)
956 $(CPPCHECK
) --xml-version
=2 2> cppcheck-result.xml
958 ## help : print this help message and exit
961 @echo
"Makefile for the $(FORKNAME) firmware"
964 @echo
" make [TARGET=<target>] [OPTIONS=\"<options>\"]"
966 @echo
"Valid TARGET values are: $(VALID_TARGETS)"
968 @sed
-n
's/^## //p' $<
970 ## test : run the cleanflight test suite
972 cd src
/test && $(MAKE
) test || true
974 # rebuild everything when makefile changes
975 $(TARGET_OBJS
) : Makefile
977 # include auto-generated dependencies
978 -include $(TARGET_DEPS
)