Code size reduction when led animation is disabled.
[betaflight.git] / Makefile
blobcda4d0421b5443f02983a4c664ab4f7bfad79245
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
18 TARGET ?= NAZE
20 # Compile-time options
21 OPTIONS ?=
23 # compile for OpenPilot BootLoader support
24 OPBL ?=no
26 # Debugger optons, must be empty or GDB
27 DEBUG ?=
29 # Serial port/Device for flashing
30 SERIAL_DEVICE ?= /dev/ttyUSB0
32 ###############################################################################
33 # Things that need to be maintained as the source changes
36 FORKNAME = cleanflight
38 VALID_TARGETS = NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3 CC3D CJMCU EUSTM32F103RC MASSIVEF3 PORT103R SPARKY ALIENWIIF1
40 # Valid targets for OP BootLoader support
41 OPBL_VALID_TARGETS = CC3D
43 REVISION = $(shell git log -1 --format="%h")
45 # Working directories
46 ROOT := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
47 SRC_DIR = $(ROOT)/src/main
48 OBJECT_DIR = $(ROOT)/obj/main
49 BIN_DIR = $(ROOT)/obj
50 CMSIS_DIR = $(ROOT)/lib/main/CMSIS
51 INCLUDE_DIRS = $(SRC_DIR)
52 LINKER_DIR = $(ROOT)/src/main/target
54 # Search path for sources
55 VPATH := $(SRC_DIR):$(SRC_DIR)/startup
57 ifeq ($(TARGET),$(filter $(TARGET),STM32F3DISCOVERY CHEBUZZF3 NAZE32PRO MASSIVEF3 SPARKY))
59 STDPERIPH_DIR = $(ROOT)/lib/main/STM32F30x_StdPeriph_Driver
60 USBFS_DIR = $(ROOT)/lib/main/STM32_USB-FS-Device_Driver
62 USBPERIPH_SRC = $(notdir $(wildcard $(USBFS_DIR)/src/*.c))
63 STDPERIPH_SRC = $(notdir $(wildcard $(STDPERIPH_DIR)/src/*.c))
65 EXCLUDES = stm32f30x_crc.c \
66 stm32f30x_can.c
68 STDPERIPH_SRC := $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC))
70 DEVICE_STDPERIPH_SRC = $(USBPERIPH_SRC) \
71 $(STDPERIPH_SRC)
74 VPATH := $(VPATH):$(CMSIS_DIR)/CM1/CoreSupport:$(CMSIS_DIR)/CM1/DeviceSupport/ST/STM32F30x:$(USBFS_DIR)/src
75 CMSIS_SRC = $(notdir $(wildcard $(CMSIS_DIR)/CM1/CoreSupport/*.c \
76 $(CMSIS_DIR)/CM1/DeviceSupport/ST/STM32F30x/*.c))
78 INCLUDE_DIRS := $(INCLUDE_DIRS) \
79 $(STDPERIPH_DIR)/inc \
80 $(USBFS_DIR)/inc \
81 $(CMSIS_DIR)/CM1/CoreSupport \
82 $(CMSIS_DIR)/CM1/DeviceSupport/ST/STM32F30x \
83 $(ROOT)/src/main/vcp
85 LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f303_256k.ld
87 ARCH_FLAGS = -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion
88 DEVICE_FLAGS = -DSTM32F303xC -DSTM32F303
89 TARGET_FLAGS = -D$(TARGET)
90 ifeq ($(TARGET),CHEBUZZF3)
91 # CHEBUZZ is a VARIANT of STM32F3DISCOVERY
92 TARGET_FLAGS := $(TARGET_FLAGS) -DSTM32F3DISCOVERY
93 endif
95 ifeq ($(TARGET),MASSIVEF3)
96 # MASSIVEF3 is a VARIANT of STM32F3DISCOVERY
97 TARGET_FLAGS := $(TARGET_FLAGS) -DSTM32F3DISCOVERY
98 endif
101 else ifeq ($(TARGET),$(filter $(TARGET),EUSTM32F103RC PORT103R))
104 STDPERIPH_DIR = $(ROOT)/lib/main/STM32F10x_StdPeriph_Driver
106 STDPERIPH_SRC = $(notdir $(wildcard $(STDPERIPH_DIR)/src/*.c))
108 EXCLUDES = stm32f10x_crc.c \
109 stm32f10x_cec.c \
110 stm32f10x_can.c
112 STDPERIPH_SRC := $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC))
114 # Search path and source files for the CMSIS sources
115 VPATH := $(VPATH):$(CMSIS_DIR)/CM3/CoreSupport:$(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x
116 CMSIS_SRC = $(notdir $(wildcard $(CMSIS_DIR)/CM3/CoreSupport/*.c \
117 $(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x/*.c))
119 INCLUDE_DIRS := $(INCLUDE_DIRS) \
120 $(STDPERIPH_DIR)/inc \
121 $(CMSIS_DIR)/CM3/CoreSupport \
122 $(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x \
124 LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_256k.ld
126 ARCH_FLAGS = -mthumb -mcpu=cortex-m3
127 TARGET_FLAGS = -D$(TARGET) -pedantic
128 DEVICE_FLAGS = -DSTM32F10X_HD -DSTM32F10X
130 DEVICE_STDPERIPH_SRC = $(STDPERIPH_SRC)
132 else
134 STDPERIPH_DIR = $(ROOT)/lib/main/STM32F10x_StdPeriph_Driver
136 STDPERIPH_SRC = $(notdir $(wildcard $(STDPERIPH_DIR)/src/*.c))
138 EXCLUDES = stm32f10x_crc.c \
139 stm32f10x_cec.c \
140 stm32f10x_can.c
142 STDPERIPH_SRC := $(filter-out ${EXCLUDES}, $(STDPERIPH_SRC))
144 # Search path and source files for the CMSIS sources
145 VPATH := $(VPATH):$(CMSIS_DIR)/CM3/CoreSupport:$(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x
146 CMSIS_SRC = $(notdir $(wildcard $(CMSIS_DIR)/CM3/CoreSupport/*.c \
147 $(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x/*.c))
149 INCLUDE_DIRS := $(INCLUDE_DIRS) \
150 $(STDPERIPH_DIR)/inc \
151 $(CMSIS_DIR)/CM3/CoreSupport \
152 $(CMSIS_DIR)/CM3/DeviceSupport/ST/STM32F10x \
154 LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_128k.ld
156 ARCH_FLAGS = -mthumb -mcpu=cortex-m3
157 TARGET_FLAGS = -D$(TARGET) -pedantic
158 DEVICE_FLAGS = -DSTM32F10X_MD -DSTM32F10X
160 DEVICE_STDPERIPH_SRC = $(STDPERIPH_SRC)
162 endif
164 TARGET_DIR = $(ROOT)/src/main/target/$(TARGET)
165 TARGET_SRC = $(notdir $(wildcard $(TARGET_DIR)/*.c))
167 ifeq ($(TARGET),ALIENWIIF1)
168 # ALIENWIIF1 is a VARIANT of NAZE
169 TARGET_FLAGS := $(TARGET_FLAGS) -DNAZE -DALIENWII32
170 TARGET_DIR = $(ROOT)/src/main/target/NAZE
171 endif
173 INCLUDE_DIRS := $(INCLUDE_DIRS) \
174 $(TARGET_DIR)
176 VPATH := $(VPATH):$(TARGET_DIR)
178 COMMON_SRC = build_config.c \
179 version.c \
180 $(TARGET_SRC) \
181 config/config.c \
182 config/runtime_config.c \
183 common/maths.c \
184 common/printf.c \
185 common/typeconversion.c \
186 main.c \
187 mw.c \
188 flight/altitudehold.c \
189 flight/failsafe.c \
190 flight/flight.c \
191 flight/imu.c \
192 flight/mixer.c \
193 drivers/bus_i2c_soft.c \
194 drivers/serial.c \
195 drivers/sound_beeper.c \
196 drivers/system.c \
197 io/beeper.c \
198 io/rc_controls.c \
199 io/rc_curves.c \
200 io/serial.c \
201 io/serial_cli.c \
202 io/serial_msp.c \
203 io/statusindicator.c \
204 rx/rx.c \
205 rx/pwm.c \
206 rx/msp.c \
207 rx/sbus.c \
208 rx/sumd.c \
209 rx/sumh.c \
210 rx/spektrum.c \
211 rx/xbus.c \
212 sensors/acceleration.c \
213 sensors/battery.c \
214 sensors/boardalignment.c \
215 sensors/compass.c \
216 sensors/gyro.c \
217 sensors/initialisation.c \
218 $(CMSIS_SRC) \
219 $(DEVICE_STDPERIPH_SRC)
221 HIGHEND_SRC = flight/autotune.c \
222 flight/navigation.c \
223 flight/gps_conversion.c \
224 common/colorconversion.c \
225 io/gps.c \
226 io/ledstrip.c \
227 io/display.c \
228 telemetry/telemetry.c \
229 telemetry/frsky.c \
230 telemetry/hott.c \
231 telemetry/msp.c \
232 telemetry/smartport.c \
233 sensors/sonar.c \
234 sensors/barometer.c \
235 blackbox/blackbox.c
237 NAZE_SRC = startup_stm32f10x_md_gcc.S \
238 drivers/accgyro_adxl345.c \
239 drivers/accgyro_bma280.c \
240 drivers/accgyro_l3g4200d.c \
241 drivers/accgyro_mma845x.c \
242 drivers/accgyro_mpu3050.c \
243 drivers/accgyro_mpu6050.c \
244 drivers/accgyro_spi_mpu6500.c \
245 drivers/adc.c \
246 drivers/adc_stm32f10x.c \
247 drivers/barometer_bmp085.c \
248 drivers/barometer_ms5611.c \
249 drivers/bus_spi.c \
250 drivers/bus_i2c_stm32f10x.c \
251 drivers/compass_hmc5883l.c \
252 drivers/display_ug2864hsweg01.h \
253 drivers/gpio_stm32f10x.c \
254 drivers/inverter.c \
255 drivers/light_led_stm32f10x.c \
256 drivers/light_ws2811strip.c \
257 drivers/light_ws2811strip_stm32f10x.c \
258 drivers/sonar_hcsr04.c \
259 drivers/pwm_mapping.c \
260 drivers/pwm_output.c \
261 drivers/pwm_rx.c \
262 drivers/serial_softserial.c \
263 drivers/serial_uart.c \
264 drivers/serial_uart_stm32f10x.c \
265 drivers/sound_beeper_stm32f10x.c \
266 drivers/system_stm32f10x.c \
267 drivers/timer.c \
268 drivers/timer_stm32f10x.c \
269 hardware_revision.c \
270 $(HIGHEND_SRC) \
271 $(COMMON_SRC)
273 ALIENWIIF1_SRC = $(NAZE_SRC)
275 EUSTM32F103RC_SRC = startup_stm32f10x_hd_gcc.S \
276 drivers/accgyro_adxl345.c \
277 drivers/accgyro_bma280.c \
278 drivers/accgyro_l3g4200d.c \
279 drivers/accgyro_mma845x.c \
280 drivers/accgyro_mpu3050.c \
281 drivers/accgyro_mpu6050.c \
282 drivers/accgyro_spi_mpu6000.c \
283 drivers/accgyro_spi_mpu6500.c \
284 drivers/adc.c \
285 drivers/adc_stm32f10x.c \
286 drivers/barometer_bmp085.c \
287 drivers/barometer_ms5611.c \
288 drivers/bus_i2c_stm32f10x.c \
289 drivers/bus_spi.c \
290 drivers/compass_ak8975.c \
291 drivers/compass_hmc5883l.c \
292 drivers/display_ug2864hsweg01.c \
293 drivers/gpio_stm32f10x.c \
294 drivers/inverter.c \
295 drivers/light_led_stm32f10x.c \
296 drivers/light_ws2811strip.c \
297 drivers/light_ws2811strip_stm32f10x.c \
298 drivers/pwm_mapping.c \
299 drivers/pwm_output.c \
300 drivers/pwm_rx.c \
301 drivers/serial_softserial.c \
302 drivers/serial_uart.c \
303 drivers/serial_uart_stm32f10x.c \
304 drivers/sonar_hcsr04.c \
305 drivers/sound_beeper_stm32f10x.c \
306 drivers/system_stm32f10x.c \
307 drivers/timer.c \
308 drivers/timer_stm32f10x.c \
309 $(HIGHEND_SRC) \
310 $(COMMON_SRC)
312 PORT103R_SRC = $(EUSTM32F103RC_SRC)
314 OLIMEXINO_SRC = startup_stm32f10x_md_gcc.S \
315 drivers/accgyro_mpu6050.c \
316 drivers/adc.c \
317 drivers/adc_stm32f10x.c \
318 drivers/barometer_bmp085.c \
319 drivers/bus_i2c_stm32f10x.c \
320 drivers/bus_spi.c \
321 drivers/compass_hmc5883l.c \
322 drivers/gpio_stm32f10x.c \
323 drivers/light_led_stm32f10x.c \
324 drivers/light_ws2811strip.c \
325 drivers/light_ws2811strip_stm32f10x.c \
326 drivers/pwm_mapping.c \
327 drivers/pwm_output.c \
328 drivers/pwm_rx.c \
329 drivers/serial_softserial.c \
330 drivers/serial_uart.c \
331 drivers/serial_uart_stm32f10x.c \
332 drivers/sonar_hcsr04.c \
333 drivers/sound_beeper_stm32f10x.c \
334 drivers/system_stm32f10x.c \
335 drivers/timer.c \
336 drivers/timer_stm32f10x.c \
337 $(HIGHEND_SRC) \
338 $(COMMON_SRC)
340 ifeq ($(TARGET),CJMCU)
341 LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_64k.ld
342 endif
344 ifeq ($(OPBL),yes)
345 ifneq ($(filter $(TARGET),$(OPBL_VALID_TARGETS)),)
346 LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f103_128k_opbl.ld
347 .DEFAULT_GOAL := binary
348 else
349 $(error OPBL specified with a unsupported target)
350 endif
351 endif
353 CJMCU_SRC = startup_stm32f10x_md_gcc.S \
354 drivers/adc.c \
355 drivers/adc_stm32f10x.c \
356 drivers/accgyro_mpu6050.c \
357 drivers/bus_i2c_stm32f10x.c \
358 drivers/compass_hmc5883l.c \
359 drivers/gpio_stm32f10x.c \
360 drivers/light_led_stm32f10x.c \
361 drivers/pwm_mapping.c \
362 drivers/pwm_output.c \
363 drivers/pwm_rx.c \
364 drivers/serial_uart.c \
365 drivers/serial_uart_stm32f10x.c \
366 drivers/sound_beeper_stm32f10x.c \
367 drivers/system_stm32f10x.c \
368 drivers/timer.c \
369 drivers/timer_stm32f10x.c \
370 blackbox/blackbox.c \
371 hardware_revision.c \
372 $(COMMON_SRC)
374 CC3D_SRC = startup_stm32f10x_md_gcc.S \
375 drivers/accgyro_spi_mpu6000.c \
376 drivers/adc.c \
377 drivers/adc_stm32f10x.c \
378 drivers/bus_spi.c \
379 drivers/gpio_stm32f10x.c \
380 drivers/inverter.c \
381 drivers/light_led_stm32f10x.c \
382 drivers/light_ws2811strip.c \
383 drivers/light_ws2811strip_stm32f10x.c \
384 drivers/pwm_mapping.c \
385 drivers/pwm_output.c \
386 drivers/pwm_rx.c \
387 drivers/serial_softserial.c \
388 drivers/serial_uart.c \
389 drivers/serial_uart_stm32f10x.c \
390 drivers/sound_beeper_stm32f10x.c \
391 drivers/system_stm32f10x.c \
392 drivers/timer.c \
393 drivers/timer_stm32f10x.c \
394 $(HIGHEND_SRC) \
395 $(COMMON_SRC)
397 STM32F30x_COMMON_SRC = startup_stm32f30x_md_gcc.S \
398 drivers/adc.c \
399 drivers/adc_stm32f30x.c \
400 drivers/bus_i2c_stm32f30x.c \
401 drivers/bus_spi.c \
402 drivers/gpio_stm32f30x.c \
403 drivers/light_led_stm32f30x.c \
404 drivers/light_ws2811strip.c \
405 drivers/light_ws2811strip_stm32f30x.c \
406 drivers/pwm_mapping.c \
407 drivers/pwm_output.c \
408 drivers/pwm_rx.c \
409 drivers/serial_uart.c \
410 drivers/serial_uart_stm32f30x.c \
411 drivers/serial_usb_vcp.c \
412 drivers/sound_beeper_stm32f30x.c \
413 drivers/system_stm32f30x.c \
414 drivers/timer.c \
415 drivers/timer_stm32f30x.c \
416 vcp/hw_config.c \
417 vcp/stm32_it.c \
418 vcp/usb_desc.c \
419 vcp/usb_endp.c \
420 vcp/usb_istr.c \
421 vcp/usb_prop.c \
422 vcp/usb_pwr.c
424 NAZE32PRO_SRC = $(STM32F30x_COMMON_SRC) \
425 $(HIGHEND_SRC) \
426 $(COMMON_SRC)
428 STM32F3DISCOVERY_COMMON_SRC = $(STM32F30x_COMMON_SRC) \
429 drivers/accgyro_l3gd20.c \
430 drivers/accgyro_l3gd20.c \
431 drivers/accgyro_lsm303dlhc.c
433 STM32F3DISCOVERY_SRC = $(STM32F3DISCOVERY_COMMON_SRC) \
434 drivers/accgyro_adxl345.c \
435 drivers/accgyro_bma280.c \
436 drivers/accgyro_mma845x.c \
437 drivers/accgyro_mpu3050.c \
438 drivers/accgyro_mpu6050.c \
439 drivers/accgyro_l3g4200d.c \
440 drivers/barometer_ms5611.c \
441 drivers/compass_ak8975.c \
442 $(HIGHEND_SRC) \
443 $(COMMON_SRC)
445 CHEBUZZF3_SRC = $(STM32F3DISCOVERY_SRC) \
446 $(HIGHEND_SRC) \
447 $(COMMON_SRC)
449 MASSIVEF3_SRC = $(STM32F3DISCOVERY_SRC) \
450 $(HIGHEND_SRC) \
451 $(COMMON_SRC)
453 SPARKY_SRC = $(STM32F30x_COMMON_SRC) \
454 drivers/display_ug2864hsweg01.c \
455 drivers/accgyro_mpu6050.c \
456 drivers/barometer_ms5611.c \
457 drivers/compass_ak8975.c \
458 $(HIGHEND_SRC) \
459 $(COMMON_SRC)
461 ifeq ($(TARGET),MASSIVEF3)
462 LD_SCRIPT = $(LINKER_DIR)/stm32_flash_f303_128k.ld
463 endif
465 # Search path and source files for the ST stdperiph library
466 VPATH := $(VPATH):$(STDPERIPH_DIR)/src
468 ###############################################################################
469 # Things that might need changing to use different tools
472 # Tool names
473 CC = arm-none-eabi-gcc
474 OBJCOPY = arm-none-eabi-objcopy
475 SIZE = arm-none-eabi-size
478 # Tool options.
481 ifeq ($(DEBUG),GDB)
482 OPTIMIZE = -O0
483 LTO_FLAGS = $(OPTIMIZE)
484 else
485 OPTIMIZE = -Os
486 LTO_FLAGS = -flto -fuse-linker-plugin $(OPTIMIZE)
487 endif
489 DEBUG_FLAGS = -ggdb3
491 CFLAGS = $(ARCH_FLAGS) \
492 $(LTO_FLAGS) \
493 $(addprefix -D,$(OPTIONS)) \
494 $(addprefix -I,$(INCLUDE_DIRS)) \
495 $(DEBUG_FLAGS) \
496 -std=gnu99 \
497 -Wall -Wextra -Wunsafe-loop-optimizations -Wdouble-promotion \
498 -ffunction-sections \
499 -fdata-sections \
500 $(DEVICE_FLAGS) \
501 -DUSE_STDPERIPH_DRIVER \
502 $(TARGET_FLAGS) \
503 -D'__FORKNAME__="$(FORKNAME)"' \
504 -D'__TARGET__="$(TARGET)"' \
505 -D'__REVISION__="$(REVISION)"' \
506 -save-temps=obj \
507 -MMD
509 ASFLAGS = $(ARCH_FLAGS) \
510 -x assembler-with-cpp \
511 $(addprefix -I,$(INCLUDE_DIRS)) \
512 -MMD
514 LDFLAGS = -lm \
515 -nostartfiles \
516 --specs=nano.specs \
517 -lc \
518 -lnosys \
519 $(ARCH_FLAGS) \
520 $(LTO_FLAGS) \
521 $(DEBUG_FLAGS) \
522 -static \
523 -Wl,-gc-sections,-Map,$(TARGET_MAP) \
524 -T$(LD_SCRIPT)
526 ###############################################################################
527 # No user-serviceable parts below
528 ###############################################################################
531 # Things we will build
533 ifeq ($(filter $(TARGET),$(VALID_TARGETS)),)
534 $(error Target '$(TARGET)' is not valid, must be one of $(VALID_TARGETS))
535 endif
537 TARGET_BIN = $(BIN_DIR)/$(FORKNAME)_$(TARGET).bin
538 TARGET_HEX = $(BIN_DIR)/$(FORKNAME)_$(TARGET).hex
539 TARGET_ELF = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).elf
540 TARGET_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $($(TARGET)_SRC))))
541 TARGET_DEPS = $(addsuffix .d,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $($(TARGET)_SRC))))
542 TARGET_MAP = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).map
544 # List of buildable ELF files and their object dependencies.
545 # It would be nice to compute these lists, but that seems to be just beyond make.
547 $(TARGET_HEX): $(TARGET_ELF)
548 $(OBJCOPY) -O ihex --set-start 0x8000000 $< $@
550 $(TARGET_BIN): $(TARGET_ELF)
551 $(OBJCOPY) -O binary $< $@
553 $(TARGET_ELF): $(TARGET_OBJS)
554 $(CC) -o $@ $^ $(LDFLAGS)
555 $(SIZE) $(TARGET_ELF)
557 # Compile
558 $(OBJECT_DIR)/$(TARGET)/%.o: %.c
559 @mkdir -p $(dir $@)
560 @echo %% $(notdir $<)
561 @$(CC) -c -o $@ $(CFLAGS) $<
563 # Assemble
564 $(OBJECT_DIR)/$(TARGET)/%.o: %.s
565 @mkdir -p $(dir $@)
566 @echo %% $(notdir $<)
567 @$(CC) -c -o $@ $(ASFLAGS) $<
569 $(OBJECT_DIR)/$(TARGET)/%.o: %.S
570 @mkdir -p $(dir $@)
571 @echo %% $(notdir $<)
572 @$(CC) -c -o $@ $(ASFLAGS) $<
574 clean:
575 rm -f $(TARGET_BIN) $(TARGET_HEX) $(TARGET_ELF) $(TARGET_OBJS) $(TARGET_MAP)
576 rm -rf $(OBJECT_DIR)/$(TARGET)
578 flash_$(TARGET): $(TARGET_HEX)
579 stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon
580 echo -n 'R' >$(SERIAL_DEVICE)
581 stm32flash -w $(TARGET_HEX) -v -g 0x0 -b 115200 $(SERIAL_DEVICE)
583 flash: flash_$(TARGET)
585 binary: $(TARGET_BIN)
587 unbrick_$(TARGET): $(TARGET_HEX)
588 stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon
589 stm32flash -w $(TARGET_HEX) -v -g 0x0 -b 115200 $(SERIAL_DEVICE)
591 unbrick: unbrick_$(TARGET)
593 help:
594 @echo ""
595 @echo "Makefile for the $(FORKNAME) firmware"
596 @echo ""
597 @echo "Usage:"
598 @echo " make [TARGET=<target>] [OPTIONS=\"<options>\"]"
599 @echo ""
600 @echo "Valid TARGET values are: $(VALID_TARGETS)"
601 @echo ""
603 # rebuild everything when makefile changes
604 $(TARGET_OBJS) : Makefile
606 # include auto-generated dependencies
607 -include $(TARGET_DEPS)