2 # Main Project Makefile
3 # This Makefile is included directly from the user project Makefile in order to call the component.mk
4 # makefiles of all components (in a separate make process) to build all the libraries, then links them
5 # together into the final file. If so, PWD is the project dir (we assume).
9 # This makefile requires the environment variable IDF_PATH to be set to the top-level esp-idf directory
10 # where this file is located.
13 .PHONY: build-components menuconfig defconfig all build clean all_binaries check-submodules size size-components size-files size-symbols list-components
16 all: all_binaries check_python_dependencies
17 # see below for recipe of 'all' target
19 # # other components will add dependencies to 'all_binaries'. The
20 # reason all_binaries is used instead of 'all' is so that the flash
21 # target can build everything without triggering the per-component "to
22 # flash..." output targets.)
25 @echo "Welcome to Espressif IDF build system. Some useful make targets:"
27 @echo "make menuconfig - Configure IDF project"
28 @echo "make defconfig - Set defaults for all new configuration options"
30 @echo "make all - Build app, bootloader, partition table"
31 @echo "make flash - Flash app, bootloader, partition table to a chip"
32 @echo "make clean - Remove all build output"
33 @echo "make size - Display the static memory footprint of the app"
34 @echo "make size-components, size-files - Finer-grained memory footprints"
35 @echo "make size-symbols - Per symbol memory footprint. Requires COMPONENT=<component>"
36 @echo "make erase_flash - Erase entire flash contents"
37 @echo "make erase_ota - Erase ota_data partition. After that will boot first bootable partition (factory or OTAx)."
38 @echo "make monitor - Run idf_monitor tool to monitor serial output from app"
39 @echo "make simple_monitor - Monitor serial output on terminal console"
40 @echo "make list-components - List all components in the project"
42 @echo "make app - Build just the app"
43 @echo "make app-flash - Flash just the app"
44 @echo "make app-clean - Clean just the app"
45 @echo "make print_flash_cmd - Print the arguments for esptool when flash"
46 @echo "make check_python_dependencies - Check that the required python packages are installed"
48 @echo "See also 'make bootloader', 'make bootloader-flash', 'make bootloader-clean', "
49 @echo "'make partition_table', etc, etc."
51 # Non-interactive targets. Mostly, those for which you do not need to build a binary
52 NON_INTERACTIVE_TARGET += defconfig clean% %clean help list-components print_flash_cmd check_python_dependencies
56 ifeq ("$(filter 4.% 3.81 3.82,$(MAKE_VERSION))","")
57 $(warning esp-idf build system only supports GNU Make versions 3.81 or newer. You may see unexpected results with other Makes.)
61 ifneq ("$(MSYSTEM)","MINGW32")
62 $(warning esp-idf build system only supports MSYS2 in "MINGW32" mode. Consult the ESP-IDF documentation for details.)
68 # can't run 'clean' along with any non-clean targets
69 ifneq ("$(filter clean% %clean,$(MAKECMDGOALS))" ,"")
70 ifneq ("$(filter-out clean% %clean,$(MAKECMDGOALS))", "")
71 $(error esp-idf build system doesn't support running 'clean' targets along with any others. Run 'make clean' and then run other targets separately.)
77 # make IDF_PATH a "real" absolute path
78 # * works around the case where a shell character is embedded in the environment variable value.
79 # * changes Windows-style C:/blah/ paths to MSYS style /c/blah
80 ifeq ("$(OS)","Windows_NT")
81 # On Windows MSYS2, make wildcard function returns empty string for paths of form /xyz
82 # where /xyz is a directory inside the MSYS root - so we don't use it.
83 SANITISED_IDF_PATH:=$(realpath $(IDF_PATH))
85 SANITISED_IDF_PATH:=$(realpath $(wildcard $(IDF_PATH)))
88 export IDF_PATH := $(SANITISED_IDF_PATH)
91 $(error IDF_PATH variable is not set to a valid directory.)
94 ifneq ("$(IDF_PATH)","$(SANITISED_IDF_PATH)")
95 # implies IDF_PATH was overriden on make command line.
96 # Due to the way make manages variables, this is hard to account for
98 # if you see this error, do the shell expansion in the shell ie
99 # make IDF_PATH=~/blah not make IDF_PATH="~/blah"
100 $(error If IDF_PATH is overriden on command line, it must be an absolute path with no embedded shell special characters)
103 ifneq ("$(IDF_PATH)","$(subst :,,$(IDF_PATH))")
104 $(error IDF_PATH cannot contain colons. If overriding IDF_PATH on Windows, use MSYS Unix-style /c/dir instead of C:/dir)
107 # disable built-in make rules, makes debugging saner
108 MAKEFLAGS_OLD := $(MAKEFLAGS)
111 # Default path to the project: we assume the Makefile including this file
112 # is in the project directory
114 PROJECT_PATH := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
118 # A list of the "common" makefiles, to use as a target dependency
119 COMMON_MAKEFILES := $(abspath $(IDF_PATH)/make/project.mk $(IDF_PATH)/make/common.mk $(IDF_PATH)/make/component_wrapper.mk $(firstword $(MAKEFILE_LIST)))
120 export COMMON_MAKEFILES
122 # The directory where we put all objects/libraries/binaries. The project Makefile can
123 # configure this if needed.
124 ifndef BUILD_DIR_BASE
125 BUILD_DIR_BASE := $(PROJECT_PATH)/build
127 export BUILD_DIR_BASE
129 # Component directories. These directories are searched for components (either the directory is a component,
130 # or the directory contains subdirectories which are components.)
131 # The project Makefile can override these component dirs, or add extras via EXTRA_COMPONENT_DIRS
132 ifndef COMPONENT_DIRS
133 EXTRA_COMPONENT_DIRS ?=
134 COMPONENT_DIRS := $(PROJECT_PATH)/components $(EXTRA_COMPONENT_DIRS) $(IDF_PATH)/components $(PROJECT_PATH)/main
136 export COMPONENT_DIRS
139 $(warning SRCDIRS variable is deprecated. These paths can be added to EXTRA_COMPONENT_DIRS or COMPONENT_DIRS instead.)
140 COMPONENT_DIRS += $(abspath $(SRCDIRS))
143 # The project Makefile can define a list of components, but if it does not do this we just take all available components
144 # in the component dirs. A component is COMPONENT_DIRS directory, or immediate subdirectory,
145 # which contains a component.mk file.
147 # Use the "make list-components" target to debug this step.
149 # Find all component names. The component names are the same as the
150 # directories they're in, so /bla/components/mycomponent/component.mk -> mycomponent.
151 COMPONENTS := $(dir $(foreach cd,$(COMPONENT_DIRS), \
152 $(wildcard $(cd)/*/component.mk) $(wildcard $(cd)/component.mk) \
154 COMPONENTS := $(sort $(foreach comp,$(COMPONENTS),$(lastword $(subst /, ,$(comp)))))
156 # After a full manifest of component names is determined, subtract the ones explicitly omitted by the project Makefile.
157 ifdef EXCLUDE_COMPONENTS
158 COMPONENTS := $(filter-out $(subst ",,$(EXCLUDE_COMPONENTS)), $(COMPONENTS))
159 # to keep syntax highlighters happy: "))
163 # Resolve all of COMPONENTS into absolute paths in COMPONENT_PATHS.
165 # If a component name exists in multiple COMPONENT_DIRS, we take the first match.
167 # NOTE: These paths must be generated WITHOUT a trailing / so we
168 # can use $(notdir x) to get the component name.
169 COMPONENT_PATHS := $(foreach comp,$(COMPONENTS),$(firstword $(foreach cd,$(COMPONENT_DIRS),$(wildcard $(dir $(cd))$(comp) $(cd)/$(comp)))))
170 export COMPONENT_PATHS
173 TEST_EXCLUDE_COMPONENTS ?=
176 # If TESTS_ALL set to 1, set TEST_COMPONENTS_LIST to all components.
177 # Otherwise, use the list supplied in TEST_COMPONENTS.
178 ifeq ($(TESTS_ALL),1)
179 TEST_COMPONENTS_LIST := $(filter-out $(TEST_EXCLUDE_COMPONENTS), $(COMPONENTS))
181 TEST_COMPONENTS_LIST := $(TEST_COMPONENTS)
184 TEST_COMPONENT_PATHS := $(foreach comp,$(TEST_COMPONENTS_LIST),$(firstword $(foreach dir,$(COMPONENT_DIRS),$(wildcard $(dir)/$(comp)/test))))
185 TEST_COMPONENT_NAMES := $(foreach comp,$(TEST_COMPONENT_PATHS),$(lastword $(subst /, ,$(dir $(comp))))_test)
187 # Initialise project-wide variables which can be added to by
190 # These variables are built up via the component_project_vars.mk
191 # generated makefiles (one per component).
193 # See docs/build-system.rst for more details.
194 COMPONENT_INCLUDES :=
196 COMPONENT_SUBMODULES :=
197 COMPONENT_LIBRARIES :=
199 # COMPONENT_PROJECT_VARS is the list of component_project_vars.mk generated makefiles
200 # for each component.
202 # Including $(COMPONENT_PROJECT_VARS) builds the COMPONENT_INCLUDES,
203 # COMPONENT_LDFLAGS variables and also targets for any inter-component
206 # See the component_project_vars.mk target in component_wrapper.mk
207 COMPONENT_PROJECT_VARS := $(addsuffix /component_project_vars.mk,$(notdir $(COMPONENT_PATHS) ) $(TEST_COMPONENT_NAMES))
208 COMPONENT_PROJECT_VARS := $(addprefix $(BUILD_DIR_BASE)/,$(COMPONENT_PROJECT_VARS))
209 # this line is -include instead of include to prevent a spurious error message on make 3.81
210 -include $(COMPONENT_PROJECT_VARS)
212 # Also add top-level project include path, for top-level includes
213 COMPONENT_INCLUDES += $(abspath $(BUILD_DIR_BASE)/include/)
215 export COMPONENT_INCLUDES
217 # Set variables common to both project & component
218 include $(IDF_PATH)/make/common.mk
221 ifdef CONFIG_SECURE_BOOT_ENABLED
222 @echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)"
223 ifndef CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES
224 @echo "App built but not signed. Sign app & partition data before flashing, via espsecure.py:"
225 @echo "espsecure.py sign_data --keyfile KEYFILE $(APP_BIN)"
226 @echo "espsecure.py sign_data --keyfile KEYFILE $(PARTITION_TABLE_BIN)"
228 @echo "To flash app & partition table, run 'make flash' or:"
230 @echo "To flash all build output, run 'make flash' or:"
232 @echo $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
235 # If we have `version.txt` then prefer that for extracting IDF version
236 ifeq ("$(wildcard ${IDF_PATH}/version.txt)","")
237 IDF_VER := $(shell cd ${IDF_PATH} && git describe --always --tags --dirty)
239 IDF_VER := `cat ${IDF_PATH}/version.txt`
242 # Set default LDFLAGS
244 LDFLAGS ?= -nostdlib \
245 -u call_user_start_cpu0 \
250 $(COMPONENT_LDFLAGS) \
257 # Set default CPPFLAGS, CFLAGS, CXXFLAGS
258 # These are exported so that components can use them when compiling.
259 # If you need your component to add CFLAGS/etc for it's own source compilation only, set CFLAGS += in your component's Makefile.
260 # If you need your component to add CFLAGS/etc globally for all source
261 # files, set CFLAGS += in your component's Makefile.projbuild
262 # If you need to set CFLAGS/CPPFLAGS/CXXFLAGS at project level, set them in application Makefile
263 # before including project.mk. Default flags will be added before the ones provided in application Makefile.
265 # CPPFLAGS used by C preprocessor
266 # If any flags are defined in application Makefile, add them at the end.
269 CPPFLAGS := -DESP_PLATFORM -D IDF_VER=\"$(IDF_VER)\" -MMD -MP $(CPPFLAGS) $(EXTRA_CPPFLAGS)
271 # Warnings-related flags relevant both for C and C++
272 COMMON_WARNING_FLAGS = -Wall -Werror=all \
273 -Wno-error=unused-function \
274 -Wno-error=unused-but-set-variable \
275 -Wno-error=unused-variable \
276 -Wno-error=deprecated-declarations \
278 -Wno-unused-parameter -Wno-sign-compare
280 ifdef CONFIG_WARN_WRITE_STRINGS
281 COMMON_WARNING_FLAGS += -Wwrite-strings
282 endif #CONFIG_WARN_WRITE_STRINGS
284 # Flags which control code generation and dependency generation, both for C and C++
286 -ffunction-sections -fdata-sections \
287 -fstrict-volatile-bitfields \
291 ifndef IS_BOOTLOADER_BUILD
292 # stack protection (only one option can be selected in menuconfig)
293 ifdef CONFIG_STACK_CHECK_NORM
294 COMMON_FLAGS += -fstack-protector
296 ifdef CONFIG_STACK_CHECK_STRONG
297 COMMON_FLAGS += -fstack-protector-strong
299 ifdef CONFIG_STACK_CHECK_ALL
300 COMMON_FLAGS += -fstack-protector-all
304 # Optimization flags are set based on menuconfig choice
305 ifdef CONFIG_OPTIMIZATION_LEVEL_RELEASE
306 OPTIMIZATION_FLAGS = -Os
308 OPTIMIZATION_FLAGS = -Og
311 ifdef CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED
315 # Enable generation of debugging symbols
316 # (we generate even in Release mode, as this has no impact on final binary size.)
319 # List of flags to pass to C compiler
320 # If any flags are defined in application Makefile, add them at the end.
325 $(OPTIMIZATION_FLAGS) $(DEBUG_FLAGS) \
327 $(COMMON_WARNING_FLAGS) -Wno-old-style-declaration \
331 # List of flags to pass to C++ compiler
332 # If any flags are defined in application Makefile, add them at the end.
335 CXXFLAGS := $(strip \
338 $(OPTIMIZATION_FLAGS) $(DEBUG_FLAGS) \
340 $(COMMON_WARNING_FLAGS) \
344 ifdef CONFIG_CXX_EXCEPTIONS
345 CXXFLAGS += -fexceptions
347 CXXFLAGS += -fno-exceptions
352 export CFLAGS CPPFLAGS CXXFLAGS ARFLAGS
354 # Set default values that were not previously defined
361 # Set host compiler and binutils
365 HOSTOBJCOPY := $(OBJCOPY)
367 export HOSTCC HOSTLD HOSTAR HOSTOBJCOPY SIZE
369 # Set target compiler. Defaults to whatever the user has
370 # configured as prefix + ye olde gcc commands
371 CC := $(call dequote,$(CONFIG_TOOLPREFIX))gcc
372 CXX := $(call dequote,$(CONFIG_TOOLPREFIX))c++
373 LD := $(call dequote,$(CONFIG_TOOLPREFIX))ld
374 AR := $(call dequote,$(CONFIG_TOOLPREFIX))ar
375 OBJCOPY := $(call dequote,$(CONFIG_TOOLPREFIX))objcopy
376 SIZE := $(call dequote,$(CONFIG_TOOLPREFIX))size
377 export CC CXX LD AR OBJCOPY SIZE
379 PYTHON=$(call dequote,$(CONFIG_PYTHON))
381 # the app is the main executable built by the project
382 APP_ELF:=$(BUILD_DIR_BASE)/$(PROJECT_NAME).elf
383 APP_MAP:=$(APP_ELF:.elf=.map)
384 APP_BIN:=$(APP_ELF:.elf=.bin)
386 # Include any Makefile.projbuild file letting components add
387 # configuration at the project level
388 define includeProjBuildMakefile
389 $(if $(V),$$(info including $(1)/Makefile.projbuild...))
390 COMPONENT_PATH := $(1)
391 include $(1)/Makefile.projbuild
393 $(foreach componentpath,$(COMPONENT_PATHS), \
394 $(if $(wildcard $(componentpath)/Makefile.projbuild), \
395 $(eval $(call includeProjBuildMakefile,$(componentpath)))))
397 # once we know component paths, we can include the config generation targets
399 # (bootloader build doesn't need this, config is exported from top-level)
400 ifndef IS_BOOTLOADER_BUILD
401 include $(IDF_PATH)/make/project_config.mk
404 # ELF depends on the library archive files for COMPONENT_LIBRARIES
405 # the rules to build these are emitted as part of GenerateComponentTarget below
407 # also depends on additional dependencies (linker scripts & binary libraries)
408 # stored in COMPONENT_LINKER_DEPS, built via component.mk files' COMPONENT_ADD_LINKER_DEPS variable
409 COMPONENT_LINKER_DEPS ?=
410 $(APP_ELF): $(foreach libcomp,$(COMPONENT_LIBRARIES),$(BUILD_DIR_BASE)/$(libcomp)/lib$(libcomp).a) $(COMPONENT_LINKER_DEPS) $(COMPONENT_PROJECT_VARS)
411 $(summary) LD $(patsubst $(PWD)/%,%,$@)
412 $(CC) $(LDFLAGS) -o $@ -Wl,-Map=$(APP_MAP)
414 app: $(APP_BIN) partition_table_get_info
415 ifeq ("$(CONFIG_SECURE_BOOT_ENABLED)$(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)","y") # secure boot enabled, but remote sign app image
416 @echo "App built but not signed. Signing step via espsecure.py:"
417 @echo "espsecure.py sign_data --keyfile KEYFILE $(APP_BIN)"
418 @echo "Then flash app command is:"
419 @echo $(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN)
421 @echo "App built. Default flash app command is:"
422 @echo $(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN)
425 .PHONY: check_python_dependencies
427 # Notify users when some of the required python packages are not installed
428 check_python_dependencies:
429 ifndef IS_BOOTLOADER_BUILD
430 $(PYTHON) $(IDF_PATH)/tools/check_python_dependencies.py
433 all_binaries: $(APP_BIN)
436 mkdir -p $(BUILD_DIR_BASE)
438 # Macro for the recursive sub-make for each component
439 # $(1) - component directory
440 # $(2) - component name only
442 # Is recursively expanded by the GenerateComponentTargets macro
444 +$(MAKE) -C $(BUILD_DIR_BASE)/$(2) -f $(IDF_PATH)/make/component_wrapper.mk COMPONENT_MAKEFILE=$(1)/component.mk COMPONENT_NAME=$(2)
447 # Generate top-level component-specific targets for each component
448 # $(1) - path to component dir
449 # $(2) - name of component
451 define GenerateComponentTargets
452 .PHONY: component-$(2)-build component-$(2)-clean
454 component-$(2)-build: check-submodules $(call prereq_if_explicit, component-$(2)-clean) | $(BUILD_DIR_BASE)/$(2)
455 $(call ComponentMake,$(1),$(2)) build
457 component-$(2)-clean: | $(BUILD_DIR_BASE)/$(2) $(BUILD_DIR_BASE)/$(2)/component_project_vars.mk
458 $(call ComponentMake,$(1),$(2)) clean
460 $(BUILD_DIR_BASE)/$(2):
461 @mkdir -p $(BUILD_DIR_BASE)/$(2)
463 # tell make it can build any component's library by invoking the -build target
464 # (this target exists for all components even ones which don't build libraries, but it's
465 # only invoked for the targets whose libraries appear in COMPONENT_LIBRARIES and hence the
466 # APP_ELF dependencies.)
467 $(BUILD_DIR_BASE)/$(2)/lib$(2).a: component-$(2)-build
468 $(details) "Target '$$^' responsible for '$$@'" # echo which build target built this file
470 # add a target to generate the component_project_vars.mk files that
471 # are used to inject variables into project make pass (see matching
472 # component_project_vars.mk target in component_wrapper.mk).
474 # If any component_project_vars.mk file is out of date, the make
475 # process will call this target to rebuild it and then restart.
477 $(BUILD_DIR_BASE)/$(2)/component_project_vars.mk: $(1)/component.mk $(COMMON_MAKEFILES) $(SDKCONFIG_MAKEFILE) | $(BUILD_DIR_BASE)/$(2)
478 $(call ComponentMake,$(1),$(2)) component_project_vars.mk
481 $(foreach component,$(COMPONENT_PATHS),$(eval $(call GenerateComponentTargets,$(component),$(notdir $(component)))))
482 $(foreach component,$(TEST_COMPONENT_PATHS),$(eval $(call GenerateComponentTargets,$(component),$(lastword $(subst /, ,$(dir $(component))))_test)))
484 app-clean: $(addprefix component-,$(addsuffix -clean,$(notdir $(COMPONENT_PATHS))))
485 $(summary) RM $(APP_ELF)
486 rm -f $(APP_ELF) $(APP_BIN) $(APP_MAP)
488 size: check_python_dependencies $(APP_ELF)
489 $(PYTHON) $(IDF_PATH)/tools/idf_size.py $(APP_MAP)
491 size-files: check_python_dependencies $(APP_ELF)
492 $(PYTHON) $(IDF_PATH)/tools/idf_size.py --files $(APP_MAP)
494 size-components: check_python_dependencies $(APP_ELF)
495 $(PYTHON) $(IDF_PATH)/tools/idf_size.py --archives $(APP_MAP)
497 size-symbols: check_python_dependencies $(APP_ELF)
499 $(error "ERROR: Please enter the component to look symbols for, e.g. COMPONENT=heap")
501 $(PYTHON) $(IDF_PATH)/tools/idf_size.py --archive_details lib$(COMPONENT).a $(APP_MAP)
504 # NB: this ordering is deliberate (app-clean & bootloader-clean before
505 # _config-clean), so config remains valid during all component clean
507 config-clean: app-clean bootloader-clean
508 clean: app-clean bootloader-clean config-clean
510 # phony target to check if any git submodule listed in COMPONENT_SUBMODULES are missing
511 # or out of date, and exit if so. Components can add paths to this variable.
513 # This only works for components inside IDF_PATH
515 # Check if .gitmodules exists, otherwise skip submodule check, assuming flattened structure
516 ifneq ("$(wildcard ${IDF_PATH}/.gitmodules)","")
518 # Dump the git status for the whole working copy once, then grep it for each submodule. This saves a lot of time on Windows.
519 GIT_STATUS := $(shell cd ${IDF_PATH} && git status --porcelain --ignore-submodules=dirty)
521 # Generate a target to check this submodule
522 # $(1) - submodule directory, relative to IDF_PATH
523 define GenerateSubmoduleCheckTarget
524 check-submodules: $(IDF_PATH)/$(1)/.git
525 $(IDF_PATH)/$(1)/.git:
526 @echo "WARNING: Missing submodule $(1)..."
527 [ -e ${IDF_PATH}/.git ] || ( echo "ERROR: esp-idf must be cloned from git to work."; exit 1)
528 [ -x "$(shell which git)" ] || ( echo "ERROR: Need to run 'git submodule init $(1)' in esp-idf root directory."; exit 1)
529 @echo "Attempting 'git submodule update --init $(1)' in esp-idf root directory..."
530 cd ${IDF_PATH} && git submodule update --init $(1)
532 # Parse 'git status' output to check if the submodule commit is different to expected
533 ifneq ("$(filter $(1),$(GIT_STATUS))","")
534 $$(info WARNING: esp-idf git submodule $(1) may be out of date. Run 'git submodule update' in IDF_PATH dir to update.)
538 # filter/subst in expression ensures all submodule paths begin with $(IDF_PATH), and then strips that prefix
539 # so the argument is suitable for use with 'git submodule' commands
540 $(foreach submodule,$(subst $(IDF_PATH)/,,$(filter $(IDF_PATH)/%,$(COMPONENT_SUBMODULES))),$(eval $(call GenerateSubmoduleCheckTarget,$(submodule))))
541 endif # End check for .gitmodules existence
544 # PHONY target to list components in the build and their paths
546 $(info $(call dequote,$(SEPARATOR)))
547 $(info COMPONENT_DIRS (components searched for here))
548 $(foreach cd,$(COMPONENT_DIRS),$(info $(cd)))
549 $(info $(call dequote,$(SEPARATOR)))
550 $(info TEST_COMPONENTS (list of test component names))
551 $(info $(TEST_COMPONENTS_LIST))
552 $(info $(call dequote,$(SEPARATOR)))
553 $(info TEST_EXCLUDE_COMPONENTS (list of test excluded names))
554 $(info $(if $(EXCLUDE_COMPONENTS) || $(TEST_EXCLUDE_COMPONENTS),$(EXCLUDE_COMPONENTS) $(TEST_EXCLUDE_COMPONENTS),(none provided)))
555 $(info $(call dequote,$(SEPARATOR)))
556 $(info COMPONENT_PATHS (paths to all components):)
557 $(foreach cp,$(COMPONENT_PATHS),$(info $(cp)))
559 # print flash command, so users can dump this to config files and download somewhere without idf
560 print_flash_cmd: partition_table_get_info blank_ota_data
561 echo $(ESPTOOL_WRITE_FLASH_OPTIONS) $(ESPTOOL_ALL_FLASH_ARGS) | sed -e 's:'$(PWD)/build/'::g'
563 # Check toolchain version using the output of xtensa-esp32-elf-gcc --version command.
564 # The output normally looks as follows
565 # xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-59-ga194053) 4.8.5
566 # The part in brackets is extracted into TOOLCHAIN_COMMIT_DESC variable,
567 # the part after the brackets is extracted into TOOLCHAIN_GCC_VER.
568 ifdef CONFIG_TOOLPREFIX
570 TOOLCHAIN_COMMIT_DESC := $(shell $(CC) --version | sed -E -n 's|.*crosstool-ng-([0-9]+).([0-9]+).([0-9]+)-([0-9]+)-g([0-9a-f]{7}).*|\1.\2.\3-\4-g\5|gp')
571 TOOLCHAIN_GCC_VER := $(shell $(CC) --version | sed -E -n 's|xtensa-esp32-elf-gcc.*\ \(.*\)\ (.*)|\1|gp')
573 # Officially supported version(s)
574 SUPPORTED_TOOLCHAIN_COMMIT_DESC := 1.22.0-80-g6c4433a
575 SUPPORTED_TOOLCHAIN_GCC_VERSIONS := 5.2.0
577 ifdef TOOLCHAIN_COMMIT_DESC
578 ifneq ($(TOOLCHAIN_COMMIT_DESC), $(SUPPORTED_TOOLCHAIN_COMMIT_DESC))
579 $(info WARNING: Toolchain version is not supported: $(TOOLCHAIN_COMMIT_DESC))
580 $(info Expected to see version: $(SUPPORTED_TOOLCHAIN_COMMIT_DESC))
581 $(info Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.)
583 ifeq (,$(findstring $(TOOLCHAIN_GCC_VER), $(SUPPORTED_TOOLCHAIN_GCC_VERSIONS)))
584 $(info WARNING: Compiler version is not supported: $(TOOLCHAIN_GCC_VER))
585 $(info Expected to see version(s): $(SUPPORTED_TOOLCHAIN_GCC_VERSIONS))
586 $(info Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.)
589 $(info WARNING: Failed to find Xtensa toolchain, may need to alter PATH or set one in the configuration menu)
590 endif # TOOLCHAIN_COMMIT_DESC
593 endif #CONFIG_TOOLPREFIX