forked from emuflight/EmuFlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
576 lines (459 loc) · 17.7 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
###############################################################################
# "THE BEER-WARE LICENSE" (Revision 42):
# <[email protected]> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return
###############################################################################
#
# Makefile for building the EmuFlight firmware.
#
# Invoke this with 'make help' to see the list of supported targets.
#
###############################################################################
# Things that the user might override on the commandline
#
# The target to build, see VALID_TARGETS below
TARGET ?= HELIOSPRING
# Compile-time options
OPTIONS ?=
# compile for OpenPilot BootLoader support
OPBL ?= no
# Debugger optons:
# empty - ordinary build with all optimizations enabled
# RELWITHDEBINFO - ordinary build with debug symbols and all optimizations enabled
# GDB - debug build with minimum number of optimizations
DEBUG ?=
# Insert the debugging hardfault debugger
# releases should not be built with this flag as it does not disable pwm output
DEBUG_HARDFAULTS ?=
# Serial port/Device for flashing
SERIAL_DEVICE ?= $(firstword $(wildcard /dev/ttyUSB*) no-port-found)
# Flash size (KB). Some low-end chips actually have more flash than advertised, use this to override.
FLASH_SIZE ?=
###############################################################################
# Things that need to be maintained as the source changes
#
FORKNAME = EmuFlight
# Working directories
ROOT := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
SRC_DIR := $(ROOT)/src/main
OBJECT_DIR := $(ROOT)/obj/main
BIN_DIR := $(ROOT)/obj
CMSIS_DIR := $(ROOT)/lib/main/CMSIS
INCLUDE_DIRS := $(SRC_DIR) \
$(ROOT)/src/main/target
LINKER_DIR := $(ROOT)/src/main/target/link
## V : Set verbosity level based on the V= parameter
## V=0 Low
## V=1 High
include $(ROOT)/make/build_verbosity.mk
# Build tools, so we all share the same versions
# import macros common to all supported build systems
include $(ROOT)/make/system-id.mk
# developer preferences, edit these at will, they'll be gitignored
-include $(ROOT)/make/local.mk
# configure some directories that are relative to wherever ROOT_DIR is located
ifndef TOOLS_DIR
TOOLS_DIR := $(ROOT)/tools
endif
BUILD_DIR := $(ROOT)/build
DL_DIR := $(ROOT)/downloads
export RM := rm
# import macros that are OS specific
include $(ROOT)/make/$(OSFAMILY).mk
# include the tools makefile
include $(ROOT)/make/tools.mk
# default xtal value for F4 targets
HSE_VALUE ?= 8000000
# used for turning on features like VCP and SDCARD
FEATURES =
include $(ROOT)/make/targets.mk
# build number - default for local builds
BUILDNO := local
# github actions build
ifneq ($(GITHUBBUILDNUMBER),)
BUILDNO := $(GITHUBBUILDNUMBER)
endif
# travis build
ifneq ($(TRAVIS_BUILD_NUMBER),)
BUILDNO := $(TRAVIS_BUILD_NUMBER)
endif
BUILDDATETIME := $(shell date +'%Y%m%d%Z')
REVISION := uncommitted_$(BUILDDATETIME)
ifeq ($(shell git diff --shortstat),)
REVISION := $(shell git log -1 --format="%h")
endif
FC_VER_MAJOR := $(shell grep " FC_VERSION_MAJOR" src/main/build/version.h | awk '{print $$3}' )
FC_VER_MINOR := $(shell grep " FC_VERSION_MINOR" src/main/build/version.h | awk '{print $$3}' )
FC_VER_PATCH := $(shell grep " FC_VERSION_PATCH" src/main/build/version.h | awk '{print $$3}' )
FC_VER := $(FC_VER_MAJOR).$(FC_VER_MINOR).$(FC_VER_PATCH)
# Search path for sources
VPATH := $(SRC_DIR):$(SRC_DIR)/startup
USBFS_DIR = $(ROOT)/lib/main/STM32_USB-FS-Device_Driver
USBPERIPH_SRC = $(notdir $(wildcard $(USBFS_DIR)/src/*.c))
FATFS_DIR = $(ROOT)/lib/main/FatFS
FATFS_SRC = $(notdir $(wildcard $(FATFS_DIR)/*.c))
CSOURCES := $(shell find $(SRC_DIR) -name '*.c')
LD_FLAGS :=
#
# Default Tool options - can be overridden in {mcu}.mk files.
#
ifeq ($(DEBUG),GDB)
OPTIMISE_DEFAULT := -Og
LTO_FLAGS := $(OPTIMISE_DEFAULT)
DEBUG_FLAGS = -ggdb3 -DDEBUG
else
ifeq ($(DEBUG),INFO)
DEBUG_FLAGS = -ggdb3
endif
OPTIMISATION_BASE := -flto -fuse-linker-plugin -ffast-math
OPTIMISE_DEFAULT := -O2
OPTIMISE_SPEED := -Ofast
OPTIMISE_SIZE := -Os
LTO_FLAGS := $(OPTIMISATION_BASE) $(OPTIMISE_SPEED)
endif
VPATH := $(VPATH):$(ROOT)/make/mcu
VPATH := $(VPATH):$(ROOT)/make
# start specific includes
include $(ROOT)/make/mcu/$(TARGET_MCU).mk
# openocd specific includes
include $(ROOT)/make/openocd.mk
# Configure default flash sizes for the targets (largest size specified gets hit first) if flash not specified already.
ifeq ($(FLASH_SIZE),)
ifneq ($(TARGET_FLASH),)
FLASH_SIZE := $(TARGET_FLASH)
else
$(error FLASH_SIZE not configured for target $(TARGET))
endif
endif
DEVICE_FLAGS := $(DEVICE_FLAGS) -DFLASH_SIZE=$(FLASH_SIZE)
ifneq ($(HSE_VALUE),)
DEVICE_FLAGS := $(DEVICE_FLAGS) -DHSE_VALUE=$(HSE_VALUE)
endif
TARGET_DIR = $(ROOT)/src/main/target/$(BASE_TARGET)
TARGET_DIR_SRC = $(notdir $(wildcard $(TARGET_DIR)/*.c))
ifeq ($(OPBL),yes)
TARGET_FLAGS := -DOPBL $(TARGET_FLAGS)
.DEFAULT_GOAL := binary
else
.DEFAULT_GOAL := hex
endif
INCLUDE_DIRS := $(INCLUDE_DIRS) \
$(ROOT)/lib/main/MAVLink
INCLUDE_DIRS := $(INCLUDE_DIRS) \
$(TARGET_DIR)
VPATH := $(VPATH):$(TARGET_DIR)
include $(ROOT)/make/source.mk
###############################################################################
# Things that might need changing to use different tools
#
# Find out if ccache is installed on the system
CCACHE :=
CCACHE_CHECK = $(shell (command -v ccache) > /dev/null 2>&1; echo $$?)
ifeq ($(CCACHE_CHECK),0)
CCACHE := ccache
endif
# suit ccache
CROSS_COMPILE := $(ARM_SDK_PREFIX)
# Tool names
CROSS_CC := $(CCACHE) $(ARM_SDK_PREFIX)gcc
CROSS_CXX := $(CCACHE) $(ARM_SDK_PREFIX)g++
CROSS_GDB := $(ARM_SDK_PREFIX)gdb
OBJCOPY := $(ARM_SDK_PREFIX)objcopy
OBJDUMP := $(ARM_SDK_PREFIX)objdump
SIZE := $(ARM_SDK_PREFIX)size
#
# Tool options.
#
CC_DEBUG_OPTIMISATION := $(OPTIMISE_DEFAULT)
CC_DEFAULT_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_DEFAULT)
CC_SPEED_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_SPEED)
CC_SIZE_OPTIMISATION := $(OPTIMISATION_BASE) $(OPTIMISE_SIZE)
CFLAGS += $(ARCH_FLAGS) \
$(addprefix -D,$(OPTIONS)) \
$(addprefix -I,$(INCLUDE_DIRS)) \
$(DEBUG_FLAGS) \
-pedantic \
-save-temps=obj \
-std=gnu11 \
-Wall \
-Wdouble-promotion \
-Wduplicated-branches \
-Wduplicated-cond \
-Wextra \
-Wformat-truncation \
-Wformat=2 \
-Wlogical-op \
-Wnull-dereference \
-Wrestrict \
-Wunknown-pragmas \
-Wunsafe-loop-optimizations \
$(DEVICE_FLAGS) \
-D_GNU_SOURCE \
-DUSE_STDPERIPH_DRIVER \
-D$(TARGET) \
$(TARGET_FLAGS) \
-D'__FORKNAME__="$(FORKNAME)"' \
-D'__BUILDNO__="$(BUILDNO)"' \
-D'__TARGET__="$(TARGET)"' \
-D'__REVISION__="$(REVISION)"' \
-save-temps=obj \
-MMD \
-MP \
$(EXTRA_FLAGS)
ASFLAGS = $(ARCH_FLAGS) \
$(DEBUG_FLAGS) \
-x assembler-with-cpp \
$(addprefix -I,$(INCLUDE_DIRS)) \
-MMD -MP
ifeq ($(LD_FLAGS),)
LD_FLAGS = -lm \
-nostartfiles \
--specs=nano.specs \
-lc \
-lnosys \
$(ARCH_FLAGS) \
$(LTO_FLAGS) \
$(DEBUG_FLAGS) \
-static \
-Wl,--cref \
-Wl,--no-wchar-size-warning \
-Wl,--print-memory-usage \
-Wl,-gc-sections,-Map,$(TARGET_MAP) \
-Wl,-L$(LINKER_DIR) \
-T$(LD_SCRIPT)
endif
###############################################################################
# No user-serviceable parts below
###############################################################################
CPPCHECK = cppcheck $(CSOURCES) --enable=all --platform=unix64 \
--std=c99 --inline-suppr --quiet --force \
$(addprefix -I,$(INCLUDE_DIRS)) \
-I/usr/include -I/usr/include/linux
ifneq ($(BUILDNO),local)
TARGET_BASENAME = $(BIN_DIR)/$(FORKNAME)_$(FC_VER)_$(TARGET)_Build_$(BUILDNO)_$(REVISION)
else
TARGET_BASENAME = $(BIN_DIR)/$(FORKNAME)_$(FC_VER)_$(TARGET)_Build_$(REVISION)
endif
#
# Things we will build
#
TARGET_BIN = $(TARGET_BASENAME).bin
TARGET_HEX = $(TARGET_BASENAME).hex
TARGET_ELF = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).elf
TARGET_LST = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).lst
TARGET_OBJS = $(addsuffix .o,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $(SRC))))
TARGET_DEPS = $(addsuffix .d,$(addprefix $(OBJECT_DIR)/$(TARGET)/,$(basename $(SRC))))
TARGET_MAP = $(OBJECT_DIR)/$(FORKNAME)_$(TARGET).map
CLEAN_ARTIFACTS := $(TARGET_BIN)
CLEAN_ARTIFACTS += $(TARGET_HEX)
CLEAN_ARTIFACTS += $(TARGET_ELF) $(TARGET_OBJS) $(TARGET_MAP)
CLEAN_ARTIFACTS += $(TARGET_LST)
# Make sure build date and revision is updated on every incremental build
$(OBJECT_DIR)/$(TARGET)/build/version.o : $(SRC)
# List of buildable ELF files and their object dependencies.
# It would be nice to compute these lists, but that seems to be just beyond make.
$(TARGET_LST): $(TARGET_ELF)
$(V0) $(OBJDUMP) -S --disassemble $< > $@
$(TARGET_HEX): $(TARGET_ELF)
@echo "Creating HEX $(TARGET_HEX)" "$(STDOUT)"
$(V1) $(OBJCOPY) -O ihex --set-start 0x8000000 $< $@
$(TARGET_BIN): $(TARGET_ELF)
@echo "Creating BIN $(TARGET_BIN)" "$(STDOUT)"
$(V1) $(OBJCOPY) -O binary $< $@
$(TARGET_ELF): $(TARGET_OBJS)
@echo "Linking $(TARGET)" "$(STDOUT)"
$(V1) $(CROSS_CC) -o $@ $^ $(LD_FLAGS)
$(V1) $(SIZE) $(TARGET_ELF)
# Compile
ifeq ($(DEBUG),GDB)
$(OBJECT_DIR)/$(TARGET)/%.o: %.c
$(V1) mkdir -p $(dir $@)
$(V1) echo "%% (debug) $(notdir $<)" "$(STDOUT)" && \
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_DEBUG_OPTIMISATION) $<
else
$(OBJECT_DIR)/$(TARGET)/%.o: %.c
$(V1) mkdir -p $(dir $@)
$(V1) $(if $(findstring $(subst ./src/main/,,$<),$(SPEED_OPTIMISED_SRC)), \
echo "%% (speed optimised) $(notdir $<)" "$(STDOUT)" && \
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_SPEED_OPTIMISATION) $<, \
$(if $(findstring $(subst ./src/main/,,$<),$(SIZE_OPTIMISED_SRC)), \
echo "%% (size optimised) $(notdir $<)" "$(STDOUT)" && \
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_SIZE_OPTIMISATION) $<, \
echo "%% $(notdir $<)" "$(STDOUT)" && \
$(CROSS_CC) -c -o $@ $(CFLAGS) $(CC_DEFAULT_OPTIMISATION) $<))
endif
# Assemble
$(OBJECT_DIR)/$(TARGET)/%.o: %.s
$(V1) mkdir -p $(dir $@)
@echo "%% $(notdir $<)" "$(STDOUT)"
$(V1) $(CROSS_CC) -c -o $@ $(ASFLAGS) $<
$(OBJECT_DIR)/$(TARGET)/%.o: %.S
$(V1) mkdir -p $(dir $@)
@echo "%% $(notdir $<)" "$(STDOUT)"
$(V1) $(CROSS_CC) -c -o $@ $(ASFLAGS) $<
## all : Build all targets (excluding unsupported)
all supported: $(SUPPORTED_TARGETS)
## all_with_unsupported : Build all targets (including unsupported)
all_with_unsupported: $(VALID_TARGETS)
## unsupported : Build unsupported targets
unsupported: $(UNSUPPORTED_TARGETS)
## official : Build all "official" targets
official: $(OFFICIAL_TARGETS)
## targets-group-1 : build some targets
targets-group-1: $(GROUP_1_TARGETS)
## targets-group-2 : build some targets
targets-group-2: $(GROUP_2_TARGETS)
## targets-group-3 : build some targets
targets-group-3: $(GROUP_3_TARGETS)
## targets-group-rest: build the rest of the targets (not listed in group 1, 2 or 3)
targets-group-rest: $(GROUP_OTHER_TARGETS)
$(VALID_TARGETS):
$(V0) @echo "Building $@" && \
$(MAKE) binary hex TARGET=$@ && \
echo "Building $@ succeeded."
$(NOBUILD_TARGETS):
$(MAKE) TARGET=$@
CLEAN_TARGETS = $(addprefix clean_,$(VALID_TARGETS) )
TARGETS_CLEAN = $(addsuffix _clean,$(VALID_TARGETS) )
## clean : clean up temporary / machine-generated files
clean:
@echo "Cleaning $(TARGET)"
$(V0) rm -f $(CLEAN_ARTIFACTS)
$(V0) rm -rf $(OBJECT_DIR)/$(TARGET)
@echo "Cleaning $(TARGET) succeeded."
## clean_test : clean up temporary / machine-generated files (tests)
clean_test:
$(V0) cd src/test && $(MAKE) clean || true
## clean_<TARGET> : clean up one specific target
$(CLEAN_TARGETS):
$(V0) $(MAKE) -j TARGET=$(subst clean_,,$@) clean
## <TARGET>_clean : clean up one specific target (alias for above)
$(TARGETS_CLEAN):
$(V0) $(MAKE) -j TARGET=$(subst _clean,,$@) clean
## clean_all : clean all valid targets
clean_all: $(CLEAN_TARGETS)
## all_clean : clean all valid targets (alias for above)
all_clean: $(TARGETS_CLEAN)
flash_$(TARGET): $(TARGET_HEX)
$(V0) stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon
$(V0) echo -n 'R' >$(SERIAL_DEVICE)
$(V0) stm32flash -w $(TARGET_HEX) -v -g 0x0 -b 115200 $(SERIAL_DEVICE)
## flash : flash firmware (.hex) onto flight controller
flash: flash_$(TARGET)
st-flash_$(TARGET): $(TARGET_BIN)
$(V0) st-flash --reset write $< 0x08000000
## st-flash : flash firmware (.bin) onto flight controller
st-flash: st-flash_$(TARGET)
ifneq ($(OPENOCD_COMMAND),)
openocd-gdb: $(TARGET_ELF)
$(V0) $(OPENOCD_COMMAND) & $(CROSS_GDB) $(TARGET_ELF) -ex "target remote localhost:3333" -ex "load"
endif
binary:
$(V0) $(MAKE) -j $(TARGET_BIN)
hex:
$(V0) $(MAKE) -j $(TARGET_HEX)
unbrick_$(TARGET): $(TARGET_HEX)
$(V0) stty -F $(SERIAL_DEVICE) raw speed 115200 -crtscts cs8 -parenb -cstopb -ixon
$(V0) stm32flash -w $(TARGET_HEX) -v -g 0x0 -b 115200 $(SERIAL_DEVICE)
## unbrick : unbrick flight controller
unbrick: unbrick_$(TARGET)
## cppcheck : run static analysis on C source code
cppcheck: $(CSOURCES)
$(V0) $(CPPCHECK)
cppcheck-result.xml: $(CSOURCES)
$(V0) $(CPPCHECK) --xml-version=2 2> cppcheck-result.xml
# mkdirs
$(DL_DIR):
$(V1) mkdir -p $@
$(TOOLS_DIR):
$(V1) mkdir -p $@
$(BUILD_DIR):
$(V1) mkdir -p $@
## version : print firmware version
version:
@echo $(FC_VER)
## help : print this help message and exit
help: Makefile make/tools.mk
@echo ""
@echo "Makefile for the $(FORKNAME) firmware"
@echo ""
@echo "Usage:"
@echo " make [V=<verbosity>] [TARGET=<target>] [OPTIONS=\"<options>\"]"
@echo "Or:"
@echo " make <target> [V=<verbosity>] [OPTIONS=\"<options>\"]"
@echo ""
@echo "Valid TARGET values are: $(VALID_TARGETS)"
@echo ""
@sed -n 's/^## //p' $?
## targets : print a list of all valid target platforms (for consumption by scripts)
targets:
@echo "Valid targets: $(VALID_TARGETS)"
@echo "Supported targets: $(SUPPORTED_TARGETS)"
@echo "Unsupported targets: $(UNSUPPORTED_TARGETS)"
@echo "Target: $(TARGET)"
@echo "Base target: $(BASE_TARGET)"
@echo "targets-group-1: $(GROUP_1_TARGETS)"
@echo "targets-group-2: $(GROUP_2_TARGETS)"
@echo "targets-group-rest: $(GROUP_OTHER_TARGETS)"
@echo "targets-group-1: $(words $(GROUP_1_TARGETS)) targets"
@echo "targets-group-2: $(words $(GROUP_2_TARGETS)) targets"
@echo "targets-group-rest: $(words $(GROUP_OTHER_TARGETS)) targets"
@echo "total in all groups $(words $(SUPPORTED_TARGETS)) targets"
## target-mcu : print the MCU type of the target
target-mcu:
@echo $(TARGET_MCU)
## targets-by-mcu : make all targets that have a MCU_TYPE mcu
targets-by-mcu:
@echo "Building all $(MCU_TYPE) targets..."
$(V1) for target in $(VALID_TARGETS); do \
TARGET_MCU_TYPE=$$($(MAKE) -s TARGET=$${target} target-mcu); \
if [ "$${TARGET_MCU_TYPE}" = "$${MCU_TYPE}" ]; then \
echo "Building target $${target}..."; \
$(MAKE) TARGET=$${target}; \
if [ $$? -ne 0 ]; then \
echo "Building target $${target} failed, aborting."; \
exit 1; \
fi; \
fi; \
done
## targets-f3 : make all F3 targets
targets-f3:
$(V1) $(MAKE) -s targets-by-mcu MCU_TYPE=STM32F3
## targets-f4 : make all F4 targets
targets-f4:
$(V1) $(MAKE) -s targets-by-mcu MCU_TYPE=STM32F4
## targets-f7 : make all F7 targets
targets-f7:
$(V1) $(MAKE) -s targets-by-mcu MCU_TYPE=STM32F7
## test : run the cleanflight test suite
## junittest : run the cleanflight test suite, producing Junit XML result files.
test junittest:
$(V0) cd src/test && $(MAKE) $@
check-target-independence:
$(V1) for test_target in $(VALID_TARGETS); do \
FOUND=$$(grep -rE "\W$${test_target}\W?" src/main | grep -vE "(//)|(/\*).*\W$${test_target}\W?" | grep -vE "^src/main/target"); \
if [ "$${FOUND}" != "" ]; then \
echo "Target dependencies found:"; \
echo "$${FOUND}"; \
exit 1; \
fi; \
done
check-fastram-usage-correctness:
$(V1) NON_TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_RAM_ZERO_INIT\W.*=.*" src/main/ | grep -Ev "=\s*(false|NULL|0(\.0*f?)?)\s*[,;]"); \
if [ "$${NON_TRIVIALLY_INITIALIZED}" != "" ]; then \
echo "Non-trivially initialized FAST_RAM_ZERO_INIT variables found, use FAST_RAM instead:"; \
echo "$${NON_TRIVIALLY_INITIALIZED}"; \
exit 1; \
fi; \
TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_RAM\W.*;" src/main/ | grep -v "="); \
EXPLICITLY_TRIVIALLY_INITIALIZED=$$(grep -Ern "\W?FAST_RAM\W.*;" src/main/ | grep -E "=\s*(false|NULL|0(\.0*f?)?)\s*[,;]"); \
if [ "$${TRIVIALLY_INITIALIZED}$${EXPLICITLY_TRIVIALLY_INITIALIZED}" != "" ]; then \
echo "Trivially initialized FAST_RAM variables found, use FAST_RAM_ZERO_INIT instead to save FLASH:"; \
echo "$${TRIVIALLY_INITIALIZED}\n$${EXPLICITLY_TRIVIALLY_INITIALIZED}"; \
exit 1; \
fi;
# rebuild everything when makefile changes
$(TARGET_OBJS) : Makefile
# include auto-generated dependencies
-include $(TARGET_DEPS)