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.
12 ###############################################################################
15 # Things that the user might override on the commandline
18 # The target to build, see VALID_TARGETS below
19 TARGET ?
= SPRACINGF3NEO
21 # Compile-time options
24 # compile for OpenPilot BootLoader support
27 # Debugger optons, must be empty or GDB
30 # Insert the debugging hardfault debugger
31 # releases should not be built with this flag as it does not disable pwm output
34 # Serial port/Device for flashing
35 SERIAL_DEVICE ?
= $(firstword $(wildcard /dev
/ttyUSB
*) no-port-found
)
37 # Flash size (KB). Some low-end chips actually have more flash than advertised, use this to override.
41 ###############################################################################
42 # Things that need to be maintained as the source changes
45 FORKNAME
= cleanflight
48 ROOT
:= $(patsubst %/,%,$(dir $(lastword
$(MAKEFILE_LIST
))))
49 SRC_DIR
= $(ROOT
)/src
/main
50 OBJECT_DIR
= $(ROOT
)/obj
/main
52 CMSIS_DIR
= $(ROOT
)/lib
/main
/CMSIS
53 INCLUDE_DIRS
= $(SRC_DIR
) \
54 $(ROOT
)/src
/main
/target
55 LINKER_DIR
= $(ROOT
)/src
/main
/target
/link
57 ## V : Set verbosity level based on the V= parameter
60 include $(ROOT
)/make
/build_verbosity.mk
62 # Build tools, so we all share the same versions
63 # import macros common to all supported build systems
64 include $(ROOT
)/make
/system-id.mk
66 # developer preferences, edit these at will, they'll be gitignored
67 -include $(ROOT
)/make
/local.mk
69 # configure some directories that are relative to wherever ROOT_DIR is located
71 TOOLS_DIR
:= $(ROOT
)/tools
73 BUILD_DIR
:= $(ROOT
)/build
74 DL_DIR
:= $(ROOT
)/downloads
78 # import macros that are OS specific
79 include $(ROOT
)/make
/$(OSFAMILY
).mk
81 # include the tools makefile
82 include $(ROOT
)/make
/tools.mk
84 # default xtal value for F4 targets
87 # used for turning on features like VCP and SDCARD
90 OFFICIAL_TARGETS
= ALIENFLIGHTF3 ALIENFLIGHTF4 ANYFCF7 BETAFLIGHTF3 BLUEJAYF4 CC3D FURYF4 NAZE REVO SIRINFPV SPARKY SPRACINGF3 SPRACINGF3EVO SPRACINGF3NEO SPRACINGF3MINI STM32F3DISCOVERY SPRACINGF4EVO
91 ALT_TARGETS
= $(sort $(filter-out target
, $(basename $(notdir $(wildcard $(ROOT
)/src
/main
/target
/*/*.mk
)))))
92 OPBL_TARGETS
= $(filter %_OPBL
, $(ALT_TARGETS
))
93 OSD_SLAVE_TARGETS
= SPRACINGF3OSD
95 VALID_TARGETS
= $(dir $(wildcard $(ROOT
)/src
/main
/target
/*/target.mk
))
96 VALID_TARGETS
:= $(subst /,, $(subst .
/src
/main
/target
/,, $(VALID_TARGETS
)))
97 VALID_TARGETS
:= $(VALID_TARGETS
) $(ALT_TARGETS
)
98 VALID_TARGETS
:= $(sort $(VALID_TARGETS
))
178 GROUP_OTHER_TARGETS
:= $(filter-out $(GROUP_1_TARGETS
) $(GROUP_2_TARGETS
) $(GROUP_3_TARGETS
) $(GROUP_4_TARGETS
), $(VALID_TARGETS
))
181 ifeq ($(filter $(TARGET
),$(ALT_TARGETS
)), $(TARGET
))
182 BASE_TARGET
:= $(firstword $(subst /,, $(subst .
/src
/main
/target
/,, $(dir $(wildcard $(ROOT
)/src
/main
/target
/*/$(TARGET
).mk
)))))
183 -include $(ROOT
)/src
/main
/target
/$(BASE_TARGET
)/$(TARGET
).mk
185 BASE_TARGET
:= $(TARGET
)
188 ifeq ($(filter $(TARGET
),$(OPBL_TARGETS
)), $(TARGET
))
192 ifeq ($(filter $(TARGET
),$(OSD_SLAVE_TARGETS
)), $(TARGET
))
201 # silently ignore if the file is not present. Allows for target specific.
202 -include $(ROOT
)/src
/main
/target
/$(BASE_TARGET
)/target.mk
204 F4_TARGETS
= $(F405_TARGETS
) $(F411_TARGETS
) $(F446_TARGETS
)
205 F7_TARGETS
= $(F7X2RE_TARGETS
) $(F7X5XE_TARGETS
) $(F7X5XG_TARGETS
) $(F7X5XI_TARGETS
) $(F7X6XG_TARGETS
)
207 ifeq ($(filter $(TARGET
),$(VALID_TARGETS
)),)
208 $(error Target
'$(TARGET)' is not valid
, must be one of
$(VALID_TARGETS
). Have you prepared a valid target.mk?
)
211 ifeq ($(filter $(TARGET
),$(F1_TARGETS
) $(F3_TARGETS
) $(F4_TARGETS
) $(F7_TARGETS
) $(SITL_TARGETS
)),)
212 $(error Target
'$(TARGET)' has not specified a valid STM group
, must be one of F1
, F3
, F405
, F411 or F7x5. Have you prepared a valid target.mk?
)
215 128K_TARGETS
= $(F1_TARGETS
)
216 256K_TARGETS
= $(F3_TARGETS
)
217 512K_TARGETS
= $(F411_TARGETS
) $(F446_TARGETS
) $(F7X2RE_TARGETS
) $(F7X5XE_TARGETS
)
218 1024K_TARGETS
= $(F405_TARGETS
) $(F7X5XG_TARGETS
) $(F7X6XG_TARGETS
)
219 2048K_TARGETS
= $(F7X5XI_TARGETS
) $(SITL_TARGETS
)
221 # Configure default flash sizes for the targets (largest size specified gets hit first) if flash not specified already.
222 ifeq ($(FLASH_SIZE
),)
223 ifeq ($(TARGET
),$(filter $(TARGET
),$(2048K_TARGETS
)))
225 else ifeq ($(TARGET
),$(filter $(TARGET
),$(1024K_TARGETS
)))
227 else ifeq ($(TARGET
),$(filter $(TARGET
),$(512K_TARGETS
)))
229 else ifeq ($(TARGET
),$(filter $(TARGET
),$(256K_TARGETS
)))
231 else ifeq ($(TARGET
),$(filter $(TARGET
),$(128K_TARGETS
)))
234 $(error FLASH_SIZE not configured for target
$(TARGET
))
238 # note that there is no hardfault debugging startup file assembly handler for other platforms
239 ifeq ($(DEBUG_HARDFAULTS
),F3
)
240 CFLAGS
+= -DDEBUG_HARDFAULTS
241 STM32F30x_COMMON_SRC
= startup_stm32f3_debug_hardfault_handler.S
243 STM32F30x_COMMON_SRC
= startup_stm32f30x_md_gcc.S
246 ifeq ($(DEBUG_HARDFAULTS
),F7
)
247 CFLAGS
+= -DDEBUG_HARDFAULTS
250 REVISION
:= $(shell git log
-1 --format
="%h")
252 FC_VER_MAJOR
:= $(shell grep
" FC_VERSION_MAJOR" src
/main
/build
/version.h | awk
'{print $$3}' )
253 FC_VER_MINOR
:= $(shell grep
" FC_VERSION_MINOR" src
/main
/build
/version.h | awk
'{print $$3}' )
254 FC_VER_PATCH
:= $(shell grep
" FC_VERSION_PATCH" src
/main
/build
/version.h | awk
'{print $$3}' )
256 FC_VER
:= $(FC_VER_MAJOR
).
$(FC_VER_MINOR
).
$(FC_VER_PATCH
)
258 # Search path for sources
259 VPATH
:= $(SRC_DIR
):$(SRC_DIR
)/startup
260 USBFS_DIR
= $(ROOT
)/lib
/main
/STM32_USB-FS-Device_Driver
261 USBPERIPH_SRC
= $(notdir $(wildcard $(USBFS_DIR
)/src
/*.c
))
262 FATFS_DIR
= $(ROOT
)/lib
/main
/FatFS
263 FATFS_SRC
= $(notdir $(wildcard $(FATFS_DIR
)/*.c
))
265 CSOURCES
:= $(shell find
$(SRC_DIR
) -name
'*.c')
267 ifeq ($(TARGET
),$(filter $(TARGET
),$(F3_TARGETS
)))
270 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F30x_StdPeriph_Driver
271 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/src
/*.c
))
272 EXCLUDES
= stm32f30x_crc.c \
274 STARTUP_SRC
= startup_stm32f30x_md_gcc.S
276 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
277 DEVICE_STDPERIPH_SRC
= $(STDPERIPH_SRC
)
279 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM1
/CoreSupport
:$(CMSIS_DIR
)/CM1
/DeviceSupport
/ST
/STM32F30x
280 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM1
/CoreSupport
/*.c \
281 $(CMSIS_DIR
)/CM1
/DeviceSupport
/ST
/STM32F30x
/*.c
))
283 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
284 $(STDPERIPH_DIR
)/inc \
285 $(CMSIS_DIR
)/CM1
/CoreSupport \
286 $(CMSIS_DIR
)/CM1
/DeviceSupport
/ST
/STM32F30x
288 ifneq ($(filter VCP
, $(FEATURES
)),)
289 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
293 VPATH
:= $(VPATH
):$(USBFS_DIR
)/src
295 DEVICE_STDPERIPH_SRC
:= $(DEVICE_STDPERIPH_SRC
)\
299 ifneq ($(filter SDCARD
, $(FEATURES
)),)
300 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
303 VPATH
:= $(VPATH
):$(FATFS_DIR
)
306 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f303_
$(FLASH_SIZE
)k.
ld
308 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m4
-mfloat-abi
=hard
-mfpu
=fpv4-sp-d16
-fsingle-precision-constant
-Wdouble-promotion
309 DEVICE_FLAGS
= -DSTM32F303xC
-DSTM32F303
313 else ifeq ($(TARGET
),$(filter $(TARGET
), $(F4_TARGETS
)))
316 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F4xx_StdPeriph_Driver
317 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/src
/*.c
))
318 EXCLUDES
= stm32f4xx_crc.c \
324 stm32f4xx_flash_ramfunc.c \
328 stm32f4xx_spdifrx.c \
330 stm32f4xx_cryp_aes.c \
331 stm32f4xx_hash_md5.c \
332 stm32f4xx_cryp_des.c \
336 stm32f4xx_cryp_tdes.c \
337 stm32f4xx_hash_sha1.c
339 ifeq ($(TARGET
),$(filter $(TARGET
), $(F411_TARGETS
)))
340 EXCLUDES
+= stm32f4xx_fsmc.c
343 ifeq ($(TARGET
),$(filter $(TARGET
), $(F446_TARGETS
)))
344 EXCLUDES
+= stm32f4xx_fsmc.c
347 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
350 USBCORE_DIR
= $(ROOT
)/lib
/main
/STM32_USB_Device_Library
/Core
351 USBCORE_SRC
= $(notdir $(wildcard $(USBCORE_DIR
)/src
/*.c
))
352 USBOTG_DIR
= $(ROOT
)/lib
/main
/STM32_USB_OTG_Driver
353 USBOTG_SRC
= $(notdir $(wildcard $(USBOTG_DIR
)/src
/*.c
))
354 EXCLUDES
= usb_bsp_template.c \
355 usb_conf_template.c \
360 USBOTG_SRC
:= $(filter-out ${EXCLUDES}, $(USBOTG_SRC
))
361 USBCDC_DIR
= $(ROOT
)/lib
/main
/STM32_USB_Device_Library
/Class
/cdc
362 USBCDC_SRC
= $(notdir $(wildcard $(USBCDC_DIR
)/src
/*.c
))
363 EXCLUDES
= usbd_cdc_if_template.c
364 USBCDC_SRC
:= $(filter-out ${EXCLUDES}, $(USBCDC_SRC
))
365 VPATH
:= $(VPATH
):$(USBOTG_DIR
)/src
:$(USBCORE_DIR
)/src
:$(USBCDC_DIR
)/src
367 DEVICE_STDPERIPH_SRC
:= $(STDPERIPH_SRC
) \
373 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM4
/CoreSupport
:$(CMSIS_DIR
)/CM4
/DeviceSupport
/ST
/STM32F4xx
374 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM4
/CoreSupport
/*.c \
375 $(CMSIS_DIR
)/CM4
/DeviceSupport
/ST
/STM32F4xx
/*.c
))
376 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
377 $(STDPERIPH_DIR
)/inc \
382 $(CMSIS_DIR
)/CM4
/CoreSupport \
383 $(CMSIS_DIR
)/CM4
/DeviceSupport
/ST
/STM32F4xx \
384 $(ROOT
)/src
/main
/vcpf4
386 ifneq ($(filter SDCARD
,$(FEATURES
)),)
387 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
389 VPATH
:= $(VPATH
):$(FATFS_DIR
)
393 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m4
-march
=armv7e-m
-mfloat-abi
=hard
-mfpu
=fpv4-sp-d16
-fsingle-precision-constant
-Wdouble-promotion
395 ifeq ($(TARGET
),$(filter $(TARGET
),$(F411_TARGETS
)))
396 DEVICE_FLAGS
= -DSTM32F411xE
397 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f411.
ld
398 STARTUP_SRC
= startup_stm32f411xe.s
399 else ifeq ($(TARGET
),$(filter $(TARGET
),$(F405_TARGETS
)))
400 DEVICE_FLAGS
= -DSTM32F40_41xxx
401 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f405.
ld
402 STARTUP_SRC
= startup_stm32f40xx.s
403 else ifeq ($(TARGET
),$(filter $(TARGET
),$(F446_TARGETS
)))
404 DEVICE_FLAGS
= -DSTM32F446xx
405 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f446.
ld
406 STARTUP_SRC
= startup_stm32f446xx.s
408 $(error Unknown MCU for F4 target
)
410 DEVICE_FLAGS
+= -DHSE_VALUE
=$(HSE_VALUE
)
415 else ifeq ($(TARGET
),$(filter $(TARGET
), $(F7_TARGETS
)))
418 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F7xx_HAL_Driver
419 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/Src
/*.c
))
420 EXCLUDES
= stm32f7xx_hal_can.c \
421 stm32f7xx_hal_cec.c \
422 stm32f7xx_hal_crc.c \
423 stm32f7xx_hal_crc_ex.c \
424 stm32f7xx_hal_cryp.c \
425 stm32f7xx_hal_cryp_ex.c \
426 stm32f7xx_hal_dac.c \
427 stm32f7xx_hal_dac_ex.c \
428 stm32f7xx_hal_dcmi.c \
429 stm32f7xx_hal_dcmi_ex.c \
430 stm32f7xx_hal_dfsdm.c \
431 stm32f7xx_hal_dma2d.c \
432 stm32f7xx_hal_dsi.c \
433 stm32f7xx_hal_eth.c \
434 stm32f7xx_hal_hash.c \
435 stm32f7xx_hal_hash_ex.c \
436 stm32f7xx_hal_hcd.c \
437 stm32f7xx_hal_i2s.c \
438 stm32f7xx_hal_irda.c \
439 stm32f7xx_hal_iwdg.c \
440 stm32f7xx_hal_jpeg.c \
441 stm32f7xx_hal_lptim.c \
442 stm32f7xx_hal_ltdc.c \
443 stm32f7xx_hal_ltdc_ex.c \
444 stm32f7xx_hal_mdios.c \
445 stm32f7xx_hal_mmc.c \
446 stm32f7xx_hal_msp_template.c \
447 stm32f7xx_hal_nand.c \
448 stm32f7xx_hal_nor.c \
449 stm32f7xx_hal_qspi.c \
450 stm32f7xx_hal_rng.c \
451 stm32f7xx_hal_rtc.c \
452 stm32f7xx_hal_rtc_ex.c \
453 stm32f7xx_hal_sai.c \
454 stm32f7xx_hal_sai_ex.c \
456 stm32f7xx_hal_sdram.c \
457 stm32f7xx_hal_smartcard.c \
458 stm32f7xx_hal_smartcard_ex.c \
459 stm32f7xx_hal_smbus.c \
460 stm32f7xx_hal_spdifrx.c \
461 stm32f7xx_hal_sram.c \
462 stm32f7xx_hal_timebase_rtc_alarm_template.c \
463 stm32f7xx_hal_timebase_rtc_wakeup_template.c \
464 stm32f7xx_hal_timebase_tim_template.c \
465 stm32f7xx_hal_wwdg.c \
470 stm32f7xx_ll_dma2d.c \
471 stm32f7xx_ll_exti.c \
473 stm32f7xx_ll_gpio.c \
475 stm32f7xx_ll_lptim.c \
480 stm32f7xx_ll_sdmmc.c \
483 stm32f7xx_ll_usart.c \
486 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
489 USBCORE_DIR
= $(ROOT
)/lib
/main
/Middlewares
/ST
/STM32_USB_Device_Library
/Core
490 USBCORE_SRC
= $(notdir $(wildcard $(USBCORE_DIR
)/Src
/*.c
))
491 EXCLUDES
= usbd_conf_template.c
492 USBCORE_SRC
:= $(filter-out ${EXCLUDES}, $(USBCORE_SRC
))
494 USBCDC_DIR
= $(ROOT
)/lib
/main
/Middlewares
/ST
/STM32_USB_Device_Library
/Class
/CDC
495 USBCDC_SRC
= $(notdir $(wildcard $(USBCDC_DIR
)/Src
/*.c
))
496 EXCLUDES
= usbd_cdc_if_template.c
497 USBCDC_SRC
:= $(filter-out ${EXCLUDES}, $(USBCDC_SRC
))
499 VPATH
:= $(VPATH
):$(USBCDC_DIR
)/Src
:$(USBCORE_DIR
)/Src
501 DEVICE_STDPERIPH_SRC
:= $(STDPERIPH_SRC
) \
506 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM7
/Include
:$(CMSIS_DIR
)/CM7
/Device
/ST
/STM32F7xx
507 VPATH
:= $(VPATH
):$(STDPERIPH_DIR
)/Src
508 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM7
/Include
/*.c \
509 $(CMSIS_DIR
)/CM7
/Device
/ST
/STM32F7xx
/*.c
))
510 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
511 $(STDPERIPH_DIR
)/Inc \
514 $(CMSIS_DIR
)/CM7
/Include \
515 $(CMSIS_DIR
)/CM7
/Device
/ST
/STM32F7xx
/Include \
516 $(ROOT
)/src
/main
/vcp_hal
518 ifneq ($(filter SDCARD
,$(FEATURES
)),)
519 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
521 VPATH
:= $(VPATH
):$(FATFS_DIR
)
525 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m7
-mfloat-abi
=hard
-mfpu
=fpv5-sp-d16
-fsingle-precision-constant
-Wdouble-promotion
527 ifeq ($(TARGET
),$(filter $(TARGET
),$(F7X5XG_TARGETS
)))
528 DEVICE_FLAGS
= -DSTM32F745xx
-DUSE_HAL_DRIVER
-D__FPU_PRESENT
529 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f745.
ld
530 STARTUP_SRC
= startup_stm32f745xx.s
531 else ifeq ($(TARGET
),$(filter $(TARGET
),$(F7X6XG_TARGETS
)))
532 DEVICE_FLAGS
= -DSTM32F746xx
-DUSE_HAL_DRIVER
-D__FPU_PRESENT
533 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f746.
ld
534 STARTUP_SRC
= startup_stm32f746xx.s
535 else ifeq ($(TARGET
),$(filter $(TARGET
),$(F7X2RE_TARGETS
)))
536 DEVICE_FLAGS
= -DSTM32F722xx
-DUSE_HAL_DRIVER
-D__FPU_PRESENT
537 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f722.
ld
538 STARTUP_SRC
= startup_stm32f722xx.s
540 $(error Unknown MCU for F7 target
)
542 DEVICE_FLAGS
+= -DHSE_VALUE
=$(HSE_VALUE
)
544 TARGET_FLAGS
= -D
$(TARGET
)
549 else ifeq ($(TARGET
),$(filter $(TARGET
), $(SITL_TARGETS
)))
551 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
552 $(ROOT
)/lib
/main
/dyad
554 SITL_SRC
:= $(ROOT
)/lib
/main
/dyad
/dyad.c
559 LD_SCRIPT
= src
/main
/target
/SITL
/parameter_group.
ld
562 TARGET_FLAGS
= -D
$(TARGET
)
571 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F10x_StdPeriph_Driver
572 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/src
/*.c
))
573 EXCLUDES
= stm32f10x_crc.c \
576 STARTUP_SRC
= startup_stm32f10x_md_gcc.S
577 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
579 # Search path and source files for the CMSIS sources
580 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM3
/CoreSupport
:$(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
581 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM3
/CoreSupport
/*.c \
582 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
/*.c
))
584 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
585 $(STDPERIPH_DIR
)/inc \
586 $(CMSIS_DIR
)/CM3
/CoreSupport \
587 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
589 DEVICE_STDPERIPH_SRC
= $(STDPERIPH_SRC
)
591 ifneq ($(filter VCP
, $(FEATURES
)),)
592 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
596 VPATH
:= $(VPATH
):$(USBFS_DIR
)/src
598 DEVICE_STDPERIPH_SRC
:= $(DEVICE_STDPERIPH_SRC
) \
603 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f103_
$(FLASH_SIZE
)k.
ld
604 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m3
606 ifeq ($(DEVICE_FLAGS
),)
607 DEVICE_FLAGS
= -DSTM32F10X_MD
609 DEVICE_FLAGS
+= -DSTM32F10X
615 ifneq ($(BASE_TARGET
), $(TARGET
))
616 TARGET_FLAGS
:= $(TARGET_FLAGS
) -D
$(BASE_TARGET
)
619 ifneq ($(FLASH_SIZE
),)
620 DEVICE_FLAGS
:= $(DEVICE_FLAGS
) -DFLASH_SIZE
=$(FLASH_SIZE
)
623 ifneq ($(HSE_VALUE
),)
624 DEVICE_FLAGS
:= $(DEVICE_FLAGS
) -DHSE_VALUE
=$(HSE_VALUE
)
627 TARGET_DIR
= $(ROOT
)/src
/main
/target
/$(BASE_TARGET
)
628 TARGET_DIR_SRC
= $(notdir $(wildcard $(TARGET_DIR
)/*.c
))
631 TARGET_FLAGS
:= -DOPBL
$(TARGET_FLAGS
)
632 ifeq ($(TARGET
), $(filter $(TARGET
),$(F405_TARGETS
)))
633 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f405_opbl.
ld
634 else ifeq ($(TARGET
), $(filter $(TARGET
),$(F411_TARGETS
)))
635 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f411_opbl.
ld
636 else ifeq ($(TARGET
), $(filter $(TARGET
),$(F3_TARGETS
)))
637 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f303_
$(FLASH_SIZE
)k_opbl.
ld
638 else ifeq ($(TARGET
), $(filter $(TARGET
),$(F1_TARGETS
)))
639 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f103_
$(FLASH_SIZE
)k_opbl.
ld
641 .DEFAULT_GOAL
:= binary
646 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
647 $(ROOT
)/lib
/main
/MAVLink
649 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
652 VPATH
:= $(VPATH
):$(TARGET_DIR
)
655 build
/build_config.c \
665 common
/typeconversion.c \
666 config
/config_eeprom.c \
668 config
/parameter_group.c \
669 config
/config_streamer.c \
671 drivers
/buf_writer.c \
672 drivers
/bus_i2c_soft.c \
674 drivers
/bus_spi_soft.c \
678 drivers
/light_led.c \
682 drivers
/serial_uart.c \
683 drivers
/sound_beeper.c \
684 drivers
/stack_check.c \
687 drivers
/transponder_ir.c \
688 drivers
/transponder_ir_arcitimer.c \
689 drivers
/transponder_ir_ilap.c \
695 fc/runtime_config.c \
698 io
/statusindicator.c \
699 io
/transponder_ir.c \
701 scheduler
/scheduler.c \
707 io
/displayport_max7456.c \
708 osd_slave
/osd_slave_init.c \
713 fc/controlrate_profile.c \
714 drivers
/gyro_sync.c \
715 drivers
/rx_nrf24l01.c \
718 drivers
/pwm_esc_detect.c \
719 drivers
/pwm_output.c \
721 drivers
/serial_softserial.c \
724 fc/rc_adjustments.c \
734 io
/serial_4way_avrootloader.c \
735 io
/serial_4way_stk500v2.c \
753 sensors
/acceleration.c \
754 sensors
/boardalignment.c \
757 sensors
/gyroanalyse.c \
758 sensors
/initialisation.c \
759 blackbox
/blackbox.c \
760 blackbox
/blackbox_io.c \
762 cms
/cms_menu_blackbox.c \
763 cms
/cms_menu_builtin.c \
765 cms
/cms_menu_ledstrip.c \
766 cms
/cms_menu_misc.c \
769 common
/colorconversion.c \
770 common
/gps_conversion.c \
771 drivers
/display_ug2864hsweg01.c \
772 drivers
/light_ws2811strip.c \
773 drivers
/serial_escserial.c \
774 drivers
/sonar_hcsr04.c \
775 drivers
/vtx_common.c \
776 flight
/navigation.c \
778 io
/displayport_max7456.c \
779 io
/displayport_msp.c \
780 io
/displayport_oled.c \
785 sensors
/barometer.c \
786 telemetry
/telemetry.c \
791 telemetry
/smartport.c \
793 telemetry
/mavlink.c \
795 telemetry
/ibus_shared.c \
796 sensors
/esc_sensor.c \
798 io
/vtx_smartaudio.c \
802 COMMON_DEVICE_SRC
= \
804 $(DEVICE_STDPERIPH_SRC
)
806 ifeq ($(OSD_SLAVE
),yes
)
807 TARGET_FLAGS
:= -DUSE_OSD_SLAVE
$(TARGET_FLAGS
)
808 COMMON_SRC
:= $(COMMON_SRC
) $(OSD_SLAVE_SRC
) $(COMMON_DEVICE_SRC
)
810 COMMON_SRC
:= $(COMMON_SRC
) $(FC_SRC
) $(COMMON_DEVICE_SRC
)
814 SPEED_OPTIMISED_SRC
:= ""
815 SIZE_OPTIMISED_SRC
:= ""
817 ifeq ($(TARGET
),$(filter $(TARGET
),$(F3_TARGETS
)))
818 SPEED_OPTIMISED_SRC
:= $(SPEED_OPTIMISED_SRC
) \
822 common
/typeconversion.c \
824 drivers
/buf_writer.c \
825 drivers
/bus_i2c_soft.c \
827 drivers
/bus_spi_soft.c \
829 drivers
/gyro_sync.c \
831 drivers
/light_led.c \
833 drivers
/rx_nrf24l01.c \
836 drivers
/pwm_output.c \
840 drivers
/serial_uart.c \
841 drivers
/sound_beeper.c \
848 fc/runtime_config.c \
870 scheduler
/scheduler.c \
871 sensors
/acceleration.c \
872 sensors
/boardalignment.c \
874 sensors
/gyroanalyse.c \
876 $(DEVICE_STDPERIPH_SRC
) \
877 drivers
/display_ug2864hsweg01.c \
878 drivers
/light_ws2811strip.c \
879 drivers
/serial_softserial.c \
881 io
/displayport_max7456.c \
885 SIZE_OPTIMISED_SRC
:= $(SIZE_OPTIMISED_SRC
) \
886 drivers
/serial_escserial.c \
887 drivers
/vtx_common.c \
890 io
/serial_4way_avrootloader.c \
891 io
/serial_4way_stk500v2.c \
894 cms
/cms_menu_blackbox.c \
895 cms
/cms_menu_builtin.c \
897 cms
/cms_menu_ledstrip.c \
898 cms
/cms_menu_misc.c \
901 io
/vtx_smartaudio.c \
905 ifeq ($(TARGET
),$(filter $(TARGET
),$(F4_TARGETS
)))
907 vcpf4
/stm32f4xx_it.c \
911 vcpf4
/usbd_cdc_vcp.c \
912 drivers
/serial_usb_vcp.c \
914 else ifeq ($(TARGET
),$(filter $(TARGET
),$(F7_TARGETS
)))
916 vcp_hal
/usbd_desc.c \
917 vcp_hal
/usbd_conf.c \
918 vcp_hal
/usbd_cdc_interface.c \
919 drivers
/serial_usb_vcp.c \
930 drivers
/serial_usb_vcp.c \
934 STM32F10x_COMMON_SRC
= \
935 drivers
/adc_stm32f10x.c \
936 drivers
/bus_i2c_stm32f10x.c \
938 drivers
/gpio_stm32f10x.c \
940 drivers
/light_ws2811strip_stdperiph.c \
941 drivers
/serial_uart_stm32f10x.c \
942 drivers
/system_stm32f10x.c \
943 drivers
/timer_stm32f10x.c
945 STM32F30x_COMMON_SRC
= \
946 target
/system_stm32f30x.c \
947 drivers
/adc_stm32f30x.c \
948 drivers
/bus_i2c_stm32f30x.c \
950 drivers
/gpio_stm32f30x.c \
951 drivers
/light_ws2811strip_stdperiph.c \
952 drivers
/pwm_output_dshot.c \
953 drivers
/serial_uart_stm32f30x.c \
954 drivers
/system_stm32f30x.c \
955 drivers
/timer_stm32f30x.c
957 STM32F4xx_COMMON_SRC
= \
958 target
/system_stm32f4xx.c \
959 drivers
/accgyro_mpu.c \
960 drivers
/adc_stm32f4xx.c \
961 drivers
/bus_i2c_stm32f10x.c \
962 drivers
/dma_stm32f4xx.c \
963 drivers
/gpio_stm32f4xx.c \
965 drivers
/light_ws2811strip_stdperiph.c \
966 drivers
/pwm_output_dshot.c \
967 drivers
/serial_uart_stm32f4xx.c \
968 drivers
/system_stm32f4xx.c \
969 drivers
/timer_stm32f4xx.c
971 STM32F7xx_COMMON_SRC
= \
972 target
/system_stm32f7xx.c \
973 drivers
/accgyro_mpu.c \
974 drivers
/adc_stm32f7xx.c \
975 drivers
/bus_i2c_hal.c \
976 drivers
/dma_stm32f7xx.c \
977 drivers
/gpio_stm32f7xx.c \
979 drivers
/bus_spi_hal.c \
980 drivers
/pwm_output_stm32f7xx.c \
981 drivers
/timer_hal.c \
982 drivers
/timer_stm32f7xx.c \
983 drivers
/system_stm32f7xx.c \
984 drivers
/serial_uart_stm32f7xx.c \
985 drivers
/serial_uart_hal.c
987 F7EXCLUDES
= drivers
/bus_spi.c \
990 drivers
/serial_uart.c
997 drivers
/pwm_output.c \
999 drivers
/light_led.c \
1002 drivers
/serial_uart.c \
1005 # check if target.mk supplied
1006 ifeq ($(TARGET
),$(filter $(TARGET
),$(F4_TARGETS
)))
1007 SRC
:= $(STARTUP_SRC
) $(STM32F4xx_COMMON_SRC
) $(TARGET_SRC
) $(VARIANT_SRC
)
1008 else ifeq ($(TARGET
),$(filter $(TARGET
),$(F7_TARGETS
)))
1009 SRC
:= $(STARTUP_SRC
) $(STM32F7xx_COMMON_SRC
) $(TARGET_SRC
) $(VARIANT_SRC
)
1010 else ifeq ($(TARGET
),$(filter $(TARGET
),$(F3_TARGETS
)))
1011 SRC
:= $(STARTUP_SRC
) $(STM32F30x_COMMON_SRC
) $(TARGET_SRC
) $(VARIANT_SRC
)
1012 else ifeq ($(TARGET
),$(filter $(TARGET
),$(F1_TARGETS
)))
1013 SRC
:= $(STARTUP_SRC
) $(STM32F10x_COMMON_SRC
) $(TARGET_SRC
) $(VARIANT_SRC
)
1014 else ifeq ($(TARGET
),$(filter $(TARGET
),$(SITL_TARGETS
)))
1015 SRC
:= $(TARGET_SRC
) $(SITL_SRC
) $(VARIANT_SRC
)
1018 ifneq ($(filter $(TARGET
),$(F4_TARGETS
) $(F7_TARGETS
)),)
1019 DSPLIB
:= $(ROOT
)/lib
/main
/DSP_Lib
1020 DEVICE_FLAGS
+= -DARM_MATH_CM4
-DARM_MATH_MATRIX_CHECK
-DARM_MATH_ROUNDING
-D__FPU_PRESENT
=1 -DUNALIGNED_SUPPORT_DISABLE
1022 INCLUDE_DIRS
+= $(DSPLIB
)/Include
1024 SRC
+= $(DSPLIB
)/Source
/TransformFunctions
/arm_rfft_fast_f32.c
1025 SRC
+= $(DSPLIB
)/Source
/TransformFunctions
/arm_cfft_f32.c
1026 SRC
+= $(DSPLIB
)/Source
/TransformFunctions
/arm_rfft_fast_init_f32.c
1027 SRC
+= $(DSPLIB
)/Source
/TransformFunctions
/arm_cfft_radix8_f32.c
1028 SRC
+= $(DSPLIB
)/Source
/CommonTables
/arm_common_tables.c
1030 SRC
+= $(DSPLIB
)/Source
/ComplexMathFunctions
/arm_cmplx_mag_f32.c
1031 SRC
+= $(DSPLIB
)/Source
/StatisticsFunctions
/arm_max_f32.c
1033 SRC
+= $(wildcard $(DSPLIB
)/Source
/*/*.S
)
1037 ifneq ($(filter ONBOARDFLASH
,$(FEATURES
)),)
1039 drivers
/flash_m25p16.c \
1043 SRC
+= $(COMMON_SRC
)
1046 ifeq ($(TARGET
),$(filter $(TARGET
),$(F7_TARGETS
)))
1047 SRC
:= $(filter-out ${F7EXCLUDES}, $(SRC
))
1051 ifeq ($(TARGET
),$(filter $(TARGET
),$(SITL_TARGETS
)))
1052 SRC
:= $(filter-out ${SITLEXCLUDES}, $(SRC
))
1055 ifneq ($(filter SDCARD
,$(FEATURES
)),)
1058 drivers
/sdcard_standard.c \
1059 io
/asyncfatfs
/asyncfatfs.c \
1060 io
/asyncfatfs
/fat_standard.c
1063 ifneq ($(filter VCP
,$(FEATURES
)),)
1066 # end target specific make file checks
1069 # Search path and source files for the ST stdperiph library
1070 VPATH
:= $(VPATH
):$(STDPERIPH_DIR
)/src
1072 ###############################################################################
1073 # Things that might need changing to use different tools
1076 # Find out if ccache is installed on the system
1078 RESULT
= $(shell (which
$(CCACHE
) > /dev
/null
2>&1; echo
$$?
) )
1084 CROSS_CC
:= $(CCACHE
) $(ARM_SDK_PREFIX
)gcc
1085 CROSS_CXX
:= $(CCACHE
) $(ARM_SDK_PREFIX
)g
++
1086 OBJCOPY
:= $(ARM_SDK_PREFIX
)objcopy
1087 SIZE
:= $(ARM_SDK_PREFIX
)size
1093 ifneq ($(DEBUG
),GDB
)
1094 OPTIMISATION_BASE
:= -flto
-fuse-linker-plugin
-ffast-math
1095 OPTIMISE_SPEED
:= ""
1098 ifeq ($(TARGET
),$(filter $(TARGET
),$(F1_TARGETS
)))
1099 OPTIMISE_DEFAULT
:= -Os
1101 LTO_FLAGS
:= $(OPTIMISATION_BASE
) $(OPTIMISE_DEFAULT
)
1103 else ifeq ($(TARGET
),$(filter $(TARGET
),$(F3_TARGETS
)))
1104 OPTIMISE_DEFAULT
:= -O2
1105 OPTIMISE_SPEED
:= -Ofast
1106 OPTIMISE_SIZE
:= -Os
1108 LTO_FLAGS
:= $(OPTIMISATION_BASE
) $(OPTIMISE_SPEED
)
1110 else ifeq ($(TARGET
),$(filter $(TARGET
),$(SITL_TARGETS
)))
1111 OPTIMISE_DEFAULT
:= -Ofast
1112 OPTIMISE_SPEED
:= -Ofast
1113 OPTIMISE_SIZE
:= -Os
1115 LTO_FLAGS
:= $(OPTIMISATION_BASE
) $(OPTIMISE_SPEED
)
1118 OPTIMISE_DEFAULT
:= -Ofast
1120 LTO_FLAGS
:= $(OPTIMISATION_BASE
) $(OPTIMISE_DEFAULT
)
1124 CC_DEFAULT_OPTIMISATION
:= $(OPTIMISATION_BASE
) $(OPTIMISE_DEFAULT
)
1125 CC_SPEED_OPTIMISATION
:= $(OPTIMISATION_BASE
) $(OPTIMISE_SPEED
)
1126 CC_SIZE_OPTIMISATION
:= $(OPTIMISATION_BASE
) $(OPTIMISE_SIZE
)
1129 OPTIMISE_DEFAULT
:= -O0
1131 CC_DEBUG_OPTIMISATION
:= $(OPTIMISE_DEFAULT
)
1133 LTO_FLAGS
:= $(OPTIMISE_DEFAULT
)
1136 DEBUG_FLAGS
= -ggdb3
-DDEBUG
1138 CFLAGS
+= $(ARCH_FLAGS
) \
1139 $(addprefix -D
,$(OPTIONS
)) \
1140 $(addprefix -I
,$(INCLUDE_DIRS
)) \
1143 -Wall
-Wextra
-Wunsafe-loop-optimizations
-Wdouble-promotion \
1144 -ffunction-sections \
1148 -DUSE_STDPERIPH_DRIVER \
1151 -D
'__FORKNAME__="$(FORKNAME)"' \
1152 -D
'__TARGET__="$(TARGET)"' \
1153 -D
'__REVISION__="$(REVISION)"' \
1157 ASFLAGS
= $(ARCH_FLAGS
) \
1158 -x assembler-with-cpp \
1159 $(addprefix -I
,$(INCLUDE_DIRS
)) \
1164 --specs
=nano.specs \
1171 -Wl
,-gc-sections
,-Map
,$(TARGET_MAP
) \
1172 -Wl
,-L
$(LINKER_DIR
) \
1174 -Wl
,--no-wchar-size-warning \
1178 ifeq ($(TARGET
),$(filter $(TARGET
),$(SITL_TARGETS
)))
1189 -Wl
,-gc-sections
,-Map
,$(TARGET_MAP
) \
1190 -Wl
,-L
$(LINKER_DIR
) \
1195 ###############################################################################
1196 # No user-serviceable parts below
1197 ###############################################################################
1199 CPPCHECK
= cppcheck
$(CSOURCES
) --enable
=all --platform
=unix64 \
1200 --std
=c99
--inline-suppr
--quiet
--force \
1201 $(addprefix -I
,$(INCLUDE_DIRS
)) \
1202 -I
/usr
/include -I
/usr
/include/linux
1205 # Things we will build
1207 TARGET_BIN
= $(BIN_DIR
)/$(FORKNAME
)_
$(FC_VER
)_
$(TARGET
).bin
1208 TARGET_HEX
= $(BIN_DIR
)/$(FORKNAME
)_
$(FC_VER
)_
$(TARGET
).hex
1209 TARGET_ELF
= $(OBJECT_DIR
)/$(FORKNAME
)_
$(TARGET
).elf
1210 TARGET_OBJS
= $(addsuffix .o
,$(addprefix $(OBJECT_DIR
)/$(TARGET
)/,$(basename $(SRC
))))
1211 TARGET_DEPS
= $(addsuffix .d
,$(addprefix $(OBJECT_DIR
)/$(TARGET
)/,$(basename $(SRC
))))
1212 TARGET_MAP
= $(OBJECT_DIR
)/$(FORKNAME
)_
$(TARGET
).map
1215 CLEAN_ARTIFACTS
:= $(TARGET_BIN
)
1216 CLEAN_ARTIFACTS
+= $(TARGET_HEX
)
1217 CLEAN_ARTIFACTS
+= $(TARGET_ELF
) $(TARGET_OBJS
) $(TARGET_MAP
)
1219 # Make sure build date and revision is updated on every incremental build
1220 $(OBJECT_DIR
)/$(TARGET
)/build
/version.o
: $(SRC
)
1222 # List of buildable ELF files and their object dependencies.
1223 # It would be nice to compute these lists, but that seems to be just beyond make.
1225 $(TARGET_HEX
): $(TARGET_ELF
)
1226 $(V0
) $(OBJCOPY
) -O ihex
--set-start
0x8000000 $< $@
1228 $(TARGET_BIN
): $(TARGET_ELF
)
1229 $(V0
) $(OBJCOPY
) -O binary
$< $@
1231 $(TARGET_ELF
): $(TARGET_OBJS
)
1232 $(V1
) echo Linking
$(TARGET
)
1233 $(V1
) $(CROSS_CC
) -o
$@
$^
$(LDFLAGS
)
1234 $(V0
) $(SIZE
) $(TARGET_ELF
)
1237 ifneq ($(DEBUG
),GDB
)
1238 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.c
1239 $(V1
) mkdir
-p
$(dir $@
)
1240 $(V1
) $(if
$(findstring $(subst .
/src
/main
/,,$<),$(SPEED_OPTIMISED_SRC
)), \
1241 echo
"%% (speed optimised) $(notdir $<)" "$(STDOUT)" && \
1242 $(CROSS_CC
) -c
-o
$@
$(CFLAGS
) $(CC_SPEED_OPTIMISATION
) $<, \
1243 $(if
$(findstring $(subst .
/src
/main
/,,$<),$(SIZE_OPTIMISED_SRC
)), \
1244 echo
"%% (size optimised) $(notdir $<)" "$(STDOUT)" && \
1245 $(CROSS_CC
) -c
-o
$@
$(CFLAGS
) $(CC_SIZE_OPTIMISATION
) $<, \
1246 echo
"%% $(notdir $<)" "$(STDOUT)" && \
1247 $(CROSS_CC
) -c
-o
$@
$(CFLAGS
) $(CC_DEFAULT_OPTIMISATION
) $<))
1249 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.c
1250 $(V1
) mkdir
-p
$(dir $@
)
1251 $(V1
) echo
"%% $(notdir $<)" "$(STDOUT)" && \
1252 $(CROSS_CC
) -c
-o
$@
$(CFLAGS
) $(CC_DEBUG_OPTIMISATION
) $<
1256 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.s
1257 $(V1
) mkdir
-p
$(dir $@
)
1258 $(V1
) echo
"%% $(notdir $<)" "$(STDOUT)"
1259 $(V1
) $(CROSS_CC
) -c
-o
$@
$(ASFLAGS
) $<
1261 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.S
1262 $(V1
) mkdir
-p
$(dir $@
)
1263 $(V1
) echo
"%% $(notdir $<)" "$(STDOUT)"
1264 $(V1
) $(CROSS_CC
) -c
-o
$@
$(ASFLAGS
) $<
1267 ## all : Build all valid targets
1268 all: $(VALID_TARGETS
)
1270 ## official : Build all official (travis) targets
1271 official
: $(OFFICIAL_TARGETS
)
1273 ## targets-group-1 : build some targets
1274 targets-group-1
: $(GROUP_1_TARGETS
)
1276 ## targets-group-2 : build some targets
1277 targets-group-2
: $(GROUP_2_TARGETS
)
1279 ## targets-group-3 : build some targets
1280 targets-group-3
: $(GROUP_3_TARGETS
)
1282 ## targets-group-3 : build some targets
1283 targets-group-4
: $(GROUP_4_TARGETS
)
1285 ## targets-group-rest: build the rest of the targets (not listed in group 1, 2 or 3)
1286 targets-group-rest
: $(GROUP_OTHER_TARGETS
)
1291 echo
"Building $@" && \
1292 time
$(MAKE
) binary hex TARGET
=$@
&& \
1293 echo
"Building $@ succeeded."
1297 CLEAN_TARGETS
= $(addprefix clean_
,$(VALID_TARGETS
) )
1298 TARGETS_CLEAN
= $(addsuffix _clean
,$(VALID_TARGETS
) )
1300 ## clean : clean up temporary / machine-generated files
1302 $(V0
) echo
"Cleaning $(TARGET)"
1303 $(V0
) rm -f
$(CLEAN_ARTIFACTS
)
1304 $(V0
) rm -rf
$(OBJECT_DIR
)/$(TARGET
)
1305 $(V0
) echo
"Cleaning $(TARGET) succeeded."
1307 ## clean_test : clean up temporary / machine-generated files (tests)
1309 $(V0
) cd src
/test && $(MAKE
) clean || true
1311 ## clean_<TARGET> : clean up one specific target
1313 $(V0
) $(MAKE
) -j TARGET
=$(subst clean_
,,$@
) clean
1315 ## <TARGET>_clean : clean up one specific target (alias for above)
1317 $(V0
) $(MAKE
) -j TARGET
=$(subst _clean
,,$@
) clean
1319 ## clean_all : clean all valid targets
1320 clean_all
:$(CLEAN_TARGETS
)
1322 ## all_clean : clean all valid targets (alias for above)
1323 all_clean
:$(TARGETS_CLEAN
)
1326 flash_
$(TARGET
): $(TARGET_HEX
)
1327 $(V0
) stty
-F
$(SERIAL_DEVICE
) raw speed
115200 -crtscts cs8
-parenb
-cstopb
-ixon
1328 $(V0
) echo
-n
'R' >$(SERIAL_DEVICE
)
1329 $(V0
) stm32flash
-w
$(TARGET_HEX
) -v
-g
0x0 -b
115200 $(SERIAL_DEVICE
)
1331 ## flash : flash firmware (.hex) onto flight controller
1332 flash
: flash_
$(TARGET
)
1334 st-flash_
$(TARGET
): $(TARGET_BIN
)
1335 $(V0
) st-flash
--reset write
$< 0x08000000
1337 ## st-flash : flash firmware (.bin) onto flight controller
1338 st-flash
: st-flash_
$(TARGET
)
1341 $(V0
) $(MAKE
) -j
$(TARGET_BIN
)
1344 $(V0
) $(MAKE
) -j
$(TARGET_HEX
)
1346 unbrick_
$(TARGET
): $(TARGET_HEX
)
1347 $(V0
) stty
-F
$(SERIAL_DEVICE
) raw speed
115200 -crtscts cs8
-parenb
-cstopb
-ixon
1348 $(V0
) stm32flash
-w
$(TARGET_HEX
) -v
-g
0x0 -b
115200 $(SERIAL_DEVICE
)
1350 ## unbrick : unbrick flight controller
1351 unbrick
: unbrick_
$(TARGET
)
1353 ## cppcheck : run static analysis on C source code
1354 cppcheck
: $(CSOURCES
)
1357 cppcheck-result.xml
: $(CSOURCES
)
1358 $(V0
) $(CPPCHECK
) --xml-version
=2 2> cppcheck-result.xml
1370 ## version : print firmware version
1374 ## help : print this help message and exit
1375 help
: Makefile make
/tools.mk
1377 $(V0
) @echo
"Makefile for the $(FORKNAME) firmware"
1379 $(V0
) @echo
"Usage:"
1380 $(V0
) @echo
" make [V=<verbosity>] [TARGET=<target>] [OPTIONS=\"<options>\"]"
1382 $(V0
) @echo
" make <target> [V=<verbosity>] [OPTIONS=\"<options>\"]"
1384 $(V0
) @echo
"Valid TARGET values are: $(VALID_TARGETS)"
1386 $(V0
) @sed
-n
's/^## //p' $?
1388 ## targets : print a list of all valid target platforms (for consumption by scripts)
1390 $(V0
) @echo
"Valid targets: $(VALID_TARGETS)"
1391 $(V0
) @echo
"Target: $(TARGET)"
1392 $(V0
) @echo
"Base target: $(BASE_TARGET)"
1393 $(V0
) @echo
"Official targets: $(OFFICIAL_TARGETS)"
1394 $(V0
) @echo
"targets-group-1: $(GROUP_1_TARGETS)"
1395 $(V0
) @echo
"targets-group-2: $(GROUP_2_TARGETS)"
1396 $(V0
) @echo
"targets-group-3: $(GROUP_3_TARGETS)"
1397 $(V0
) @echo
"targets-group-4: $(GROUP_4_TARGETS)"
1398 $(V0
) @echo
"targets-group-rest: $(GROUP_OTHER_TARGETS)"
1400 ## test : run the cleanflight test suite
1401 ## junittest : run the cleanflight test suite, producing Junit XML result files.
1403 $(V0
) cd src
/test && $(MAKE
) $@
1405 # rebuild everything when makefile changes
1406 $(TARGET_OBJS
) : Makefile
1408 # include auto-generated dependencies
1409 -include $(TARGET_DEPS
)