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 ###############################################################################
14 # Things that the user might override on the commandline
17 # The target to build, see VALID_TARGETS below
20 # Compile-time options
23 # compile for OpenPilot BootLoader support
26 # Debugger optons, must be empty or GDB
29 # Serial port/Device for flashing
30 SERIAL_DEVICE ?
= $(firstword $(wildcard /dev
/ttyUSB
*) no-port-found
)
32 # Flash size (KB). Some low-end chips actually have more flash than advertised, use this to override.
35 ###############################################################################
36 # Things that need to be maintained as the source changes
41 VALID_TARGETS
= NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3 CC3D CJMCU EUSTM32F103RC SPRACINGF3 PORT103R SPARKY ALIENWIIF1 ALIENWIIF3 COLIBRI_RACE MOTOLAB
43 # Valid targets for OP BootLoader support
44 OPBL_VALID_TARGETS
= CC3D
46 # Configure default flash sizes for the targets
48 ifeq ($(TARGET
),$(filter $(TARGET
),CJMCU
))
50 else ifeq ($(TARGET
),$(filter $(TARGET
),NAZE CC3D ALIENWIIF1 OLIMEXINO
))
52 else ifeq ($(TARGET
),$(filter $(TARGET
),EUSTM32F103RC PORT103R STM32F3DISCOVERY CHEBUZZF3 NAZE32PRO SPRACINGF3 SPARKY ALIENWIIF3 COLIBRI_RACE MOTOLAB
))
55 $(error FLASH_SIZE not configured for target
)
59 REVISION
= $(shell git log
-1 --format
="%h")
62 ROOT
:= $(patsubst %/,%,$(dir $(lastword
$(MAKEFILE_LIST
))))
63 SRC_DIR
= $(ROOT
)/src
/main
64 OBJECT_DIR
= $(ROOT
)/obj
/main
66 CMSIS_DIR
= $(ROOT
)/lib
/main
/CMSIS
67 INCLUDE_DIRS
= $(SRC_DIR
)
68 LINKER_DIR
= $(ROOT
)/src
/main
/target
70 # Search path for sources
71 VPATH
:= $(SRC_DIR
):$(SRC_DIR
)/startup
72 USBFS_DIR
= $(ROOT
)/lib
/main
/STM32_USB-FS-Device_Driver
73 USBPERIPH_SRC
= $(notdir $(wildcard $(USBFS_DIR
)/src
/*.c
))
75 ifeq ($(TARGET
),$(filter $(TARGET
),STM32F3DISCOVERY CHEBUZZF3 NAZE32PRO SPRACINGF3 SPARKY ALIENWIIF3 COLIBRI_RACE MOTOLAB
))
77 CSOURCES
:= $(shell find
$(SRC_DIR
) -name
'*.c')
79 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F30x_StdPeriph_Driver
81 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/src
/*.c
))
83 EXCLUDES
= stm32f30x_crc.c \
86 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
88 DEVICE_STDPERIPH_SRC
= \
92 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM1
/CoreSupport
:$(CMSIS_DIR
)/CM1
/DeviceSupport
/ST
/STM32F30x
93 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM1
/CoreSupport
/*.c \
94 $(CMSIS_DIR
)/CM1
/DeviceSupport
/ST
/STM32F30x
/*.c
))
96 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
97 $(STDPERIPH_DIR
)/inc \
98 $(CMSIS_DIR
)/CM1
/CoreSupport \
99 $(CMSIS_DIR
)/CM1
/DeviceSupport
/ST
/STM32F30x
101 ifneq ($(TARGET
),SPRACINGF3
)
102 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
106 VPATH
:= $(VPATH
):$(USBFS_DIR
)/src
108 DEVICE_STDPERIPH_SRC
:= $(DEVICE_STDPERIPH_SRC
)\
113 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f303_
$(FLASH_SIZE
)k.
ld
115 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m4
-mfloat-abi
=hard
-mfpu
=fpv4-sp-d16
-fsingle-precision-constant
-Wdouble-promotion
116 DEVICE_FLAGS
= -DSTM32F303xC
-DSTM32F303
117 TARGET_FLAGS
= -D
$(TARGET
)
118 ifeq ($(TARGET
),CHEBUZZF3
)
119 # CHEBUZZ is a VARIANT of STM32F3DISCOVERY
120 TARGET_FLAGS
:= $(TARGET_FLAGS
) -DSTM32F3DISCOVERY
123 else ifeq ($(TARGET
),$(filter $(TARGET
),EUSTM32F103RC PORT103R
))
126 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F10x_StdPeriph_Driver
128 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/src
/*.c
))
130 EXCLUDES
= stm32f10x_crc.c \
134 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
136 # Search path and source files for the CMSIS sources
137 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM3
/CoreSupport
:$(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
138 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM3
/CoreSupport
/*.c \
139 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
/*.c
))
141 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
142 $(STDPERIPH_DIR
)/inc \
143 $(CMSIS_DIR
)/CM3
/CoreSupport \
144 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x \
146 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f103_
$(FLASH_SIZE
)k.
ld
148 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m3
149 TARGET_FLAGS
= -D
$(TARGET
) -pedantic
150 DEVICE_FLAGS
= -DSTM32F10X_HD
-DSTM32F10X
152 DEVICE_STDPERIPH_SRC
= $(STDPERIPH_SRC
)
156 STDPERIPH_DIR
= $(ROOT
)/lib
/main
/STM32F10x_StdPeriph_Driver
158 STDPERIPH_SRC
= $(notdir $(wildcard $(STDPERIPH_DIR
)/src
/*.c
))
160 EXCLUDES
= stm32f10x_crc.c \
164 STDPERIPH_SRC
:= $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC
))
166 # Search path and source files for the CMSIS sources
167 VPATH
:= $(VPATH
):$(CMSIS_DIR
)/CM3
/CoreSupport
:$(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
168 CMSIS_SRC
= $(notdir $(wildcard $(CMSIS_DIR
)/CM3
/CoreSupport
/*.c \
169 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x
/*.c
))
171 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
172 $(STDPERIPH_DIR
)/inc \
173 $(CMSIS_DIR
)/CM3
/CoreSupport \
174 $(CMSIS_DIR
)/CM3
/DeviceSupport
/ST
/STM32F10x \
176 DEVICE_STDPERIPH_SRC
= $(STDPERIPH_SRC
)
178 ifeq ($(TARGET
),CC3D
)
179 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
183 VPATH
:= $(VPATH
):$(USBFS_DIR
)/src
185 DEVICE_STDPERIPH_SRC
:= $(DEVICE_STDPERIPH_SRC
) \
190 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f103_
$(FLASH_SIZE
)k.
ld
192 ARCH_FLAGS
= -mthumb
-mcpu
=cortex-m3
193 TARGET_FLAGS
= -D
$(TARGET
) -pedantic
194 DEVICE_FLAGS
= -DSTM32F10X_MD
-DSTM32F10X
198 ifneq ($(FLASH_SIZE
),)
199 DEVICE_FLAGS
:= $(DEVICE_FLAGS
) -DFLASH_SIZE
=$(FLASH_SIZE
)
202 TARGET_DIR
= $(ROOT
)/src
/main
/target
/$(TARGET
)
203 TARGET_SRC
= $(notdir $(wildcard $(TARGET_DIR
)/*.c
))
205 ifeq ($(TARGET
),ALIENWIIF1
)
206 # ALIENWIIF1 is a VARIANT of NAZE
207 TARGET_FLAGS
:= $(TARGET_FLAGS
) -DNAZE
-DALIENWII32
208 TARGET_DIR
= $(ROOT
)/src
/main
/target
/NAZE
211 INCLUDE_DIRS
:= $(INCLUDE_DIRS
) \
214 VPATH
:= $(VPATH
):$(TARGET_DIR
)
216 COMMON_SRC
= build_config.c \
221 config
/runtime_config.c \
224 common
/typeconversion.c \
229 flight
/altitudehold.c \
235 drivers
/bus_i2c_soft.c \
237 drivers
/sound_beeper.c \
239 drivers
/gyro_sync.c \
247 io
/statusindicator.c \
256 sensors
/acceleration.c \
258 sensors
/boardalignment.c \
261 sensors
/initialisation.c \
263 $(DEVICE_STDPERIPH_SRC
)
265 HIGHEND_SRC
= flight
/autotune.c \
266 flight
/navigation.c \
267 flight
/gps_conversion.c \
268 common
/colorconversion.c \
272 telemetry
/telemetry.c \
276 telemetry
/smartport.c \
278 sensors
/barometer.c \
279 blackbox
/blackbox.c \
280 blackbox
/blackbox_io.c
290 drivers
/serial_usb_vcp.c
292 NAZE_SRC
= startup_stm32f10x_md_gcc.S \
293 drivers
/accgyro_adxl345.c \
294 drivers
/accgyro_bma280.c \
295 drivers
/accgyro_l3g4200d.c \
296 drivers
/accgyro_mma845x.c \
297 drivers
/accgyro_mpu3050.c \
298 drivers
/accgyro_mpu6050.c \
299 drivers
/accgyro_spi_mpu6500.c \
301 drivers
/adc_stm32f10x.c \
302 drivers
/barometer_bmp085.c \
303 drivers
/barometer_bmp280.c \
304 drivers
/barometer_ms5611.c \
306 drivers
/bus_i2c_stm32f10x.c \
307 drivers
/compass_hmc5883l.c \
308 drivers
/display_ug2864hsweg01.h \
309 drivers
/flash_m25p16.c \
310 drivers
/gpio_stm32f10x.c \
312 drivers
/light_led_stm32f10x.c \
313 drivers
/light_ws2811strip.c \
314 drivers
/light_ws2811strip_stm32f10x.c \
315 drivers
/sonar_hcsr04.c \
316 drivers
/pwm_mapping.c \
317 drivers
/pwm_output.c \
319 drivers
/serial_softserial.c \
320 drivers
/serial_uart.c \
321 drivers
/serial_uart_stm32f10x.c \
322 drivers
/sound_beeper_stm32f10x.c \
323 drivers
/system_stm32f10x.c \
325 drivers
/timer_stm32f10x.c \
327 hardware_revision.c \
331 ALIENWIIF1_SRC
= $(NAZE_SRC
)
333 EUSTM32F103RC_SRC
= startup_stm32f10x_hd_gcc.S \
334 drivers
/accgyro_adxl345.c \
335 drivers
/accgyro_bma280.c \
336 drivers
/accgyro_l3g4200d.c \
337 drivers
/accgyro_mma845x.c \
338 drivers
/accgyro_mpu3050.c \
339 drivers
/accgyro_mpu6050.c \
340 drivers
/accgyro_spi_mpu6000.c \
341 drivers
/accgyro_spi_mpu6500.c \
343 drivers
/adc_stm32f10x.c \
344 drivers
/barometer_bmp085.c \
345 drivers
/barometer_bmp280.c \
346 drivers
/barometer_ms5611.c \
347 drivers
/bus_i2c_stm32f10x.c \
349 drivers
/compass_ak8975.c \
350 drivers
/compass_hmc5883l.c \
351 drivers
/display_ug2864hsweg01.c \
352 drivers
/flash_m25p16.c \
353 drivers
/gpio_stm32f10x.c \
355 drivers
/light_led_stm32f10x.c \
356 drivers
/light_ws2811strip.c \
357 drivers
/light_ws2811strip_stm32f10x.c \
358 drivers
/pwm_mapping.c \
359 drivers
/pwm_output.c \
361 drivers
/serial_softserial.c \
362 drivers
/serial_uart.c \
363 drivers
/serial_uart_stm32f10x.c \
364 drivers
/sonar_hcsr04.c \
365 drivers
/sound_beeper_stm32f10x.c \
366 drivers
/system_stm32f10x.c \
368 drivers
/timer_stm32f10x.c \
373 PORT103R_SRC
= $(EUSTM32F103RC_SRC
)
375 OLIMEXINO_SRC
= startup_stm32f10x_md_gcc.S \
376 drivers
/accgyro_mpu6050.c \
378 drivers
/adc_stm32f10x.c \
379 drivers
/barometer_bmp085.c \
380 drivers
/barometer_bmp280.c \
381 drivers
/bus_i2c_stm32f10x.c \
383 drivers
/compass_hmc5883l.c \
384 drivers
/gpio_stm32f10x.c \
385 drivers
/light_led_stm32f10x.c \
386 drivers
/light_ws2811strip.c \
387 drivers
/light_ws2811strip_stm32f10x.c \
388 drivers
/pwm_mapping.c \
389 drivers
/pwm_output.c \
391 drivers
/serial_softserial.c \
392 drivers
/serial_uart.c \
393 drivers
/serial_uart_stm32f10x.c \
394 drivers
/sonar_hcsr04.c \
395 drivers
/sound_beeper_stm32f10x.c \
396 drivers
/system_stm32f10x.c \
398 drivers
/timer_stm32f10x.c \
403 ifneq ($(filter $(TARGET
),$(OPBL_VALID_TARGETS
)),)
404 TARGET_FLAGS
:= -DOPBL
$(TARGET_FLAGS
)
405 LD_SCRIPT
= $(LINKER_DIR
)/stm32_flash_f103_
$(FLASH_SIZE
)k_opbl.
ld
406 .DEFAULT_GOAL
:= binary
408 $(error OPBL specified with a unsupported target
)
413 startup_stm32f10x_md_gcc.S \
415 drivers
/adc_stm32f10x.c \
416 drivers
/accgyro_mpu6050.c \
417 drivers
/bus_i2c_stm32f10x.c \
418 drivers
/compass_hmc5883l.c \
419 drivers
/gpio_stm32f10x.c \
420 drivers
/light_led_stm32f10x.c \
421 drivers
/pwm_mapping.c \
422 drivers
/pwm_output.c \
424 drivers
/serial_uart.c \
425 drivers
/serial_uart_stm32f10x.c \
426 drivers
/sound_beeper_stm32f10x.c \
427 drivers
/system_stm32f10x.c \
429 drivers
/timer_stm32f10x.c \
430 hardware_revision.c \
431 blackbox
/blackbox.c \
432 blackbox
/blackbox_io.c \
436 startup_stm32f10x_md_gcc.S \
437 drivers
/accgyro_spi_mpu6000.c \
439 drivers
/adc_stm32f10x.c \
440 drivers
/barometer_bmp085.c \
441 drivers
/barometer_bmp280.c \
442 drivers
/barometer_ms5611.c \
444 drivers
/bus_i2c_stm32f10x.c \
445 drivers
/compass_hmc5883l.c \
446 drivers
/display_ug2864hsweg01.c \
447 drivers
/flash_m25p16.c \
448 drivers
/gpio_stm32f10x.c \
450 drivers
/light_led_stm32f10x.c \
451 drivers
/light_ws2811strip.c \
452 drivers
/light_ws2811strip_stm32f10x.c \
453 drivers
/pwm_mapping.c \
454 drivers
/pwm_output.c \
456 drivers
/serial_softserial.c \
457 drivers
/serial_uart.c \
458 drivers
/serial_uart_stm32f10x.c \
459 drivers
/sonar_hcsr04.c \
460 drivers
/sound_beeper_stm32f10x.c \
461 drivers
/system_stm32f10x.c \
463 drivers
/timer_stm32f10x.c \
469 STM32F30x_COMMON_SRC
= \
470 startup_stm32f30x_md_gcc.S \
472 drivers
/adc_stm32f30x.c \
473 drivers
/bus_i2c_stm32f30x.c \
475 drivers
/gpio_stm32f30x.c \
476 drivers
/light_led_stm32f30x.c \
477 drivers
/light_ws2811strip.c \
478 drivers
/light_ws2811strip_stm32f30x.c \
479 drivers
/pwm_mapping.c \
480 drivers
/pwm_output.c \
482 drivers
/serial_uart.c \
483 drivers
/serial_uart_stm32f30x.c \
484 drivers
/sound_beeper_stm32f30x.c \
485 drivers
/system_stm32f30x.c \
487 drivers
/timer_stm32f30x.c
490 $(STM32F30x_COMMON_SRC
) \
495 STM32F3DISCOVERY_COMMON_SRC
= \
496 $(STM32F30x_COMMON_SRC
) \
497 drivers
/accgyro_l3gd20.c \
498 drivers
/accgyro_l3gd20.c \
499 drivers
/accgyro_lsm303dlhc.c \
500 drivers
/compass_hmc5883l.c \
503 STM32F3DISCOVERY_SRC
= \
504 $(STM32F3DISCOVERY_COMMON_SRC
) \
505 drivers
/accgyro_adxl345.c \
506 drivers
/accgyro_bma280.c \
507 drivers
/accgyro_mma845x.c \
508 drivers
/accgyro_mpu3050.c \
509 drivers
/accgyro_mpu6050.c \
510 drivers
/accgyro_l3g4200d.c \
511 drivers
/barometer_ms5611.c \
512 drivers
/barometer_bmp280.c \
513 drivers
/compass_ak8975.c \
518 $(STM32F3DISCOVERY_SRC
) \
523 $(STM32F30x_COMMON_SRC
) \
524 drivers
/display_ug2864hsweg01.c \
525 drivers
/accgyro_spi_mpu6500.c \
526 drivers
/barometer_ms5611.c \
527 drivers
/compass_ak8975.c \
528 drivers
/compass_hmc5883l.c \
529 drivers
/serial_usb_vcp.c \
535 $(STM32F30x_COMMON_SRC
) \
536 drivers
/display_ug2864hsweg01.c \
537 drivers
/accgyro_mpu6050.c \
538 drivers
/barometer_ms5611.c \
539 drivers
/barometer_bmp280.c \
540 drivers
/compass_ak8975.c \
541 drivers
/serial_usb_vcp.c \
546 ALIENWIIF3_SRC
= $(SPARKY_SRC
)
549 $(STM32F30x_COMMON_SRC
) \
550 drivers
/accgyro_mpu6050.c \
551 drivers
/barometer_ms5611.c \
552 drivers
/compass_ak8975.c \
553 drivers
/barometer_bmp280.c \
554 drivers
/compass_hmc5883l.c \
555 drivers
/display_ug2864hsweg01.h \
556 drivers
/flash_m25p16.c \
557 drivers
/serial_softserial.c \
558 drivers
/sonar_hcsr04.c \
564 $(STM32F30x_COMMON_SRC
) \
565 drivers
/display_ug2864hsweg01.c \
566 drivers
/accgyro_mpu6050.c \
567 drivers
/barometer_ms5611.c \
568 drivers
/compass_hmc5883l.c \
569 drivers
/serial_usb_vcp.c \
570 drivers
/flash_m25p16.c \
576 # Search path and source files for the ST stdperiph library
577 VPATH
:= $(VPATH
):$(STDPERIPH_DIR
)/src
579 ###############################################################################
580 # Things that might need changing to use different tools
584 CC
= arm-none-eabi-gcc
585 OBJCOPY
= arm-none-eabi-objcopy
586 SIZE
= arm-none-eabi-size
594 LTO_FLAGS
= $(OPTIMIZE
)
597 LTO_FLAGS
= -flto
-fuse-linker-plugin
$(OPTIMIZE
)
600 DEBUG_FLAGS
= -ggdb3
-DDEBUG
602 CFLAGS
= $(ARCH_FLAGS
) \
604 $(addprefix -D
,$(OPTIONS
)) \
605 $(addprefix -I
,$(INCLUDE_DIRS
)) \
608 -Wall
-Wextra
-Wunsafe-loop-optimizations
-Wdouble-promotion \
609 -ffunction-sections \
612 -DUSE_STDPERIPH_DRIVER \
614 -D
'__FORKNAME__="$(FORKNAME)"' \
615 -D
'__TARGET__="$(TARGET)"' \
616 -D
'__REVISION__="$(REVISION)"' \
620 ASFLAGS
= $(ARCH_FLAGS
) \
621 -x assembler-with-cpp \
622 $(addprefix -I
,$(INCLUDE_DIRS
)) \
634 -Wl
,-gc-sections
,-Map
,$(TARGET_MAP
) \
635 -Wl
,-L
$(LINKER_DIR
) \
639 ###############################################################################
640 # No user-serviceable parts below
641 ###############################################################################
643 CPPCHECK
= cppcheck
$(CSOURCES
) --enable
=all --platform
=unix64 \
644 --std
=c99
--inline-suppr
--quiet
--force \
645 $(addprefix -I
,$(INCLUDE_DIRS
)) \
646 -I
/usr
/include -I
/usr
/include/linux
649 # Things we will build
651 ifeq ($(filter $(TARGET
),$(VALID_TARGETS
)),)
652 $(error Target
'$(TARGET)' is not valid
, must be one of
$(VALID_TARGETS
))
655 TARGET_BIN
= $(BIN_DIR
)/$(FORKNAME
)_
$(TARGET
).bin
656 TARGET_HEX
= $(BIN_DIR
)/$(FORKNAME
)_
$(TARGET
).hex
657 TARGET_ELF
= $(OBJECT_DIR
)/$(FORKNAME
)_
$(TARGET
).elf
658 TARGET_OBJS
= $(addsuffix .o
,$(addprefix $(OBJECT_DIR
)/$(TARGET
)/,$(basename $($(TARGET
)_SRC
))))
659 TARGET_DEPS
= $(addsuffix .d
,$(addprefix $(OBJECT_DIR
)/$(TARGET
)/,$(basename $($(TARGET
)_SRC
))))
660 TARGET_MAP
= $(OBJECT_DIR
)/$(FORKNAME
)_
$(TARGET
).map
662 # List of buildable ELF files and their object dependencies.
663 # It would be nice to compute these lists, but that seems to be just beyond make.
665 $(TARGET_HEX
): $(TARGET_ELF
)
666 $(OBJCOPY
) -O ihex
--set-start
0x8000000 $< $@
668 $(TARGET_BIN
): $(TARGET_ELF
)
669 $(OBJCOPY
) -O binary
$< $@
671 $(TARGET_ELF
): $(TARGET_OBJS
)
672 $(CC
) -o
$@
$^
$(LDFLAGS
)
673 $(SIZE
) $(TARGET_ELF
)
676 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.c
678 @echo
%% $(notdir $<)
679 @
$(CC
) -c
-o
$@
$(CFLAGS
) $<
682 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.s
684 @echo
%% $(notdir $<)
685 @
$(CC
) -c
-o
$@
$(ASFLAGS
) $<
687 $(OBJECT_DIR
)/$(TARGET
)/%.o
: %.S
689 @echo
%% $(notdir $<)
690 @
$(CC
) -c
-o
$@
$(ASFLAGS
) $<
693 rm -f
$(TARGET_BIN
) $(TARGET_HEX
) $(TARGET_ELF
) $(TARGET_OBJS
) $(TARGET_MAP
)
694 rm -rf
$(OBJECT_DIR
)/$(TARGET
)
695 cd src
/test && $(MAKE
) clean || true
697 flash_
$(TARGET
): $(TARGET_HEX
)
698 stty
-F
$(SERIAL_DEVICE
) raw speed
115200 -crtscts cs8
-parenb
-cstopb
-ixon
699 echo
-n
'R' >$(SERIAL_DEVICE
)
700 stm32flash
-w
$(TARGET_HEX
) -v
-g
0x0 -b
115200 $(SERIAL_DEVICE
)
702 flash
: flash_
$(TARGET
)
704 st-flash_
$(TARGET
): $(TARGET_BIN
)
705 st-flash
--reset write
$< 0x08000000
707 st-flash
: st-flash_
$(TARGET
)
709 binary
: $(TARGET_BIN
)
711 unbrick_
$(TARGET
): $(TARGET_HEX
)
712 stty
-F
$(SERIAL_DEVICE
) raw speed
115200 -crtscts cs8
-parenb
-cstopb
-ixon
713 stm32flash
-w
$(TARGET_HEX
) -v
-g
0x0 -b
115200 $(SERIAL_DEVICE
)
715 unbrick
: unbrick_
$(TARGET
)
717 ## cppcheck : run static analysis on C source code
718 cppcheck
: $(CSOURCES
)
721 cppcheck-result.xml
: $(CSOURCES
)
722 $(CPPCHECK
) --xml-version
=2 2> cppcheck-result.xml
726 @echo
"Makefile for the $(FORKNAME) firmware"
729 @echo
" make [TARGET=<target>] [OPTIONS=\"<options>\"]"
731 @echo
"Valid TARGET values are: $(VALID_TARGETS)"
734 ## test : run the cleanflight test suite
736 cd src
/test && $(MAKE
) test || true
738 # rebuild everything when makefile changes
739 $(TARGET_OBJS
) : Makefile
741 # include auto-generated dependencies
742 -include $(TARGET_DEPS
)