Merge pull request #7685 from joelucid/dshot_bidir_f7
[betaflight.git] / Makefile
bloba686c109666cb1425d0a4d8f16eb64955b88ce5d
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 betaflight 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 ?= BETAFLIGHTF3
21 # Compile-time options
22 OPTIONS ?=
24 # compile for OpenPilot BootLoader support
25 OPBL ?= no
27 # Debugger optons:
28 # empty - ordinary build with all optimizations enabled
29 # RELWITHDEBINFO - ordinary build with debug symbols and all optimizations enabled
30 # GDB - debug build with minimum number of optimizations
31 DEBUG ?=
33 # Insert the debugging hardfault debugger
34 # releases should not be built with this flag as it does not disable pwm output
35 DEBUG_HARDFAULTS ?=
37 # Serial port/Device for flashing
38 SERIAL_DEVICE ?= $(firstword $(wildcard /dev/ttyUSB*) no-port-found)
40 # Flash size (KB). Some low-end chips actually have more flash than advertised, use this to override.
41 FLASH_SIZE ?=
44 ###############################################################################
45 # Things that need to be maintained as the source changes
48 FORKNAME = betaflight
50 # Working directories
51 ROOT := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
52 SRC_DIR := $(ROOT)/src/main
53 OBJECT_DIR := $(ROOT)/obj/main
54 BIN_DIR := $(ROOT)/obj
55 CMSIS_DIR := $(ROOT)/lib/main/CMSIS
56 INCLUDE_DIRS := $(SRC_DIR) \
57 $(ROOT)/src/main/target \
58 $(ROOT)/src/main/startup
59 LINKER_DIR := $(ROOT)/src/main/target/link
61 ## V : Set verbosity level based on the V= parameter
62 ## V=0 Low
63 ## V=1 High
64 include $(ROOT)/make/build_verbosity.mk
66 # Build tools, so we all share the same versions
67 # import macros common to all supported build systems
68 include $(ROOT)/make/system-id.mk
70 # developer preferences, edit these at will, they'll be gitignored
71 -include $(ROOT)/make/local.mk
73 # configure some directories that are relative to wherever ROOT_DIR is located
74 ifndef TOOLS_DIR
75 TOOLS_DIR := $(ROOT)/tools
76 endif
77 BUILD_DIR := $(ROOT)/build
78 DL_DIR := $(ROOT)/downloads
80 export RM := rm
82 # import macros that are OS specific
83 include $(ROOT)/make/$(OSFAMILY).mk
85 # include the tools makefile
86 include $(ROOT)/make/tools.mk
88 # default xtal value for F4 targets
89 HSE_VALUE ?= 8000000
91 # used for turning on features like VCP and SDCARD
92 FEATURES =
94 # used to disable features based on flash space shortage (larger number => more features disabled)
95 FEATURE_CUT_LEVEL_SUPPLIED := $(FEATURE_CUT_LEVEL)
96 FEATURE_CUT_LEVEL =
98 # The list of targets to build for 'pre-push'
99 PRE_PUSH_TARGET_LIST ?= BETAFLIGHTF3 OMNIBUSF4 SPRACINGF7DUAL SITL test-representative
101 include $(ROOT)/make/targets.mk
103 REVISION := $(shell git log -1 --format="%h")
105 FC_VER_MAJOR := $(shell grep " FC_VERSION_MAJOR" src/main/build/version.h | awk '{print $$3}' )
106 FC_VER_MINOR := $(shell grep " FC_VERSION_MINOR" src/main/build/version.h | awk '{print $$3}' )
107 FC_VER_PATCH := $(shell grep " FC_VERSION_PATCH" src/main/build/version.h | awk '{print $$3}' )
109 FC_VER := $(FC_VER_MAJOR).$(FC_VER_MINOR).$(FC_VER_PATCH)
111 # Search path for sources
112 VPATH := $(SRC_DIR):$(SRC_DIR)/startup
113 USBFS_DIR = $(ROOT)/lib/main/STM32_USB-FS-Device_Driver
114 USBPERIPH_SRC = $(notdir $(wildcard $(USBFS_DIR)/src/*.c))
115 FATFS_DIR = $(ROOT)/lib/main/FatFS
116 FATFS_SRC = $(notdir $(wildcard $(FATFS_DIR)/*.c))
118 CSOURCES := $(shell find $(SRC_DIR) -name '*.c')
120 LD_FLAGS :=
123 # Default Tool options - can be overridden in {mcu}.mk files.
125 ifeq ($(DEBUG),GDB)
126 OPTIMISE_DEFAULT := -Og
128 LTO_FLAGS := $(OPTIMISE_DEFAULT)
129 DEBUG_FLAGS = -ggdb3 -DDEBUG
130 else
131 ifeq ($(DEBUG),INFO)
132 DEBUG_FLAGS = -ggdb3
133 endif
134 OPTIMISATION_BASE := -flto -fuse-linker-plugin -ffast-math
135 OPTIMISE_DEFAULT := -O2
136 OPTIMISE_SPEED := -Ofast
137 OPTIMISE_SIZE := -Os
139 LTO_FLAGS := $(OPTIMISATION_BASE) $(OPTIMISE_SPEED)
140 endif
142 VPATH := $(VPATH):$(ROOT)/make/mcu
143 VPATH := $(VPATH):$(ROOT)/make
145 # start specific includes
146 include $(ROOT)/make/mcu/$(TARGET_MCU).mk
148 # openocd specific includes
149 include $(ROOT)/make/openocd.mk
151 # Configure default flash sizes for the targets (largest size specified gets hit first) if flash not specified already.
152 ifeq ($(FLASH_SIZE),)
153 ifneq ($(TARGET_FLASH),)
154 FLASH_SIZE := $(TARGET_FLASH)
155 else
156 $(error FLASH_SIZE not configured for target $(TARGET))
157 endif
158 endif
160 DEVICE_FLAGS := $(DEVICE_FLAGS) -DFLASH_SIZE=$(FLASH_SIZE)
162 ifneq ($(HSE_VALUE),)
163 DEVICE_FLAGS := $(DEVICE_FLAGS) -DHSE_VALUE=$(HSE_VALUE)
164 endif
166 ifneq ($(FEATURE_CUT_LEVEL_SUPPLIED),)
167 DEVICE_FLAGS := $(DEVICE_FLAGS) -DFEATURE_CUT_LEVEL=$(FEATURE_CUT_LEVEL_SUPPLIED)
168 else ifneq ($(FEATURE_CUT_LEVEL),)
169 DEVICE_FLAGS := $(DEVICE_FLAGS) -DFEATURE_CUT_LEVEL=$(FEATURE_CUT_LEVEL)
170 endif
172 TARGET_DIR = $(ROOT)/src/main/target/$(BASE_TARGET)
173 TARGET_DIR_SRC = $(notdir $(wildcard $(TARGET_DIR)/*.c))
175 ifeq ($(OPBL),yes)
176 TARGET_FLAGS := -DOPBL $(TARGET_FLAGS)
177 .DEFAULT_GOAL := binary
178 else
179 .DEFAULT_GOAL := hex
180 endif
182 INCLUDE_DIRS := $(INCLUDE_DIRS) \
183 $(ROOT)/lib/main/MAVLink
185 INCLUDE_DIRS := $(INCLUDE_DIRS) \
186 $(TARGET_DIR)
188 VPATH := $(VPATH):$(TARGET_DIR)
190 include $(ROOT)/make/source.mk
192 ###############################################################################
193 # Things that might need changing to use different tools
196 # Find out if ccache is installed on the system
197 CCACHE := ccache
198 RESULT = $(shell (which $(CCACHE) > /dev/null 2>&1; echo $$?) )
199 ifneq ($(RESULT),0)
200 CCACHE :=
201 endif
203 # Tool names
204 CROSS_CC := $(CCACHE) $(ARM_SDK_PREFIX)gcc
205 CROSS_CXX := $(CCACHE) $(ARM_SDK_PREFIX)g++
206 CROSS_GDB := $(ARM_SDK_PREFIX)gdb
207 OBJCOPY := $(ARM_SDK_PREFIX)objcopy
208 OBJDUMP := $(ARM_SDK_PREFIX)objdump
209 SIZE := $(ARM_SDK_PREFIX)size
212 # Tool options.
214 CC_DEBUG_OPTIMISATION := $(OPTIMISE_DEFAULT)
215 CC_DEFAULT_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_DEFAULT)
216 CC_SPEED_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_SPEED)
217 CC_SIZE_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_SIZE)
219 CFLAGS += $(ARCH_FLAGS) \
220 $(addprefix -D,$(OPTIONS)) \
221 $(addprefix -I,$(INCLUDE_DIRS)) \
222 $(DEBUG_FLAGS) \
223 -std=gnu11 \
224 -Wall -Wextra -Wunsafe-loop-optimizations -Wdouble-promotion \
225 -ffunction-sections \
226 -fdata-sections \
227 -fno-common \
228 -pedantic \
229 $(DEVICE_FLAGS) \
230 -D_GNU_SOURCE \
231 -DUSE_STDPERIPH_DRIVER \
232 -D$(TARGET) \
233 $(TARGET_FLAGS) \
234 -D'__FORKNAME__="$(FORKNAME)"' \
235 -D'__TARGET__="$(TARGET)"' \
236 -D'__REVISION__="$(REVISION)"' \
237 -save-temps=obj \
238 -MMD -MP \
239 $(EXTRA_FLAGS)
241 ASFLAGS = $(ARCH_FLAGS) \
242 $(DEBUG_FLAGS) \
243 -x assembler-with-cpp \
244 $(addprefix -I,$(INCLUDE_DIRS)) \
245 -MMD -MP
247 ifeq ($(LD_FLAGS),)
248 LD_FLAGS = -lm \
249 -nostartfiles \
250 --specs=nano.specs \
251 -lc \
252 -lnosys \
253 $(ARCH_FLAGS) \
254 $(LTO_FLAGS) \
255 $(DEBUG_FLAGS) \
256 -static \
257 -Wl,-gc-sections,-Map,$(TARGET_MAP) \
258 -Wl,-L$(LINKER_DIR) \
259 -Wl,--cref \
260 -Wl,--no-wchar-size-warning \
261 -Wl,--print-memory-usage \
262 -T$(LD_SCRIPT)
263 endif
265 ###############################################################################
266 # No user-serviceable parts below
267 ###############################################################################
269 CPPCHECK = cppcheck $(CSOURCES) --enable=all --platform=unix64 \
270 --std=c99 --inline-suppr --quiet --force \
271 $(addprefix -I,$(INCLUDE_DIRS)) \
272 -I/usr/include -I/usr/include/linux
275 # Things we will build
277 TARGET_BIN = $(BIN_DIR)/$(FORKNAME)_$(FC_VER)_$(TARGET).bin
278 TARGET_HEX = $(BIN_DIR)/$(FORKNAME)_$(FC_VER)_$(TARGET).hex
279 TARGET_ELF = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).elf
280 TARGET_LST = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).lst
281 TARGET_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $(SRC))))
282 TARGET_DEPS = $(addsuffix .d,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $(SRC))))
283 TARGET_MAP = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).map
286 CLEAN_ARTIFACTS := $(TARGET_BIN)
287 CLEAN_ARTIFACTS += $(TARGET_HEX)
288 CLEAN_ARTIFACTS += $(TARGET_ELF) $(TARGET_OBJS) $(TARGET_MAP)
289 CLEAN_ARTIFACTS += $(TARGET_LST)
291 # Make sure build date and revision is updated on every incremental build
292 $(OBJECT_DIR)/$(TARGET)/build/version.o : $(SRC)
294 # List of buildable ELF files and their object dependencies.
295 # It would be nice to compute these lists, but that seems to be just beyond make.
297 $(TARGET_LST): $(TARGET_ELF)
298 $(V0) $(OBJDUMP) -S --disassemble $< > $@
300 $(TARGET_HEX): $(TARGET_ELF)
301 @echo "Creating HEX $(TARGET_HEX)" "$(STDOUT)"
302 $(V1) $(OBJCOPY) -O ihex --set-start 0x8000000 $< $@
304 $(TARGET_BIN): $(TARGET_ELF)
305 @echo "Creating BIN $(TARGET_BIN)" "$(STDOUT)"
306 $(V1) $(OBJCOPY) -O binary $< $@
308 $(TARGET_ELF): $(TARGET_OBJS) $(LD_SCRIPT)
309 @echo "Linking $(TARGET)" "$(STDOUT)"
310 $(V1) $(CROSS_CC) -o $@ $(filter-out %.ld,$^) $(LD_FLAGS)
311 $(V1) $(SIZE) $(TARGET_ELF)
313 # Compile
314 ifeq ($(DEBUG),GDB)
315 $(OBJECT_DIR)/$(TARGET)/%.o: %.c
316 $(V1) mkdir -p $(dir $@)
317 $(V1) echo "%% (debug) $(notdir $<)" "$(STDOUT)" && \
318 $(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_DEBUG_OPTIMISATION) $<
319 else
320 $(OBJECT_DIR)/$(TARGET)/%.o: %.c
321 $(V1) mkdir -p $(dir $@)
322 $(V1) $(if $(findstring $(subst ./src/main/,,$<),$(SPEED_OPTIMISED_SRC)), \
323 echo "%% (speed optimised) $(notdir $<)" "$(STDOUT)" && \
324 $(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_SPEED_OPTIMISATION) $<, \
325 $(if $(findstring $(subst ./src/main/,,$<),$(SIZE_OPTIMISED_SRC)), \
326 echo "%% (size optimised) $(notdir $<)" "$(STDOUT)" && \
327 $(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_SIZE_OPTIMISATION) $<, \
328 echo "%% $(notdir $<)" "$(STDOUT)" && \
329 $(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_DEFAULT_OPTIMISATION) $<))
330 endif
332 # Assemble
333 $(OBJECT_DIR)/$(TARGET)/%.o: %.s
334 $(V1) mkdir -p $(dir $@)
335 @echo "%% $(notdir $<)" "$(STDOUT)"
336 $(V1) $(CROSS_CC) -c -o $@ $(ASFLAGS) $<
338 $(OBJECT_DIR)/$(TARGET)/%.o: %.S
339 $(V1) mkdir -p $(dir $@)
340 @echo "%% $(notdir $<)" "$(STDOUT)"
341 $(V1) $(CROSS_CC) -c -o $@ $(ASFLAGS) $<
344 ## all : Build all targets (excluding unsupported)
345 all: $(SUPPORTED_TARGETS)
347 ## all_with_unsupported : Build all targets (including unsupported)
348 all_with_unsupported: $(VALID_TARGETS)
350 ## unsupported : Build unsupported targets
351 unsupported: $(UNSUPPORTED_TARGETS)
353 ## pre-push : The minimum verification that should be run before pushing, to check if CI has a chance of succeeding
354 pre-push:
355 $(MAKE) $(addprefix clean_,$(PRE_PUSH_TARGET_LIST)) $(PRE_PUSH_TARGET_LIST) EXTRA_FLAGS=-Werror
357 ## official : Build all official (travis) targets
358 official: $(OFFICIAL_TARGETS)
360 ## targets-group-1 : build some targets
361 targets-group-1: $(GROUP_1_TARGETS)
363 ## targets-group-2 : build some targets
364 targets-group-2: $(GROUP_2_TARGETS)
366 ## targets-group-3 : build some targets
367 targets-group-3: $(GROUP_3_TARGETS)
369 ## targets-group-3 : build some targets
370 targets-group-4: $(GROUP_4_TARGETS)
372 ## targets-group-rest: build the rest of the targets (not listed in group 1, 2 or 3)
373 targets-group-rest: $(GROUP_OTHER_TARGETS)
375 $(VALID_TARGETS):
376 $(V0) @echo "Building $@" && \
377 $(MAKE) binary hex TARGET=$@ && \
378 echo "Building $@ succeeded."
380 $(NOBUILD_TARGETS):
381 $(MAKE) TARGET=$@
383 CLEAN_TARGETS = $(addprefix clean_,$(VALID_TARGETS) )
384 TARGETS_CLEAN = $(addsuffix _clean,$(VALID_TARGETS) )
386 ## clean : clean up temporary / machine-generated files
387 clean:
388 @echo "Cleaning $(TARGET)"
389 $(V0) rm -f $(CLEAN_ARTIFACTS)
390 $(V0) rm -rf $(OBJECT_DIR)/$(TARGET)
391 @echo "Cleaning $(TARGET) succeeded."
393 ## clean_test : clean up temporary / machine-generated files (tests)
394 clean_test-%:
395 $(MAKE) clean_test
397 clean_test:
398 $(V0) cd src/test && $(MAKE) clean || true
400 ## clean_<TARGET> : clean up one specific target
401 $(CLEAN_TARGETS):
402 $(V0) $(MAKE) -j TARGET=$(subst clean_,,$@) clean
404 ## <TARGET>_clean : clean up one specific target (alias for above)
405 $(TARGETS_CLEAN):
406 $(V0) $(MAKE) -j TARGET=$(subst _clean,,$@) clean
408 ## clean_all : clean all valid targets
409 clean_all: $(CLEAN_TARGETS)
411 ## all_clean : clean all valid targets (alias for above)
412 all_clean: $(TARGETS_CLEAN)
415 flash_$(TARGET): $(TARGET_HEX)
416 $(V0) stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon
417 $(V0) echo -n 'R' >$(SERIAL_DEVICE)
418 $(V0) stm32flash -w $(TARGET_HEX) -v -g 0x0 -b 115200 $(SERIAL_DEVICE)
420 ## flash : flash firmware (.hex) onto flight controller
421 flash: flash_$(TARGET)
423 st-flash_$(TARGET): $(TARGET_BIN)
424 $(V0) st-flash --reset write $< 0x08000000
426 ## st-flash : flash firmware (.bin) onto flight controller
427 st-flash: st-flash_$(TARGET)
429 ifneq ($(OPENOCD_COMMAND),)
430 openocd-gdb: $(TARGET_ELF)
431 $(V0) $(OPENOCD_COMMAND) & $(CROSS_GDB) $(TARGET_ELF) -ex "target remote localhost:3333" -ex "load"
432 endif
434 binary:
435 $(V0) $(MAKE) -j $(TARGET_BIN)
437 hex:
438 $(V0) $(MAKE) -j $(TARGET_HEX)
440 unbrick_$(TARGET): $(TARGET_HEX)
441 $(V0) stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon
442 $(V0) stm32flash -w $(TARGET_HEX) -v -g 0x0 -b 115200 $(SERIAL_DEVICE)
444 ## unbrick : unbrick flight controller
445 unbrick: unbrick_$(TARGET)
447 ## cppcheck : run static analysis on C source code
448 cppcheck: $(CSOURCES)
449 $(V0) $(CPPCHECK)
451 cppcheck-result.xml: $(CSOURCES)
452 $(V0) $(CPPCHECK) --xml-version=2 2> cppcheck-result.xml
454 # mkdirs
455 $(DL_DIR):
456 mkdir -p $@
458 $(TOOLS_DIR):
459 mkdir -p $@
461 $(BUILD_DIR):
462 mkdir -p $@
464 ## version : print firmware version
465 version:
466 @echo $(FC_VER)
468 ## help : print this help message and exit
469 help: Makefile make/tools.mk
470 @echo ""
471 @echo "Makefile for the $(FORKNAME) firmware"
472 @echo ""
473 @echo "Usage:"
474 @echo " make [V=<verbosity>] [TARGET=<target>] [OPTIONS=\"<options>\"]"
475 @echo "Or:"
476 @echo " make <target> [V=<verbosity>] [OPTIONS=\"<options>\"]"
477 @echo ""
478 @echo "Valid TARGET values are: $(VALID_TARGETS)"
479 @echo ""
480 @sed -n 's/^## //p' $?
482 ## targets : print a list of all valid target platforms (for consumption by scripts)
483 targets:
484 @echo "Valid targets: $(VALID_TARGETS)"
485 @echo "Supported targets: $(SUPPORTED_TARGETS)"
486 @echo "Unsupported targets: $(UNSUPPORTED_TARGETS)"
487 @echo "Target: $(TARGET)"
488 @echo "Base target: $(BASE_TARGET)"
489 @echo "targets-group-1: $(GROUP_1_TARGETS)"
490 @echo "targets-group-2: $(GROUP_2_TARGETS)"
491 @echo "targets-group-3: $(GROUP_3_TARGETS)"
492 @echo "targets-group-4: $(GROUP_4_TARGETS)"
493 @echo "targets-group-rest: $(GROUP_OTHER_TARGETS)"
495 @echo "targets-group-1: $(words $(GROUP_1_TARGETS)) targets"
496 @echo "targets-group-2: $(words $(GROUP_2_TARGETS)) targets"
497 @echo "targets-group-3: $(words $(GROUP_3_TARGETS)) targets"
498 @echo "targets-group-4: $(words $(GROUP_4_TARGETS)) targets"
499 @echo "targets-group-rest: $(words $(GROUP_OTHER_TARGETS)) targets"
500 @echo "total in all groups $(words $(SUPPORTED_TARGETS)) targets"
502 ## target-mcu : print the MCU type of the target
503 target-mcu:
504 @echo $(TARGET_MCU)
506 ## targets-by-mcu : make all targets that have a MCU_TYPE mcu
507 targets-by-mcu:
508 $(V1) for target in $(VALID_TARGETS); do \
509 TARGET_MCU_TYPE=$$($(MAKE) -s TARGET=$${target} target-mcu); \
510 if [ "$${TARGET_MCU_TYPE}" = "$${MCU_TYPE}" ]; then \
511 if [ "$${DO_BUILD}" = 1 ]; then \
512 echo "Building target $${target}..."; \
513 $(MAKE) TARGET=$${target}; \
514 if [ $$? -ne 0 ]; then \
515 echo "Building target $${target} failed, aborting."; \
516 exit 1; \
517 fi; \
518 else \
519 echo -n "$${target} "; \
520 fi; \
521 fi; \
522 done
523 @echo
525 ## targets-f3 : make all F3 targets
526 targets-f3:
527 $(V1) $(MAKE) -s targets-by-mcu MCU_TYPE=STM32F3 DO_BUILD=1
529 targets-f3-print:
530 $(V1) $(MAKE) -s targets-by-mcu MCU_TYPE=STM32F3
532 ## targets-f4 : make all F4 targets
533 targets-f4:
534 $(V1) $(MAKE) -s targets-by-mcu MCU_TYPE=STM32F4 DO_BUILD=1
536 targets-f4-print:
537 $(V1) $(MAKE) -s targets-by-mcu MCU_TYPE=STM32F4
539 ## targets-f7 : make all F7 targets
540 targets-f7:
541 $(V1) $(MAKE) -s targets-by-mcu MCU_TYPE=STM32F7 DO_BUILD=1
543 targets-f7-print:
544 $(V1) $(MAKE) -s targets-by-mcu MCU_TYPE=STM32F7
546 ## test : run the Betaflight test suite
547 ## junittest : run the Betaflight test suite, producing Junit XML result files.
548 ## test-representative: run a representative subset of the Betaflight test suite (i.e. run all tests, but run each expanded test only for one target)
549 ## test-all: run the Betaflight test suite including all per-target expanded tests
550 test junittest test-all test-representative:
551 $(V0) cd src/test && $(MAKE) $@
553 ## test_help : print the help message for the test suite (including a list of the available tests)
554 test_help:
555 $(V0) cd src/test && $(MAKE) help
557 ## test_% : run test 'test_%' from the test suite
558 test_%:
559 $(V0) cd src/test && $(MAKE) $@
562 check-target-independence:
563 $(V1) for test_target in $(VALID_TARGETS); do \
564 FOUND=$$(grep -rE "\W$${test_target}(\W.*)?$$" src/main | grep -vE "(//)|(/\*).*\W$${test_target}(\W.*)?$$" | grep -vE "^src/main/target"); \
565 if [ "$${FOUND}" != "" ]; then \
566 echo "Target dependencies for target '$${test_target}' found:"; \
567 echo "$${FOUND}"; \
568 exit 1; \
569 fi; \
570 done
572 check-fastram-usage-correctness:
573 $(V1) NON_TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_RAM_ZERO_INIT\W.*=.*" src/main/ | grep -Ev "=\s*(false|NULL|0(\.0*f?)?)\s*[,;]"); \
574 if [ "$${NON_TRIVIALLY_INITIALIZED}" != "" ]; then \
575 echo "Non-trivially initialized FAST_RAM_ZERO_INIT variables found, use FAST_RAM instead:"; \
576 echo "$${NON_TRIVIALLY_INITIALIZED}"; \
577 exit 1; \
578 fi; \
579 TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_RAM\W.*;" src/main/ | grep -v "="); \
580 EXPLICITLY_TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_RAM\W.*;" src/main/ | grep -E "=\s*(false|NULL|0(\.0*f?)?)\s*[,;]"); \
581 if [ "$${TRIVIALLY_INITIALIZED}$${EXPLICITLY_TRIVIALLY_INITIALIZED}" != "" ]; then \
582 echo "Trivially initialized FAST_RAM variables found, use FAST_RAM_ZERO_INIT instead to save FLASH:"; \
583 echo "$${TRIVIALLY_INITIALIZED}\n$${EXPLICITLY_TRIVIALLY_INITIALIZED}"; \
584 exit 1; \
587 check-platform-included:
588 $(V1) PLATFORM_NOT_INCLUDED=$$(find src/main -type d -name target -prune -o -type f -name \*.c -exec grep -L "^#include \"platform.h\"" {} \;); \
589 if [ "$$(echo $${PLATFORM_NOT_INCLUDED} | grep -v -e '^$$' | wc -l)" -ne 0 ]; then \
590 echo "The following compilation units do not include the required target specific configuration provided by 'platform.h':"; \
591 echo "$${PLATFORM_NOT_INCLUDED}"; \
592 exit 1; \
595 # rebuild everything when makefile changes
596 $(TARGET_OBJS): Makefile $(TARGET_DIR)/target.mk $(wildcard make/*)
599 # include auto-generated dependencies
600 -include $(TARGET_DEPS)