2016-08-17 15:08:22 +00:00
|
|
|
#
|
|
|
|
# Main Project Makefile
|
2016-08-31 23:19:06 +00:00
|
|
|
# This Makefile is included directly from the user project Makefile in order to call the component.mk
|
|
|
|
# makefiles of all components (in a separate make process) to build all the libraries, then links them
|
|
|
|
# together into the final file. If so, PWD is the project dir (we assume).
|
2016-08-17 15:08:22 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
#
|
2016-08-31 23:19:06 +00:00
|
|
|
# This makefile requires the environment variable IDF_PATH to be set to the top-level esp-idf directory
|
|
|
|
# where this file is located.
|
2016-08-17 15:08:22 +00:00
|
|
|
#
|
|
|
|
|
2018-02-19 11:54:12 +00:00
|
|
|
.PHONY: build-components menuconfig defconfig all build clean all_binaries check-submodules size size-components size-files size-symbols list-components
|
2017-10-20 04:14:41 +00:00
|
|
|
|
|
|
|
MAKECMDGOALS ?= all
|
2018-09-03 09:42:10 +00:00
|
|
|
all: all_binaries | check_python_dependencies
|
2016-10-31 23:50:16 +00:00
|
|
|
# see below for recipe of 'all' target
|
|
|
|
#
|
|
|
|
# # other components will add dependencies to 'all_binaries'. The
|
|
|
|
# reason all_binaries is used instead of 'all' is so that the flash
|
|
|
|
# target can build everything without triggering the per-component "to
|
|
|
|
# flash..." output targets.)
|
2016-08-18 09:11:27 +00:00
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "Welcome to Espressif IDF build system. Some useful make targets:"
|
|
|
|
@echo ""
|
|
|
|
@echo "make menuconfig - Configure IDF project"
|
2016-08-23 08:18:36 +00:00
|
|
|
@echo "make defconfig - Set defaults for all new configuration options"
|
2016-08-18 09:11:27 +00:00
|
|
|
@echo ""
|
|
|
|
@echo "make all - Build app, bootloader, partition table"
|
2016-12-19 23:00:04 +00:00
|
|
|
@echo "make flash - Flash app, bootloader, partition table to a chip"
|
2016-08-18 09:11:27 +00:00
|
|
|
@echo "make clean - Remove all build output"
|
2017-06-15 02:18:48 +00:00
|
|
|
@echo "make size - Display the static memory footprint of the app"
|
|
|
|
@echo "make size-components, size-files - Finer-grained memory footprints"
|
2018-02-19 11:54:12 +00:00
|
|
|
@echo "make size-symbols - Per symbol memory footprint. Requires COMPONENT=<component>"
|
2016-12-19 23:00:04 +00:00
|
|
|
@echo "make erase_flash - Erase entire flash contents"
|
2018-11-15 21:01:41 +00:00
|
|
|
@echo "make erase_otadata - Erase ota_data partition; First bootable partition (factory or OTAx) will be used on next boot."
|
|
|
|
@echo " This assumes this project's partition table is the one flashed on the device."
|
2017-03-07 22:15:19 +00:00
|
|
|
@echo "make monitor - Run idf_monitor tool to monitor serial output from app"
|
|
|
|
@echo "make simple_monitor - Monitor serial output on terminal console"
|
2017-06-21 05:09:24 +00:00
|
|
|
@echo "make list-components - List all components in the project"
|
2016-08-18 09:11:27 +00:00
|
|
|
@echo ""
|
|
|
|
@echo "make app - Build just the app"
|
|
|
|
@echo "make app-flash - Flash just the app"
|
|
|
|
@echo "make app-clean - Clean just the app"
|
2017-10-10 02:51:08 +00:00
|
|
|
@echo "make print_flash_cmd - Print the arguments for esptool when flash"
|
2018-08-15 07:52:07 +00:00
|
|
|
@echo "make check_python_dependencies - Check that the required python packages are installed"
|
2016-08-18 09:11:27 +00:00
|
|
|
@echo ""
|
|
|
|
@echo "See also 'make bootloader', 'make bootloader-flash', 'make bootloader-clean', "
|
|
|
|
@echo "'make partition_table', etc, etc."
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2018-03-27 05:13:35 +00:00
|
|
|
# Non-interactive targets. Mostly, those for which you do not need to build a binary
|
2018-08-15 07:52:07 +00:00
|
|
|
NON_INTERACTIVE_TARGET += defconfig clean% %clean help list-components print_flash_cmd check_python_dependencies
|
2018-03-27 05:13:35 +00:00
|
|
|
|
2016-11-13 23:51:53 +00:00
|
|
|
# dependency checks
|
|
|
|
ifndef MAKE_RESTARTS
|
|
|
|
ifeq ("$(filter 4.% 3.81 3.82,$(MAKE_VERSION))","")
|
2017-09-04 03:17:32 +00:00
|
|
|
$(warning esp-idf build system only supports GNU Make versions 3.81 or newer. You may see unexpected results with other Makes.)
|
2016-11-13 23:51:53 +00:00
|
|
|
endif
|
2017-09-21 01:21:55 +00:00
|
|
|
|
|
|
|
ifdef MSYSTEM
|
|
|
|
ifneq ("$(MSYSTEM)","MINGW32")
|
|
|
|
$(warning esp-idf build system only supports MSYS2 in "MINGW32" mode. Consult the ESP-IDF documentation for details.)
|
2016-11-13 23:51:53 +00:00
|
|
|
endif
|
2017-09-21 01:21:55 +00:00
|
|
|
endif # MSYSTEM
|
|
|
|
|
|
|
|
endif # MAKE_RESTARTS
|
2016-11-13 23:51:53 +00:00
|
|
|
|
2017-09-04 03:17:32 +00:00
|
|
|
# can't run 'clean' along with any non-clean targets
|
|
|
|
ifneq ("$(filter clean% %clean,$(MAKECMDGOALS))" ,"")
|
|
|
|
ifneq ("$(filter-out clean% %clean,$(MAKECMDGOALS))", "")
|
|
|
|
$(error esp-idf build system doesn't support running 'clean' targets along with any others. Run 'make clean' and then run other targets separately.)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-12-03 22:11:22 +00:00
|
|
|
OS ?=
|
2017-09-04 03:17:32 +00:00
|
|
|
|
2016-12-21 23:31:20 +00:00
|
|
|
# make IDF_PATH a "real" absolute path
|
|
|
|
# * works around the case where a shell character is embedded in the environment variable value.
|
2017-10-09 01:48:29 +00:00
|
|
|
# * changes Windows-style C:/blah/ paths to MSYS style /c/blah
|
2017-01-04 01:36:59 +00:00
|
|
|
ifeq ("$(OS)","Windows_NT")
|
|
|
|
# On Windows MSYS2, make wildcard function returns empty string for paths of form /xyz
|
|
|
|
# where /xyz is a directory inside the MSYS root - so we don't use it.
|
|
|
|
SANITISED_IDF_PATH:=$(realpath $(IDF_PATH))
|
|
|
|
else
|
|
|
|
SANITISED_IDF_PATH:=$(realpath $(wildcard $(IDF_PATH)))
|
|
|
|
endif
|
|
|
|
|
|
|
|
export IDF_PATH := $(SANITISED_IDF_PATH)
|
2016-12-16 00:30:37 +00:00
|
|
|
|
|
|
|
ifndef IDF_PATH
|
|
|
|
$(error IDF_PATH variable is not set to a valid directory.)
|
|
|
|
endif
|
|
|
|
|
2018-10-19 03:51:51 +00:00
|
|
|
ifdef IDF_TARGET
|
|
|
|
ifneq ($(IDF_TARGET),esp32)
|
|
|
|
$(error GNU Make based build system only supports esp32 target, but IDF_TARGET is set to $(IDF_TARGET))
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
export IDF_TARGET := esp32
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2017-01-04 01:36:59 +00:00
|
|
|
ifneq ("$(IDF_PATH)","$(SANITISED_IDF_PATH)")
|
|
|
|
# implies IDF_PATH was overriden on make command line.
|
|
|
|
# Due to the way make manages variables, this is hard to account for
|
2016-12-16 00:30:37 +00:00
|
|
|
#
|
|
|
|
# if you see this error, do the shell expansion in the shell ie
|
|
|
|
# make IDF_PATH=~/blah not make IDF_PATH="~/blah"
|
|
|
|
$(error If IDF_PATH is overriden on command line, it must be an absolute path with no embedded shell special characters)
|
|
|
|
endif
|
|
|
|
|
2016-12-21 23:31:20 +00:00
|
|
|
ifneq ("$(IDF_PATH)","$(subst :,,$(IDF_PATH))")
|
2017-10-09 01:48:29 +00:00
|
|
|
$(error IDF_PATH cannot contain colons. If overriding IDF_PATH on Windows, use MSYS Unix-style /c/dir instead of C:/dir)
|
2016-12-21 23:31:20 +00:00
|
|
|
endif
|
|
|
|
|
2016-08-17 15:08:22 +00:00
|
|
|
# disable built-in make rules, makes debugging saner
|
2016-10-06 07:29:34 +00:00
|
|
|
MAKEFLAGS_OLD := $(MAKEFLAGS)
|
2016-08-17 15:08:22 +00:00
|
|
|
MAKEFLAGS +=-rR
|
|
|
|
|
2016-11-10 05:19:59 +00:00
|
|
|
# Default path to the project: we assume the Makefile including this file
|
|
|
|
# is in the project directory
|
|
|
|
ifndef PROJECT_PATH
|
2016-08-17 15:08:22 +00:00
|
|
|
PROJECT_PATH := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
|
|
|
|
export PROJECT_PATH
|
2016-08-18 04:36:15 +00:00
|
|
|
endif
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-11-10 02:20:55 +00:00
|
|
|
# A list of the "common" makefiles, to use as a target dependency
|
2019-03-22 04:40:12 +00:00
|
|
|
COMMON_MAKEFILES := $(abspath $(IDF_PATH)/make/project.mk $(IDF_PATH)/make/common.mk $(IDF_PATH)/make/version.mk $(IDF_PATH)/make/component_wrapper.mk $(firstword $(MAKEFILE_LIST)))
|
2016-11-09 01:51:55 +00:00
|
|
|
export COMMON_MAKEFILES
|
|
|
|
|
2016-11-10 02:20:55 +00:00
|
|
|
# The directory where we put all objects/libraries/binaries. The project Makefile can
|
|
|
|
# configure this if needed.
|
2017-06-23 04:08:01 +00:00
|
|
|
ifndef BUILD_DIR_BASE
|
|
|
|
BUILD_DIR_BASE := $(PROJECT_PATH)/build
|
|
|
|
endif
|
2016-10-04 04:03:48 +00:00
|
|
|
export BUILD_DIR_BASE
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2017-06-21 04:41:04 +00:00
|
|
|
# Component directories. These directories are searched for components (either the directory is a component,
|
|
|
|
# or the directory contains subdirectories which are components.)
|
|
|
|
# The project Makefile can override these component dirs, or add extras via EXTRA_COMPONENT_DIRS
|
2017-06-23 04:08:01 +00:00
|
|
|
ifndef COMPONENT_DIRS
|
2016-12-03 22:11:22 +00:00
|
|
|
EXTRA_COMPONENT_DIRS ?=
|
2017-06-23 04:08:01 +00:00
|
|
|
COMPONENT_DIRS := $(PROJECT_PATH)/components $(EXTRA_COMPONENT_DIRS) $(IDF_PATH)/components $(PROJECT_PATH)/main
|
|
|
|
endif
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
# Make sure that every directory in the list is an absolute path without trailing slash.
|
2019-11-30 05:36:31 +00:00
|
|
|
# This is necessary to split COMPONENT_DIRS into SINGLE_COMPONENT_DIRS and MULTI_COMPONENT_DIRS below.
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
COMPONENT_DIRS := $(foreach cd,$(COMPONENT_DIRS),$(abspath $(cd)))
|
2016-08-17 15:08:22 +00:00
|
|
|
export COMPONENT_DIRS
|
|
|
|
|
2017-06-21 04:41:04 +00:00
|
|
|
ifdef SRCDIRS
|
|
|
|
$(warning SRCDIRS variable is deprecated. These paths can be added to EXTRA_COMPONENT_DIRS or COMPONENT_DIRS instead.)
|
|
|
|
COMPONENT_DIRS += $(abspath $(SRCDIRS))
|
|
|
|
endif
|
2016-11-10 02:20:55 +00:00
|
|
|
|
2019-11-30 05:36:31 +00:00
|
|
|
# List of component directories, i.e. directories which contain a component.mk file
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
SINGLE_COMPONENT_DIRS := $(abspath $(dir $(dir $(foreach cd,$(COMPONENT_DIRS),\
|
|
|
|
$(wildcard $(cd)/component.mk)))))
|
|
|
|
|
2019-11-30 05:36:31 +00:00
|
|
|
# List of components directories, i.e. directories which may contain components
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
MULTI_COMPONENT_DIRS := $(filter-out $(SINGLE_COMPONENT_DIRS),$(COMPONENT_DIRS))
|
|
|
|
|
|
|
|
# The project Makefile can define a list of components, but if it does not do this
|
|
|
|
# we just take all available components in the component dirs.
|
|
|
|
# A component is COMPONENT_DIRS directory, or immediate subdirectory,
|
2017-06-23 04:08:01 +00:00
|
|
|
# which contains a component.mk file.
|
2017-06-21 04:41:04 +00:00
|
|
|
#
|
|
|
|
# Use the "make list-components" target to debug this step.
|
2016-11-10 05:19:59 +00:00
|
|
|
ifndef COMPONENTS
|
2016-11-10 02:20:55 +00:00
|
|
|
# Find all component names. The component names are the same as the
|
2017-06-21 04:41:04 +00:00
|
|
|
# directories they're in, so /bla/components/mycomponent/component.mk -> mycomponent.
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
# We need to do this for MULTI_COMPONENT_DIRS only, since SINGLE_COMPONENT_DIRS
|
|
|
|
# are already known to contain component.mk.
|
|
|
|
COMPONENTS := $(dir $(foreach cd,$(MULTI_COMPONENT_DIRS),$(wildcard $(cd)/*/component.mk))) \
|
|
|
|
$(SINGLE_COMPONENT_DIRS)
|
2016-08-17 15:08:22 +00:00
|
|
|
COMPONENTS := $(sort $(foreach comp,$(COMPONENTS),$(lastword $(subst /, ,$(comp)))))
|
|
|
|
endif
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
# After a full manifest of component names is determined, subtract the ones explicitly
|
|
|
|
# omitted by the project Makefile.
|
|
|
|
EXCLUDE_COMPONENTS ?=
|
2018-04-08 17:07:43 +00:00
|
|
|
ifdef EXCLUDE_COMPONENTS
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
COMPONENTS := $(filter-out $(subst ",,$(EXCLUDE_COMPONENTS)), $(COMPONENTS))
|
2018-04-28 11:57:00 +00:00
|
|
|
# to keep syntax highlighters happy: "))
|
2018-04-08 17:07:43 +00:00
|
|
|
endif
|
2016-08-17 15:08:22 +00:00
|
|
|
export COMPONENTS
|
|
|
|
|
2016-11-10 02:20:55 +00:00
|
|
|
# Resolve all of COMPONENTS into absolute paths in COMPONENT_PATHS.
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
# For each entry in COMPONENT_DIRS:
|
|
|
|
# - either this is directory with multiple components, in which case check that
|
|
|
|
# a subdirectory with component name exists, and it contains a component.mk file.
|
|
|
|
# - or, this is a directory of a single component, in which case the name of this
|
|
|
|
# directory has to match the component name
|
2016-11-10 02:20:55 +00:00
|
|
|
#
|
|
|
|
# If a component name exists in multiple COMPONENT_DIRS, we take the first match.
|
|
|
|
#
|
|
|
|
# NOTE: These paths must be generated WITHOUT a trailing / so we
|
|
|
|
# can use $(notdir x) to get the component name.
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
COMPONENT_PATHS := $(foreach comp,$(COMPONENTS),\
|
|
|
|
$(firstword $(foreach cd,$(COMPONENT_DIRS),\
|
|
|
|
$(if $(findstring $(cd),$(MULTI_COMPONENT_DIRS)),\
|
|
|
|
$(abspath $(dir $(wildcard $(cd)/$(comp)/component.mk))),)\
|
|
|
|
$(if $(findstring $(cd),$(SINGLE_COMPONENT_DIRS)),\
|
|
|
|
$(if $(filter $(comp),$(notdir $(cd))),$(cd),),)\
|
|
|
|
)))
|
2017-12-13 07:48:49 +00:00
|
|
|
export COMPONENT_PATHS
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2017-09-05 10:07:00 +00:00
|
|
|
TEST_COMPONENTS ?=
|
2018-06-28 09:54:15 +00:00
|
|
|
TEST_EXCLUDE_COMPONENTS ?=
|
2017-09-05 10:07:00 +00:00
|
|
|
TESTS_ALL ?=
|
|
|
|
|
|
|
|
# If TESTS_ALL set to 1, set TEST_COMPONENTS_LIST to all components.
|
|
|
|
# Otherwise, use the list supplied in TEST_COMPONENTS.
|
2016-11-23 03:42:12 +00:00
|
|
|
ifeq ($(TESTS_ALL),1)
|
2018-06-28 09:54:15 +00:00
|
|
|
TEST_COMPONENTS_LIST := $(filter-out $(TEST_EXCLUDE_COMPONENTS), $(COMPONENTS))
|
2017-09-05 10:07:00 +00:00
|
|
|
else
|
2017-03-09 11:42:46 +00:00
|
|
|
TEST_COMPONENTS_LIST := $(TEST_COMPONENTS)
|
2016-11-23 03:42:12 +00:00
|
|
|
endif
|
2017-09-05 10:07:00 +00:00
|
|
|
|
2017-03-09 11:42:46 +00:00
|
|
|
TEST_COMPONENT_PATHS := $(foreach comp,$(TEST_COMPONENTS_LIST),$(firstword $(foreach dir,$(COMPONENT_DIRS),$(wildcard $(dir)/$(comp)/test))))
|
2016-12-03 22:11:22 +00:00
|
|
|
TEST_COMPONENT_NAMES := $(foreach comp,$(TEST_COMPONENT_PATHS),$(lastword $(subst /, ,$(dir $(comp))))_test)
|
2016-11-17 08:36:10 +00:00
|
|
|
|
2019-03-13 11:03:41 +00:00
|
|
|
# Set default values that were not previously defined
|
|
|
|
CC ?= gcc
|
|
|
|
LD ?= ld
|
|
|
|
AR ?= ar
|
|
|
|
OBJCOPY ?= objcopy
|
|
|
|
OBJDUMP ?= objdump
|
|
|
|
SIZE ?= size
|
|
|
|
|
|
|
|
# Set host compiler and binutils
|
|
|
|
HOSTCC := $(CC)
|
|
|
|
HOSTLD := $(LD)
|
|
|
|
HOSTAR := $(AR)
|
|
|
|
HOSTOBJCOPY := $(OBJCOPY)
|
|
|
|
HOSTSIZE := $(SIZE)
|
|
|
|
export HOSTCC HOSTLD HOSTAR HOSTOBJCOPY SIZE
|
|
|
|
|
|
|
|
# Set variables common to both project & component (includes config)
|
|
|
|
include $(IDF_PATH)/make/common.mk
|
|
|
|
|
|
|
|
# Notify users when some of the required python packages are not installed
|
|
|
|
.PHONY: check_python_dependencies
|
|
|
|
check_python_dependencies:
|
|
|
|
ifndef IS_BOOTLOADER_BUILD
|
|
|
|
$(PYTHON) $(IDF_PATH)/tools/check_python_dependencies.py
|
|
|
|
endif
|
|
|
|
|
|
|
|
# include the config generation targets (dependency: COMPONENT_PATHS)
|
|
|
|
#
|
|
|
|
# (bootloader build doesn't need this, config is exported from top-level)
|
|
|
|
ifndef IS_BOOTLOADER_BUILD
|
|
|
|
include $(IDF_PATH)/make/project_config.mk
|
|
|
|
endif
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
# If SDKCONFIG_MAKEFILE hasn't been generated yet (detected if no
|
|
|
|
# CONFIG_IDF_TARGET), stop the Makefile pass now to allow config to
|
|
|
|
# be created. make will build SDKCONFIG_MAKEFILE and restart,
|
|
|
|
# reevaluating everything from the top.
|
|
|
|
#
|
|
|
|
# This is important so config is present when the
|
|
|
|
# component_project_vars.mk files are generated.
|
|
|
|
#
|
|
|
|
# (After both files exist, if SDKCONFIG_MAKEFILE is updated then the
|
|
|
|
# normal dependency relationship will trigger a regeneration of
|
|
|
|
# component_project_vars.mk)
|
|
|
|
#
|
|
|
|
#####################################################################
|
|
|
|
ifndef CONFIG_IDF_TARGET
|
|
|
|
ifdef IS_BOOTLOADER_BUILD # we expect config to always have been expanded by top level project
|
|
|
|
$(error "Internal error: config has not been passed correctly to bootloader subproject")
|
|
|
|
endif
|
|
|
|
ifdef MAKE_RESTARTS
|
|
|
|
$(warning "Config was not evaluated after the first pass of 'make'")
|
|
|
|
endif
|
|
|
|
else # CONFIG_IDF_TARGET
|
|
|
|
#####################################################################
|
|
|
|
# Config is valid, can include rest of the Project Makefile
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
|
2016-11-16 00:12:48 +00:00
|
|
|
# Initialise project-wide variables which can be added to by
|
|
|
|
# each component.
|
2016-11-10 02:20:55 +00:00
|
|
|
#
|
|
|
|
# These variables are built up via the component_project_vars.mk
|
|
|
|
# generated makefiles (one per component).
|
2016-11-16 00:12:48 +00:00
|
|
|
#
|
|
|
|
# See docs/build-system.rst for more details.
|
2016-08-18 04:36:15 +00:00
|
|
|
COMPONENT_INCLUDES :=
|
|
|
|
COMPONENT_LDFLAGS :=
|
2016-11-16 00:12:48 +00:00
|
|
|
COMPONENT_SUBMODULES :=
|
2017-09-05 05:50:31 +00:00
|
|
|
COMPONENT_LIBRARIES :=
|
2018-04-18 02:57:45 +00:00
|
|
|
COMPONENT_LDFRAGMENTS :=
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-11-10 02:20:55 +00:00
|
|
|
# COMPONENT_PROJECT_VARS is the list of component_project_vars.mk generated makefiles
|
|
|
|
# for each component.
|
|
|
|
#
|
|
|
|
# Including $(COMPONENT_PROJECT_VARS) builds the COMPONENT_INCLUDES,
|
|
|
|
# COMPONENT_LDFLAGS variables and also targets for any inter-component
|
|
|
|
# dependencies.
|
2016-08-17 15:08:22 +00:00
|
|
|
#
|
2016-11-10 02:20:55 +00:00
|
|
|
# See the component_project_vars.mk target in component_wrapper.mk
|
2017-06-23 04:08:01 +00:00
|
|
|
COMPONENT_PROJECT_VARS := $(addsuffix /component_project_vars.mk,$(notdir $(COMPONENT_PATHS) ) $(TEST_COMPONENT_NAMES))
|
2016-11-09 01:51:55 +00:00
|
|
|
COMPONENT_PROJECT_VARS := $(addprefix $(BUILD_DIR_BASE)/,$(COMPONENT_PROJECT_VARS))
|
2016-11-13 23:51:53 +00:00
|
|
|
# this line is -include instead of include to prevent a spurious error message on make 3.81
|
|
|
|
-include $(COMPONENT_PROJECT_VARS)
|
2016-11-09 01:51:55 +00:00
|
|
|
|
2016-11-10 02:20:55 +00:00
|
|
|
# Also add top-level project include path, for top-level includes
|
2016-10-06 07:05:51 +00:00
|
|
|
COMPONENT_INCLUDES += $(abspath $(BUILD_DIR_BASE)/include/)
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-11-09 01:51:55 +00:00
|
|
|
export COMPONENT_INCLUDES
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-10-31 23:50:16 +00:00
|
|
|
all:
|
2020-02-24 19:51:41 +00:00
|
|
|
ifdef CONFIG_SECURE_BOOT
|
2016-10-31 23:50:16 +00:00
|
|
|
@echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)"
|
2017-09-05 05:50:31 +00:00
|
|
|
ifndef CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES
|
2020-02-24 19:51:41 +00:00
|
|
|
ifdef SECURE_SIGNED_APPS_ECDSA_SCHEME
|
2016-12-19 02:06:21 +00:00
|
|
|
@echo "App built but not signed. Sign app & partition data before flashing, via espsecure.py:"
|
2020-02-24 19:51:41 +00:00
|
|
|
@echo "espsecure.py sign_data --version 1 --keyfile KEYFILE $(APP_BIN)"
|
|
|
|
@echo "espsecure.py sign_data --version 1 --keyfile KEYFILE $(PARTITION_TABLE_BIN)"
|
2020-11-10 07:40:01 +00:00
|
|
|
else
|
2020-02-24 19:51:41 +00:00
|
|
|
@echo "App built but not signed. Sign app & partition data before flashing, via espsecure.py:"
|
|
|
|
@echo "espsecure.py sign_data --version 2 --keyfile KEYFILE $(APP_BIN)"
|
|
|
|
endif
|
2016-12-19 02:06:21 +00:00
|
|
|
endif
|
2016-10-31 23:50:16 +00:00
|
|
|
@echo "To flash app & partition table, run 'make flash' or:"
|
|
|
|
else
|
2019-07-22 14:04:03 +00:00
|
|
|
ifdef CONFIG_APP_BUILD_GENERATE_BINARIES
|
2016-10-31 23:50:16 +00:00
|
|
|
@echo "To flash all build output, run 'make flash' or:"
|
|
|
|
endif
|
2019-07-22 14:04:03 +00:00
|
|
|
endif
|
|
|
|
ifdef CONFIG_APP_BUILD_GENERATE_BINARIES
|
2016-10-31 23:50:16 +00:00
|
|
|
@echo $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
2019-07-22 14:04:03 +00:00
|
|
|
else
|
|
|
|
@echo "Binary is not available for flashing"
|
|
|
|
endif
|
2016-10-31 23:50:16 +00:00
|
|
|
|
2017-01-10 16:24:50 +00:00
|
|
|
|
2018-04-10 03:20:59 +00:00
|
|
|
# If we have `version.txt` then prefer that for extracting IDF version
|
|
|
|
ifeq ("$(wildcard ${IDF_PATH}/version.txt)","")
|
2021-02-17 13:04:04 +00:00
|
|
|
IDF_VER_T := $(shell cd ${IDF_PATH} && git describe --always --dirty --match v*.*)
|
2018-04-10 03:20:59 +00:00
|
|
|
else
|
2019-03-17 13:33:22 +00:00
|
|
|
IDF_VER_T := $(shell cat ${IDF_PATH}/version.txt)
|
2018-04-10 03:20:59 +00:00
|
|
|
endif
|
2019-03-13 12:01:28 +00:00
|
|
|
IDF_VER := $(shell echo "$(IDF_VER_T)" | cut -c 1-31)
|
2017-01-10 16:24:50 +00:00
|
|
|
|
2016-09-09 00:14:38 +00:00
|
|
|
# Set default LDFLAGS
|
2016-12-03 22:11:22 +00:00
|
|
|
EXTRA_LDFLAGS ?=
|
2016-09-09 00:14:38 +00:00
|
|
|
LDFLAGS ?= -nostdlib \
|
|
|
|
-u call_user_start_cpu0 \
|
2016-11-03 06:33:30 +00:00
|
|
|
$(EXTRA_LDFLAGS) \
|
2016-09-09 00:14:38 +00:00
|
|
|
-Wl,--gc-sections \
|
|
|
|
-Wl,-static \
|
|
|
|
-Wl,--start-group \
|
|
|
|
$(COMPONENT_LDFLAGS) \
|
|
|
|
-lgcc \
|
2017-01-04 16:27:59 +00:00
|
|
|
-lstdc++ \
|
2017-08-16 23:36:00 +00:00
|
|
|
-lgcov \
|
2016-09-09 00:14:38 +00:00
|
|
|
-Wl,--end-group \
|
|
|
|
-Wl,-EL
|
|
|
|
|
|
|
|
# Set default CPPFLAGS, CFLAGS, CXXFLAGS
|
|
|
|
# These are exported so that components can use them when compiling.
|
|
|
|
# If you need your component to add CFLAGS/etc for it's own source compilation only, set CFLAGS += in your component's Makefile.
|
|
|
|
# If you need your component to add CFLAGS/etc globally for all source
|
2016-10-20 09:17:54 +00:00
|
|
|
# files, set CFLAGS += in your component's Makefile.projbuild
|
|
|
|
# If you need to set CFLAGS/CPPFLAGS/CXXFLAGS at project level, set them in application Makefile
|
|
|
|
# before including project.mk. Default flags will be added before the ones provided in application Makefile.
|
2016-09-09 00:14:38 +00:00
|
|
|
|
2016-10-17 04:38:17 +00:00
|
|
|
# CPPFLAGS used by C preprocessor
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
# If any flags are defined in application Makefile, add them at the end.
|
2016-12-03 22:11:22 +00:00
|
|
|
CPPFLAGS ?=
|
|
|
|
EXTRA_CPPFLAGS ?=
|
2017-01-10 16:24:50 +00:00
|
|
|
CPPFLAGS := -DESP_PLATFORM -D IDF_VER=\"$(IDF_VER)\" -MMD -MP $(CPPFLAGS) $(EXTRA_CPPFLAGS)
|
2018-10-05 12:29:07 +00:00
|
|
|
PROJECT_VER ?=
|
|
|
|
export IDF_VER
|
|
|
|
export PROJECT_NAME
|
|
|
|
export PROJECT_VER
|
2016-10-17 04:38:17 +00:00
|
|
|
|
|
|
|
# Warnings-related flags relevant both for C and C++
|
2016-11-16 04:42:38 +00:00
|
|
|
COMMON_WARNING_FLAGS = -Wall -Werror=all \
|
2016-10-17 04:38:17 +00:00
|
|
|
-Wno-error=unused-function \
|
|
|
|
-Wno-error=unused-but-set-variable \
|
2016-11-08 09:34:46 +00:00
|
|
|
-Wno-error=unused-variable \
|
2016-11-16 04:42:38 +00:00
|
|
|
-Wno-error=deprecated-declarations \
|
|
|
|
-Wextra \
|
|
|
|
-Wno-unused-parameter -Wno-sign-compare
|
2016-10-17 04:38:17 +00:00
|
|
|
|
2019-04-24 13:02:25 +00:00
|
|
|
ifdef CONFIG_COMPILER_DISABLE_GCC8_WARNINGS
|
2018-08-27 03:03:15 +00:00
|
|
|
COMMON_WARNING_FLAGS += -Wno-parentheses \
|
|
|
|
-Wno-sizeof-pointer-memaccess \
|
|
|
|
-Wno-clobbered \
|
|
|
|
-Wno-format-overflow \
|
|
|
|
-Wno-stringop-truncation \
|
|
|
|
-Wno-misleading-indentation \
|
|
|
|
-Wno-cast-function-type \
|
|
|
|
-Wno-implicit-fallthrough \
|
|
|
|
-Wno-unused-const-variable \
|
|
|
|
-Wno-switch-unreachable \
|
|
|
|
-Wno-format-truncation \
|
|
|
|
-Wno-memset-elt-size \
|
|
|
|
-Wno-int-in-bool-context
|
|
|
|
endif
|
|
|
|
|
2019-04-24 13:02:25 +00:00
|
|
|
ifdef CONFIG_COMPILER_WARN_WRITE_STRINGS
|
2018-04-06 14:04:13 +00:00
|
|
|
COMMON_WARNING_FLAGS += -Wwrite-strings
|
2019-04-24 13:02:25 +00:00
|
|
|
endif #CONFIG_COMPILER_WARN_WRITE_STRINGS
|
2018-04-06 14:04:13 +00:00
|
|
|
|
2016-10-17 04:38:17 +00:00
|
|
|
# Flags which control code generation and dependency generation, both for C and C++
|
|
|
|
COMMON_FLAGS = \
|
2019-04-09 03:14:31 +00:00
|
|
|
-Wno-frame-address \
|
2016-10-17 04:38:17 +00:00
|
|
|
-ffunction-sections -fdata-sections \
|
|
|
|
-fstrict-volatile-bitfields \
|
|
|
|
-mlongcalls \
|
2016-12-11 23:02:41 +00:00
|
|
|
-nostdlib
|
2016-10-17 04:38:17 +00:00
|
|
|
|
2017-11-15 08:09:54 +00:00
|
|
|
ifndef IS_BOOTLOADER_BUILD
|
|
|
|
# stack protection (only one option can be selected in menuconfig)
|
2019-04-24 13:02:25 +00:00
|
|
|
ifdef CONFIG_COMPILER_STACK_CHECK_MODE_NORM
|
2017-11-15 08:09:54 +00:00
|
|
|
COMMON_FLAGS += -fstack-protector
|
|
|
|
endif
|
2019-04-24 13:02:25 +00:00
|
|
|
ifdef CONFIG_COMPILER_STACK_CHECK_MODE_STRONG
|
2017-11-15 08:09:54 +00:00
|
|
|
COMMON_FLAGS += -fstack-protector-strong
|
|
|
|
endif
|
2019-04-24 13:02:25 +00:00
|
|
|
ifdef CONFIG_COMPILER_STACK_CHECK_MODE_ALL
|
2017-11-15 08:09:54 +00:00
|
|
|
COMMON_FLAGS += -fstack-protector-all
|
|
|
|
endif
|
|
|
|
|
2016-10-17 04:38:17 +00:00
|
|
|
# Optimization flags are set based on menuconfig choice
|
2019-09-03 05:12:58 +00:00
|
|
|
ifdef CONFIG_COMPILER_OPTIMIZATION_SIZE
|
2019-07-04 07:02:20 +00:00
|
|
|
OPTIMIZATION_FLAGS = -Os -freorder-blocks
|
2019-09-03 05:12:58 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CONFIG_COMPILER_OPTIMIZATION_DEFAULT
|
2016-10-20 08:10:51 +00:00
|
|
|
OPTIMIZATION_FLAGS = -Og
|
2016-10-17 04:38:17 +00:00
|
|
|
endif
|
2016-09-09 00:14:38 +00:00
|
|
|
|
2019-09-03 05:12:58 +00:00
|
|
|
ifdef CONFIG_COMPILER_OPTIMIZATION_NONE
|
|
|
|
OPTIMIZATION_FLAGS = -O0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CONFIG_COMPILER_OPTIMIZATION_PERF
|
|
|
|
OPTIMIZATION_FLAGS = -O2
|
|
|
|
endif
|
|
|
|
|
2019-04-24 13:02:25 +00:00
|
|
|
ifdef CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE
|
2017-06-19 01:25:45 +00:00
|
|
|
CPPFLAGS += -DNDEBUG
|
|
|
|
endif
|
|
|
|
|
2020-02-26 03:19:32 +00:00
|
|
|
else # IS_BOOTLOADER_BUILD
|
|
|
|
|
|
|
|
ifdef CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE
|
|
|
|
OPTIMIZATION_FLAGS = -Os -freorder-blocks
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG
|
|
|
|
OPTIMIZATION_FLAGS = -Og
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE
|
|
|
|
OPTIMIZATION_FLAGS = -O0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF
|
|
|
|
OPTIMIZATION_FLAGS = -O2
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif # IS_BOOTLOADER_BUILD
|
|
|
|
|
|
|
|
|
2019-04-15 04:34:43 +00:00
|
|
|
# IDF uses some GNU extension from libc
|
|
|
|
CPPFLAGS += -D_GNU_SOURCE
|
|
|
|
|
2016-10-17 05:47:13 +00:00
|
|
|
# Enable generation of debugging symbols
|
2017-03-21 08:46:48 +00:00
|
|
|
# (we generate even in Release mode, as this has no impact on final binary size.)
|
|
|
|
DEBUG_FLAGS ?= -ggdb
|
2016-10-17 05:47:13 +00:00
|
|
|
|
2016-10-17 04:38:17 +00:00
|
|
|
# List of flags to pass to C compiler
|
2016-10-20 09:17:54 +00:00
|
|
|
# If any flags are defined in application Makefile, add them at the end.
|
2016-12-03 22:11:22 +00:00
|
|
|
CFLAGS ?=
|
|
|
|
EXTRA_CFLAGS ?=
|
2016-10-20 09:17:54 +00:00
|
|
|
CFLAGS := $(strip \
|
|
|
|
-std=gnu99 \
|
2017-03-21 08:46:48 +00:00
|
|
|
$(OPTIMIZATION_FLAGS) $(DEBUG_FLAGS) \
|
2016-10-20 09:17:54 +00:00
|
|
|
$(COMMON_FLAGS) \
|
2016-11-16 04:42:38 +00:00
|
|
|
$(COMMON_WARNING_FLAGS) -Wno-old-style-declaration \
|
|
|
|
$(CFLAGS) \
|
|
|
|
$(EXTRA_CFLAGS))
|
2016-09-09 00:14:38 +00:00
|
|
|
|
2016-10-17 04:38:17 +00:00
|
|
|
# List of flags to pass to C++ compiler
|
2016-10-20 09:17:54 +00:00
|
|
|
# If any flags are defined in application Makefile, add them at the end.
|
2016-12-03 22:11:22 +00:00
|
|
|
CXXFLAGS ?=
|
|
|
|
EXTRA_CXXFLAGS ?=
|
2016-10-20 09:17:54 +00:00
|
|
|
CXXFLAGS := $(strip \
|
|
|
|
-std=gnu++11 \
|
2017-03-21 08:46:48 +00:00
|
|
|
$(OPTIMIZATION_FLAGS) $(DEBUG_FLAGS) \
|
2016-10-20 09:17:54 +00:00
|
|
|
$(COMMON_FLAGS) \
|
|
|
|
$(COMMON_WARNING_FLAGS) \
|
2016-11-16 04:42:38 +00:00
|
|
|
$(CXXFLAGS) \
|
|
|
|
$(EXTRA_CXXFLAGS))
|
2016-09-09 00:14:38 +00:00
|
|
|
|
2019-04-24 13:02:25 +00:00
|
|
|
ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
|
2017-10-04 06:29:21 +00:00
|
|
|
CXXFLAGS += -fexceptions
|
|
|
|
else
|
|
|
|
CXXFLAGS += -fno-exceptions
|
|
|
|
endif
|
|
|
|
|
2019-10-31 03:15:54 +00:00
|
|
|
ifdef CONFIG_COMPILER_CXX_RTTI
|
|
|
|
CXXFLAGS += -frtti
|
|
|
|
else
|
|
|
|
CXXFLAGS += -fno-rtti
|
|
|
|
LDFLAGS += -fno-rtti
|
|
|
|
endif
|
|
|
|
|
2018-06-21 08:51:44 +00:00
|
|
|
ARFLAGS := cru
|
|
|
|
|
|
|
|
export CFLAGS CPPFLAGS CXXFLAGS ARFLAGS
|
2016-09-09 00:14:38 +00:00
|
|
|
|
2016-11-10 02:20:55 +00:00
|
|
|
# Set target compiler. Defaults to whatever the user has
|
|
|
|
# configured as prefix + ye olde gcc commands
|
2019-03-14 08:54:04 +00:00
|
|
|
CC := $(call dequote,$(CONFIG_SDK_TOOLPREFIX))gcc
|
|
|
|
CXX := $(call dequote,$(CONFIG_SDK_TOOLPREFIX))c++
|
|
|
|
LD := $(call dequote,$(CONFIG_SDK_TOOLPREFIX))ld
|
|
|
|
AR := $(call dequote,$(CONFIG_SDK_TOOLPREFIX))ar
|
|
|
|
OBJCOPY := $(call dequote,$(CONFIG_SDK_TOOLPREFIX))objcopy
|
|
|
|
OBJDUMP := $(call dequote,$(CONFIG_SDK_TOOLPREFIX))objdump
|
|
|
|
SIZE := $(call dequote,$(CONFIG_SDK_TOOLPREFIX))size
|
2018-04-18 02:57:45 +00:00
|
|
|
export CC CXX LD AR OBJCOPY OBJDUMP SIZE
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2018-08-30 03:24:34 +00:00
|
|
|
COMPILER_VERSION_STR := $(shell $(CC) -dumpversion)
|
|
|
|
COMPILER_VERSION_NUM := $(subst .,,$(COMPILER_VERSION_STR))
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-08-18 09:11:27 +00:00
|
|
|
# the app is the main executable built by the project
|
|
|
|
APP_ELF:=$(BUILD_DIR_BASE)/$(PROJECT_NAME).elf
|
|
|
|
APP_MAP:=$(APP_ELF:.elf=.map)
|
|
|
|
APP_BIN:=$(APP_ELF:.elf=.bin)
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2018-04-18 02:57:45 +00:00
|
|
|
# include linker script generation utils makefile
|
|
|
|
include $(IDF_PATH)/make/ldgen.mk
|
|
|
|
|
|
|
|
$(eval $(call ldgen_create_commands))
|
|
|
|
|
2016-08-17 15:08:22 +00:00
|
|
|
# Include any Makefile.projbuild file letting components add
|
|
|
|
# configuration at the project level
|
|
|
|
define includeProjBuildMakefile
|
2019-06-24 10:59:32 +00:00
|
|
|
ifeq ("$(V)","1")
|
|
|
|
$$(info including $(1)/Makefile.projbuild...)
|
|
|
|
endif
|
2016-08-17 15:08:22 +00:00
|
|
|
COMPONENT_PATH := $(1)
|
2017-06-23 04:08:01 +00:00
|
|
|
include $(1)/Makefile.projbuild
|
2016-08-17 15:08:22 +00:00
|
|
|
endef
|
2017-06-23 04:08:01 +00:00
|
|
|
$(foreach componentpath,$(COMPONENT_PATHS), \
|
|
|
|
$(if $(wildcard $(componentpath)/Makefile.projbuild), \
|
|
|
|
$(eval $(call includeProjBuildMakefile,$(componentpath)))))
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-08-24 05:02:51 +00:00
|
|
|
# ELF depends on the library archive files for COMPONENT_LIBRARIES
|
|
|
|
# the rules to build these are emitted as part of GenerateComponentTarget below
|
2016-12-12 04:54:30 +00:00
|
|
|
#
|
|
|
|
# also depends on additional dependencies (linker scripts & binary libraries)
|
|
|
|
# stored in COMPONENT_LINKER_DEPS, built via component.mk files' COMPONENT_ADD_LINKER_DEPS variable
|
2016-12-03 22:11:22 +00:00
|
|
|
COMPONENT_LINKER_DEPS ?=
|
2017-06-23 04:08:01 +00:00
|
|
|
$(APP_ELF): $(foreach libcomp,$(COMPONENT_LIBRARIES),$(BUILD_DIR_BASE)/$(libcomp)/lib$(libcomp).a) $(COMPONENT_LINKER_DEPS) $(COMPONENT_PROJECT_VARS)
|
2017-08-03 11:27:43 +00:00
|
|
|
$(summary) LD $(patsubst $(PWD)/%,%,$@)
|
2016-11-11 01:29:38 +00:00
|
|
|
$(CC) $(LDFLAGS) -o $@ -Wl,-Map=$(APP_MAP)
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2020-02-24 19:51:41 +00:00
|
|
|
ifdef CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME
|
|
|
|
SECURE_APPS_SIGNING_SCHEME = "1"
|
|
|
|
else ifdef CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME
|
|
|
|
SECURE_APPS_SIGNING_SCHEME = "2"
|
|
|
|
endif
|
|
|
|
|
2018-04-19 04:42:26 +00:00
|
|
|
app: $(APP_BIN) partition_table_get_info
|
2019-07-22 14:04:03 +00:00
|
|
|
ifeq ("$(CONFIG_APP_BUILD_GENERATE_BINARIES)","y")
|
2020-02-24 19:51:41 +00:00
|
|
|
ifeq ("$(CONFIG_SECURE_BOOT)$(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)","y") # secure boot enabled, but remote sign app image
|
2016-12-19 02:06:21 +00:00
|
|
|
@echo "App built but not signed. Signing step via espsecure.py:"
|
2020-02-24 19:51:41 +00:00
|
|
|
@echo "espsecure.py sign_data --version $(SECURE_APPS_SIGNING_SCHEME) --keyfile KEYFILE $(APP_BIN)"
|
2016-12-19 02:06:21 +00:00
|
|
|
@echo "Then flash app command is:"
|
2018-04-19 04:42:26 +00:00
|
|
|
@echo $(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN)
|
2016-12-19 02:06:21 +00:00
|
|
|
else
|
2016-08-17 15:08:22 +00:00
|
|
|
@echo "App built. Default flash app command is:"
|
2018-04-19 04:42:26 +00:00
|
|
|
@echo $(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN)
|
2016-12-19 02:06:21 +00:00
|
|
|
endif
|
2019-07-22 14:04:03 +00:00
|
|
|
else
|
|
|
|
@echo "Application in not built and cannot be flashed."
|
|
|
|
endif
|
2016-08-18 09:11:27 +00:00
|
|
|
|
|
|
|
all_binaries: $(APP_BIN)
|
2016-08-17 15:08:22 +00:00
|
|
|
|
|
|
|
$(BUILD_DIR_BASE):
|
|
|
|
mkdir -p $(BUILD_DIR_BASE)
|
|
|
|
|
2016-11-09 06:25:57 +00:00
|
|
|
# Macro for the recursive sub-make for each component
|
|
|
|
# $(1) - component directory
|
|
|
|
# $(2) - component name only
|
|
|
|
#
|
|
|
|
# Is recursively expanded by the GenerateComponentTargets macro
|
|
|
|
define ComponentMake
|
2016-11-17 08:36:10 +00:00
|
|
|
+$(MAKE) -C $(BUILD_DIR_BASE)/$(2) -f $(IDF_PATH)/make/component_wrapper.mk COMPONENT_MAKEFILE=$(1)/component.mk COMPONENT_NAME=$(2)
|
2016-08-17 15:08:22 +00:00
|
|
|
endef
|
|
|
|
|
2016-11-10 02:20:55 +00:00
|
|
|
# Generate top-level component-specific targets for each component
|
2016-08-17 15:08:22 +00:00
|
|
|
# $(1) - path to component dir
|
2016-11-09 01:51:55 +00:00
|
|
|
# $(2) - name of component
|
2016-11-10 02:20:55 +00:00
|
|
|
#
|
|
|
|
define GenerateComponentTargets
|
2017-06-23 04:08:01 +00:00
|
|
|
.PHONY: component-$(2)-build component-$(2)-clean
|
2016-11-09 06:25:57 +00:00
|
|
|
|
2017-09-01 07:28:13 +00:00
|
|
|
component-$(2)-build: check-submodules $(call prereq_if_explicit, component-$(2)-clean) | $(BUILD_DIR_BASE)/$(2)
|
2016-11-09 06:25:57 +00:00
|
|
|
$(call ComponentMake,$(1),$(2)) build
|
|
|
|
|
2017-09-01 07:28:13 +00:00
|
|
|
component-$(2)-clean: | $(BUILD_DIR_BASE)/$(2) $(BUILD_DIR_BASE)/$(2)/component_project_vars.mk
|
2016-11-09 06:25:57 +00:00
|
|
|
$(call ComponentMake,$(1),$(2)) clean
|
|
|
|
|
2016-11-09 01:51:55 +00:00
|
|
|
$(BUILD_DIR_BASE)/$(2):
|
|
|
|
@mkdir -p $(BUILD_DIR_BASE)/$(2)
|
2016-08-24 05:02:51 +00:00
|
|
|
|
2016-11-09 06:25:57 +00:00
|
|
|
# tell make it can build any component's library by invoking the -build target
|
2016-08-24 05:02:51 +00:00
|
|
|
# (this target exists for all components even ones which don't build libraries, but it's
|
|
|
|
# only invoked for the targets whose libraries appear in COMPONENT_LIBRARIES and hence the
|
|
|
|
# APP_ELF dependencies.)
|
2017-06-23 04:08:01 +00:00
|
|
|
$(BUILD_DIR_BASE)/$(2)/lib$(2).a: component-$(2)-build
|
2016-08-31 23:19:06 +00:00
|
|
|
$(details) "Target '$$^' responsible for '$$@'" # echo which build target built this file
|
2016-11-09 06:25:57 +00:00
|
|
|
|
2016-11-10 02:20:55 +00:00
|
|
|
# add a target to generate the component_project_vars.mk files that
|
|
|
|
# are used to inject variables into project make pass (see matching
|
|
|
|
# component_project_vars.mk target in component_wrapper.mk).
|
|
|
|
#
|
|
|
|
# If any component_project_vars.mk file is out of date, the make
|
|
|
|
# process will call this target to rebuild it and then restart.
|
|
|
|
#
|
2017-02-03 05:02:22 +00:00
|
|
|
$(BUILD_DIR_BASE)/$(2)/component_project_vars.mk: $(1)/component.mk $(COMMON_MAKEFILES) $(SDKCONFIG_MAKEFILE) | $(BUILD_DIR_BASE)/$(2)
|
2016-11-09 06:25:57 +00:00
|
|
|
$(call ComponentMake,$(1),$(2)) component_project_vars.mk
|
2016-08-17 15:08:22 +00:00
|
|
|
endef
|
|
|
|
|
2017-06-23 04:08:01 +00:00
|
|
|
$(foreach component,$(COMPONENT_PATHS),$(eval $(call GenerateComponentTargets,$(component),$(notdir $(component)))))
|
2016-11-17 08:36:10 +00:00
|
|
|
$(foreach component,$(TEST_COMPONENT_PATHS),$(eval $(call GenerateComponentTargets,$(component),$(lastword $(subst /, ,$(dir $(component))))_test)))
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2017-06-23 04:08:01 +00:00
|
|
|
app-clean: $(addprefix component-,$(addsuffix -clean,$(notdir $(COMPONENT_PATHS))))
|
2016-08-24 05:02:24 +00:00
|
|
|
$(summary) RM $(APP_ELF)
|
2016-11-11 01:29:38 +00:00
|
|
|
rm -f $(APP_ELF) $(APP_BIN) $(APP_MAP)
|
2016-12-16 00:30:37 +00:00
|
|
|
|
2018-09-03 09:42:10 +00:00
|
|
|
size: $(APP_ELF) | check_python_dependencies
|
2017-06-15 02:18:48 +00:00
|
|
|
$(PYTHON) $(IDF_PATH)/tools/idf_size.py $(APP_MAP)
|
|
|
|
|
2018-09-03 09:42:10 +00:00
|
|
|
size-files: $(APP_ELF) | check_python_dependencies
|
2017-06-15 02:18:48 +00:00
|
|
|
$(PYTHON) $(IDF_PATH)/tools/idf_size.py --files $(APP_MAP)
|
|
|
|
|
2018-09-03 09:42:10 +00:00
|
|
|
size-components: $(APP_ELF) | check_python_dependencies
|
2017-06-15 02:18:48 +00:00
|
|
|
$(PYTHON) $(IDF_PATH)/tools/idf_size.py --archives $(APP_MAP)
|
2016-08-18 09:11:27 +00:00
|
|
|
|
2018-09-03 09:42:10 +00:00
|
|
|
size-symbols: $(APP_ELF) | check_python_dependencies
|
2018-02-19 11:54:12 +00:00
|
|
|
ifndef COMPONENT
|
|
|
|
$(error "ERROR: Please enter the component to look symbols for, e.g. COMPONENT=heap")
|
|
|
|
else
|
|
|
|
$(PYTHON) $(IDF_PATH)/tools/idf_size.py --archive_details lib$(COMPONENT).a $(APP_MAP)
|
|
|
|
endif
|
|
|
|
|
2017-09-04 03:17:32 +00:00
|
|
|
# NB: this ordering is deliberate (app-clean & bootloader-clean before
|
|
|
|
# _config-clean), so config remains valid during all component clean
|
|
|
|
# targets
|
|
|
|
config-clean: app-clean bootloader-clean
|
2018-04-18 02:57:45 +00:00
|
|
|
clean: app-clean bootloader-clean config-clean ldgen-clean
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-11-16 00:12:48 +00:00
|
|
|
# phony target to check if any git submodule listed in COMPONENT_SUBMODULES are missing
|
|
|
|
# or out of date, and exit if so. Components can add paths to this variable.
|
|
|
|
#
|
|
|
|
# This only works for components inside IDF_PATH
|
2019-12-19 12:21:41 +00:00
|
|
|
#
|
|
|
|
# For internal use:
|
|
|
|
# IDF_SKIP_CHECK_SUBMODULES may be set in the environment to skip the submodule check.
|
|
|
|
# This can be used e.g. in CI when submodules are checked out by different means.
|
|
|
|
IDF_SKIP_CHECK_SUBMODULES ?= 0
|
|
|
|
|
2016-11-16 00:12:48 +00:00
|
|
|
check-submodules:
|
2019-11-30 05:36:31 +00:00
|
|
|
ifeq ($(IDF_SKIP_CHECK_SUBMODULES),1)
|
|
|
|
@echo "skip submodule check on internal CI"
|
|
|
|
else
|
2018-04-10 03:20:59 +00:00
|
|
|
# Check if .gitmodules exists, otherwise skip submodule check, assuming flattened structure
|
|
|
|
ifneq ("$(wildcard ${IDF_PATH}/.gitmodules)","")
|
2016-11-16 00:12:48 +00:00
|
|
|
|
2017-03-14 10:55:12 +00:00
|
|
|
# Dump the git status for the whole working copy once, then grep it for each submodule. This saves a lot of time on Windows.
|
2017-03-28 06:22:27 +00:00
|
|
|
GIT_STATUS := $(shell cd ${IDF_PATH} && git status --porcelain --ignore-submodules=dirty)
|
2017-03-14 10:55:12 +00:00
|
|
|
|
2016-11-16 00:12:48 +00:00
|
|
|
# Generate a target to check this submodule
|
|
|
|
# $(1) - submodule directory, relative to IDF_PATH
|
|
|
|
define GenerateSubmoduleCheckTarget
|
|
|
|
check-submodules: $(IDF_PATH)/$(1)/.git
|
|
|
|
$(IDF_PATH)/$(1)/.git:
|
|
|
|
@echo "WARNING: Missing submodule $(1)..."
|
2018-12-05 13:00:36 +00:00
|
|
|
[ -e ${IDF_PATH}/.git ] || { echo "ERROR: esp-idf must be cloned from git to work."; exit 1; }
|
|
|
|
[ -x "$(shell which git)" ] || { echo "ERROR: Need to run 'git submodule init $(1)' in esp-idf root directory."; exit 1; }
|
2016-11-16 00:12:48 +00:00
|
|
|
@echo "Attempting 'git submodule update --init $(1)' in esp-idf root directory..."
|
|
|
|
cd ${IDF_PATH} && git submodule update --init $(1)
|
|
|
|
|
2017-03-14 10:55:12 +00:00
|
|
|
# Parse 'git status' output to check if the submodule commit is different to expected
|
|
|
|
ifneq ("$(filter $(1),$(GIT_STATUS))","")
|
2016-12-12 04:08:57 +00:00
|
|
|
$$(info WARNING: esp-idf git submodule $(1) may be out of date. Run 'git submodule update' in IDF_PATH dir to update.)
|
2016-11-16 00:12:48 +00:00
|
|
|
endif
|
|
|
|
endef
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-11-16 00:12:48 +00:00
|
|
|
# filter/subst in expression ensures all submodule paths begin with $(IDF_PATH), and then strips that prefix
|
|
|
|
# so the argument is suitable for use with 'git submodule' commands
|
|
|
|
$(foreach submodule,$(subst $(IDF_PATH)/,,$(filter $(IDF_PATH)/%,$(COMPONENT_SUBMODULES))),$(eval $(call GenerateSubmoduleCheckTarget,$(submodule))))
|
2018-04-10 03:20:59 +00:00
|
|
|
endif # End check for .gitmodules existence
|
2019-12-19 12:21:41 +00:00
|
|
|
endif # End check for IDF_SKIP_CHECK_SUBMODULES
|
2016-12-04 07:02:02 +00:00
|
|
|
|
2017-06-21 05:09:24 +00:00
|
|
|
# PHONY target to list components in the build and their paths
|
|
|
|
list-components:
|
2017-06-23 04:08:01 +00:00
|
|
|
$(info $(call dequote,$(SEPARATOR)))
|
|
|
|
$(info COMPONENT_DIRS (components searched for here))
|
2017-06-21 05:09:24 +00:00
|
|
|
$(foreach cd,$(COMPONENT_DIRS),$(info $(cd)))
|
|
|
|
$(info $(call dequote,$(SEPARATOR)))
|
2018-06-28 09:54:15 +00:00
|
|
|
$(info TEST_COMPONENTS (list of test component names))
|
|
|
|
$(info $(TEST_COMPONENTS_LIST))
|
2017-06-21 05:09:24 +00:00
|
|
|
$(info $(call dequote,$(SEPARATOR)))
|
2018-06-28 09:54:15 +00:00
|
|
|
$(info TEST_EXCLUDE_COMPONENTS (list of test excluded names))
|
make: fix issues related to EXTRA_COMPONENT_DIRS
1. When one of the COMPONENT_DIRS points to a component directory
(i.e. a directory containing component.mk, not a directory of multiple
components), and there is a subdirectory in it which also contains
a component, the subdirectory was mistakenly added to the list of
components and compiled.
For example:
main/
component.mk
main.c
test/
component.mk
test_main.c
Would compile test_main.c and link libtest.a.
2. When one of the COMPONENT_DIRS points to a component directory, and
the parent directory contained a directory with the same name as
another component, that directory would be mistakenly added to the
COMPONENT_PATHS.
For example:
esp/
esp-idf/
esp32/
(random stuff)
mycomponent/
component.mk
mycomponent.c
myproject/
main/
Makefile
and Makefile sets EXTRA_COMPONENT_DIRS=$(realpath ../mycomponent),
then "esp32" directory which is at the same level as mycomponent
was added to COMPONENT_PATHS.
3. If EXTRA_COMPONENT_DIRS pointed to a directory with a list of
components, and one of the subdirectories was not a component, but
had the same name as another component, than that directory would be
mistakenly added to COMPONENT_PATHS instead of the real esp32
component directory.
For example:
my_components/
my_component/
component.mk
my_component.c
esp32/
(some random stuff)
and EXTRA_COMPONENT_DIRS would point to my_components/, then "esp32"
directory would be added to COMPONENT_PATHS instead of the real esp32
component directory.
2019-02-13 03:40:48 +00:00
|
|
|
$(info $(if $(EXCLUDE_COMPONENTS) || $(TEST_EXCLUDE_COMPONENTS),$(EXCLUDE_COMPONENTS) $(TEST_EXCLUDE_COMPONENTS),(none provided)))
|
2018-04-08 17:07:43 +00:00
|
|
|
$(info $(call dequote,$(SEPARATOR)))
|
2017-06-21 05:09:24 +00:00
|
|
|
$(info COMPONENT_PATHS (paths to all components):)
|
|
|
|
$(foreach cp,$(COMPONENT_PATHS),$(info $(cp)))
|
|
|
|
|
2017-10-10 02:51:08 +00:00
|
|
|
# print flash command, so users can dump this to config files and download somewhere without idf
|
2018-06-25 06:53:10 +00:00
|
|
|
print_flash_cmd: partition_table_get_info blank_ota_data
|
2017-10-10 02:51:08 +00:00
|
|
|
echo $(ESPTOOL_WRITE_FLASH_OPTIONS) $(ESPTOOL_ALL_FLASH_ARGS) | sed -e 's:'$(PWD)/build/'::g'
|
|
|
|
|
2016-12-04 07:02:02 +00:00
|
|
|
# Check toolchain version using the output of xtensa-esp32-elf-gcc --version command.
|
|
|
|
# The output normally looks as follows
|
2018-08-27 03:43:34 +00:00
|
|
|
# xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 5.2.0
|
2018-08-30 03:24:34 +00:00
|
|
|
# The part in brackets is extracted into TOOLCHAIN_COMMIT_DESC variable
|
2019-03-14 08:54:04 +00:00
|
|
|
ifdef CONFIG_SDK_TOOLPREFIX
|
2016-12-04 07:02:02 +00:00
|
|
|
ifndef MAKE_RESTARTS
|
2018-08-27 03:43:34 +00:00
|
|
|
|
|
|
|
TOOLCHAIN_HEADER := $(shell $(CC) --version | head -1)
|
|
|
|
TOOLCHAIN_PATH := $(shell which $(CC))
|
2018-08-27 03:04:08 +00:00
|
|
|
TOOLCHAIN_COMMIT_DESC := $(shell $(CC) --version | sed -E -n 's|.*\(crosstool-NG (.*)\).*|\1|gp')
|
2018-08-30 03:24:34 +00:00
|
|
|
TOOLCHAIN_GCC_VER := $(COMPILER_VERSION_STR)
|
2016-12-04 07:02:02 +00:00
|
|
|
|
|
|
|
# Officially supported version(s)
|
2018-08-27 03:04:08 +00:00
|
|
|
include $(IDF_PATH)/tools/toolchain_versions.mk
|
2016-12-04 07:02:02 +00:00
|
|
|
|
2018-08-27 03:43:34 +00:00
|
|
|
ifndef IS_BOOTLOADER_BUILD
|
|
|
|
$(info Toolchain path: $(TOOLCHAIN_PATH))
|
|
|
|
endif
|
|
|
|
|
2017-01-13 02:48:33 +00:00
|
|
|
ifdef TOOLCHAIN_COMMIT_DESC
|
2018-09-25 04:19:01 +00:00
|
|
|
ifeq (,$(findstring $(SUPPORTED_TOOLCHAIN_COMMIT_DESC),$(TOOLCHAIN_COMMIT_DESC)))
|
2016-12-04 07:02:02 +00:00
|
|
|
$(info WARNING: Toolchain version is not supported: $(TOOLCHAIN_COMMIT_DESC))
|
|
|
|
$(info Expected to see version: $(SUPPORTED_TOOLCHAIN_COMMIT_DESC))
|
|
|
|
$(info Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.)
|
2018-08-27 03:43:34 +00:00
|
|
|
else
|
|
|
|
ifndef IS_BOOTLOADER_BUILD
|
|
|
|
$(info Toolchain version: $(TOOLCHAIN_COMMIT_DESC))
|
|
|
|
endif
|
2016-12-04 07:02:02 +00:00
|
|
|
endif
|
|
|
|
ifeq (,$(findstring $(TOOLCHAIN_GCC_VER), $(SUPPORTED_TOOLCHAIN_GCC_VERSIONS)))
|
2017-01-13 02:48:33 +00:00
|
|
|
$(info WARNING: Compiler version is not supported: $(TOOLCHAIN_GCC_VER))
|
2016-12-04 07:02:02 +00:00
|
|
|
$(info Expected to see version(s): $(SUPPORTED_TOOLCHAIN_GCC_VERSIONS))
|
|
|
|
$(info Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.)
|
2018-08-27 03:43:34 +00:00
|
|
|
else
|
|
|
|
ifndef IS_BOOTLOADER_BUILD
|
|
|
|
$(info Compiler version: $(TOOLCHAIN_GCC_VER))
|
|
|
|
endif
|
2016-12-04 07:02:02 +00:00
|
|
|
endif
|
2017-01-13 02:48:33 +00:00
|
|
|
else
|
|
|
|
$(info WARNING: Failed to find Xtensa toolchain, may need to alter PATH or set one in the configuration menu)
|
|
|
|
endif # TOOLCHAIN_COMMIT_DESC
|
2016-12-04 07:02:02 +00:00
|
|
|
|
2017-01-13 03:09:01 +00:00
|
|
|
endif #MAKE_RESTARTS
|
2019-03-14 08:54:04 +00:00
|
|
|
endif #CONFIG_SDK_TOOLPREFIX
|
2019-03-13 11:03:41 +00:00
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
endif #CONFIG_IDF_TARGET
|