mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
parent
9c0cd10d48
commit
66882347e8
@ -14,17 +14,18 @@ BOOTLOADER_COMPONENT_PATH := $(COMPONENT_PATH)
|
|||||||
BOOTLOADER_BUILD_DIR=$(BUILD_DIR_BASE)/bootloader
|
BOOTLOADER_BUILD_DIR=$(BUILD_DIR_BASE)/bootloader
|
||||||
BOOTLOADER_BIN=$(BOOTLOADER_BUILD_DIR)/bootloader.bin
|
BOOTLOADER_BIN=$(BOOTLOADER_BUILD_DIR)/bootloader.bin
|
||||||
|
|
||||||
|
# Custom recursive make for bootloader sub-project
|
||||||
|
BOOTLOADER_MAKE=$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src \
|
||||||
|
MAKEFLAGS= V=$(V) \
|
||||||
|
BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
|
||||||
|
|
||||||
.PHONY: bootloader-clean bootloader-flash bootloader $(BOOTLOADER_BIN)
|
.PHONY: bootloader-clean bootloader-flash bootloader $(BOOTLOADER_BIN)
|
||||||
|
|
||||||
$(BOOTLOADER_BIN): $(COMPONENT_PATH)/src/sdkconfig
|
$(BOOTLOADER_BIN): $(COMPONENT_PATH)/src/sdkconfig
|
||||||
$(Q) PROJECT_PATH= \
|
$(Q) $(BOOTLOADER_MAKE) $@
|
||||||
BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
|
|
||||||
$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src MAKEFLAGS= V=$(V) TARGET_BIN_LAYOUT="$(BOOTLOADER_TARGET_BIN_LAYOUT)" $(BOOTLOADER_BIN)
|
|
||||||
|
|
||||||
bootloader-clean:
|
bootloader-clean:
|
||||||
$(Q) PROJECT_PATH= \
|
$(Q) $(BOOTLOADER_MAKE) app-clean
|
||||||
BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
|
|
||||||
$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src app-clean MAKEFLAGS= V=$(V)
|
|
||||||
|
|
||||||
clean: bootloader-clean
|
clean: bootloader-clean
|
||||||
|
|
||||||
@ -43,7 +44,8 @@ $(COMPONENT_PATH)/src/sdkconfig: $(PROJECT_PATH)/sdkconfig
|
|||||||
|
|
||||||
# bootloader-flash calls flash in the bootloader dummy project
|
# bootloader-flash calls flash in the bootloader dummy project
|
||||||
bootloader-flash: $(BOOTLOADER_BIN)
|
bootloader-flash: $(BOOTLOADER_BIN)
|
||||||
$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src flash MAKEFLAGS= V=$(V)
|
$(BOOTLOADER_MAKE) flash
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
CFLAGS += -D BOOTLOADER_BUILD=1 -I $(IDF_PATH)/components/esp32/include
|
CFLAGS += -D BOOTLOADER_BUILD=1 -I $(IDF_PATH)/components/esp32/include
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
|
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
|
||||||
# please read the esp-idf build system document if you need to do this.
|
# please read the esp-idf build system document if you need to do this.
|
||||||
#
|
#
|
||||||
-include $(PROJECT_PATH)/build/include/config/auto.conf
|
-include $(BUILD_DIR_BASE)/include/config/auto.conf
|
||||||
|
|
||||||
COMPONENT_SRCDIRS := . hwcrypto
|
COMPONENT_SRCDIRS := . hwcrypto
|
||||||
|
|
||||||
@ -44,6 +44,8 @@ $(COMPONENT_LIBRARY): $(ALL_LIB_FILES)
|
|||||||
# saves us from having to add the target to a Makefile.projbuild
|
# saves us from having to add the target to a Makefile.projbuild
|
||||||
$(COMPONENT_LIBRARY): esp32_out.ld
|
$(COMPONENT_LIBRARY): esp32_out.ld
|
||||||
|
|
||||||
|
# .. is BUILD_DIR_BASE here, as component makefiles
|
||||||
|
# are evaluated with CWD=component build dir
|
||||||
esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
|
esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
|
||||||
$(CC) -I ../include -C -P -x c -E $< -o $@
|
$(CC) -I ../include -C -P -x c -E $< -o $@
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
# (Note that we only rebuild auto.conf automatically for some targets,
|
# (Note that we only rebuild auto.conf automatically for some targets,
|
||||||
# see project_config.mk for details.)
|
# see project_config.mk for details.)
|
||||||
-include $(PROJECT_PATH)/build/include/config/auto.conf
|
-include $(BUILD_DIR_BASE)/include/config/auto.conf
|
||||||
|
|
||||||
#Handling of V=1/VERBOSE=1 flag
|
#Handling of V=1/VERBOSE=1 flag
|
||||||
#
|
#
|
||||||
|
@ -50,6 +50,7 @@ endif
|
|||||||
#The directory where we put all objects/libraries/binaries. The project Makefile can
|
#The directory where we put all objects/libraries/binaries. The project Makefile can
|
||||||
#configure this if needed.
|
#configure this if needed.
|
||||||
BUILD_DIR_BASE ?= $(PROJECT_PATH)/build
|
BUILD_DIR_BASE ?= $(PROJECT_PATH)/build
|
||||||
|
export BUILD_DIR_BASE
|
||||||
|
|
||||||
#Component directories. These directories are searched for components.
|
#Component directories. These directories are searched for components.
|
||||||
#The project Makefile can override these component dirs, or define extra component directories.
|
#The project Makefile can override these component dirs, or define extra component directories.
|
||||||
@ -105,7 +106,7 @@ COMPONENT_INCLUDES := $(abspath $(foreach comp,$(COMPONENT_PATHS_BUILDABLE),$(ad
|
|||||||
$(call GetVariable,$(comp),COMPONENT_ADD_INCLUDEDIRS))))
|
$(call GetVariable,$(comp),COMPONENT_ADD_INCLUDEDIRS))))
|
||||||
|
|
||||||
#Also add project include path, for sdk includes
|
#Also add project include path, for sdk includes
|
||||||
COMPONENT_INCLUDES += $(PROJECT_PATH)/build/include/
|
COMPONENT_INCLUDES += $(BUILD_DIR_BASE)/include/
|
||||||
export COMPONENT_INCLUDES
|
export COMPONENT_INCLUDES
|
||||||
|
|
||||||
#COMPONENT_LDFLAGS has a list of all flags that are needed to link the components together. It's collected
|
#COMPONENT_LDFLAGS has a list of all flags that are needed to link the components together. It's collected
|
||||||
|
@ -13,13 +13,15 @@ $(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
|
|||||||
CC=$(HOSTCC) LD=$(HOSTLD) \
|
CC=$(HOSTCC) LD=$(HOSTLD) \
|
||||||
$(MAKE) -C $(KCONFIG_TOOL_DIR)
|
$(MAKE) -C $(KCONFIG_TOOL_DIR)
|
||||||
|
|
||||||
menuconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig $(BUILD_DIR_BASE)
|
# use a wrapper environment for where we run Kconfig tools
|
||||||
$(summary) MENUCONFIG
|
KCONFIG_TOOL_ENV=KCONFIG_AUTOHEADER=$(BUILD_DIR_BASE)/include/sdkconfig.h \
|
||||||
$(Q) KCONFIG_AUTOHEADER=$(PROJECT_PATH)/build/include/sdkconfig.h \
|
|
||||||
KCONFIG_CONFIG=$(PROJECT_PATH)/sdkconfig \
|
KCONFIG_CONFIG=$(PROJECT_PATH)/sdkconfig \
|
||||||
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" \
|
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" \
|
||||||
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)"
|
||||||
$(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig
|
|
||||||
|
menuconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig $(BUILD_DIR_BASE)
|
||||||
|
$(summary) MENUCONFIG
|
||||||
|
$(Q) $(KCONFIG_TOOL_ENV) $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig
|
||||||
|
|
||||||
ifeq ("$(wildcard $(PROJECT_PATH)/sdkconfig)","")
|
ifeq ("$(wildcard $(PROJECT_PATH)/sdkconfig)","")
|
||||||
#No sdkconfig found. Need to run menuconfig to make this if we need it.
|
#No sdkconfig found. Need to run menuconfig to make this if we need it.
|
||||||
@ -28,17 +30,13 @@ endif
|
|||||||
|
|
||||||
defconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig $(BUILD_DIR_BASE)
|
defconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig $(BUILD_DIR_BASE)
|
||||||
$(summary) DEFCONFIG
|
$(summary) DEFCONFIG
|
||||||
$(Q) mkdir -p $(PROJECT_PATH)/build/include/config
|
$(Q) mkdir -p $(BUILD_DIR_BASE)/include/config
|
||||||
$(Q) KCONFIG_AUTOHEADER=$(PROJECT_PATH)/build/include/sdkconfig.h \
|
$(Q) $(KCONFIG_TOOL_ENV) $(KCONFIG_TOOL_DIR)/conf --olddefconfig $(IDF_PATH)/Kconfig
|
||||||
KCONFIG_CONFIG=$(PROJECT_PATH)/sdkconfig \
|
|
||||||
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" \
|
|
||||||
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
|
||||||
$(KCONFIG_TOOL_DIR)/conf --olddefconfig $(IDF_PATH)/Kconfig
|
|
||||||
|
|
||||||
# Work out of whether we have to build the Kconfig makefile
|
# Work out of whether we have to build the Kconfig makefile
|
||||||
# (auto.conf), or if we're in a situation where we don't need it
|
# (auto.conf), or if we're in a situation where we don't need it
|
||||||
NON_CONFIG_TARGETS := clean %-clean get_variable help menuconfig defconfig
|
NON_CONFIG_TARGETS := clean %-clean get_variable help menuconfig defconfig
|
||||||
AUTO_CONF_REGEN_TARGET := $(PROJECT_PATH)/build/include/config/auto.conf
|
AUTO_CONF_REGEN_TARGET := $(BUILD_DIR_BASE)/include/config/auto.conf
|
||||||
|
|
||||||
# disable AUTO_CONF_REGEN_TARGET if all targets are non-config targets
|
# disable AUTO_CONF_REGEN_TARGET if all targets are non-config targets
|
||||||
# (and not building default target)
|
# (and not building default target)
|
||||||
@ -46,19 +44,15 @@ ifneq ("$(MAKECMDGOALS)","")
|
|||||||
ifeq ($(filter $(NON_CONFIG_TARGETS), $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
ifeq ($(filter $(NON_CONFIG_TARGETS), $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
||||||
AUTO_CONF_REGEN_TARGET :=
|
AUTO_CONF_REGEN_TARGET :=
|
||||||
# dummy target
|
# dummy target
|
||||||
$(PROJECT_PATH)/build/include/config/auto.conf:
|
$(BUILD_DIR_BASE)/include/config/auto.conf:
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(AUTO_CONF_REGEN_TARGET) $(PROJECT_PATH)/build/include/sdkconfig.h: $(PROJECT_PATH)/sdkconfig $(KCONFIG_TOOL_DIR)/conf $(COMPONENT_KCONFIGS) $(COMPONENT_KCONFIGS_PROJBUILD)
|
$(AUTO_CONF_REGEN_TARGET) $(BUILD_DIR_BASE)/include/sdkconfig.h: $(PROJECT_PATH)/sdkconfig $(KCONFIG_TOOL_DIR)/conf $(COMPONENT_KCONFIGS) $(COMPONENT_KCONFIGS_PROJBUILD)
|
||||||
$(summary) GENCONFIG
|
$(summary) GENCONFIG
|
||||||
$(Q) mkdir -p $(PROJECT_PATH)/build/include/config
|
$(Q) mkdir -p $(BUILD_DIR_BASE)/include/config
|
||||||
$(Q) cd build; KCONFIG_AUTOHEADER="$(PROJECT_PATH)/build/include/sdkconfig.h" \
|
$(Q) cd $(BUILD_DIR_BASE); $(KCONFIG_TOOL_ENV) $(KCONFIG_TOOL_DIR)/conf --silentoldconfig $(IDF_PATH)/Kconfig
|
||||||
KCONFIG_CONFIG=$(PROJECT_PATH)/sdkconfig \
|
$(Q) touch $(AUTO_CONF_REGEN_TARGET) $(BUILD_DIR_BASE)/include/sdkconfig.h
|
||||||
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" \
|
|
||||||
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" \
|
|
||||||
$(KCONFIG_TOOL_DIR)/conf --silentoldconfig $(IDF_PATH)/Kconfig
|
|
||||||
$(Q) touch $(AUTO_CONF_REGEN_TARGET) $(PROJECT_PATH)/build/include/sdkconfig.h
|
|
||||||
# touch to ensure both output files are newer - as 'conf' can also update sdkconfig (a dependency). Without this,
|
# touch to ensure both output files are newer - as 'conf' can also update sdkconfig (a dependency). Without this,
|
||||||
# sometimes you can get an infinite make loop on Windows where sdkconfig always gets regenerated newer
|
# sometimes you can get an infinite make loop on Windows where sdkconfig always gets regenerated newer
|
||||||
# than the target(!)
|
# than the target(!)
|
||||||
@ -68,4 +62,4 @@ clean: config-clean
|
|||||||
config-clean:
|
config-clean:
|
||||||
$(summary RM CONFIG)
|
$(summary RM CONFIG)
|
||||||
$(MAKE) -C $(KCONFIG_TOOL_DIR) clean
|
$(MAKE) -C $(KCONFIG_TOOL_DIR) clean
|
||||||
$(Q) rm -rf $(PROJECT_PATH)/build/include/config $(PROJECT_PATH)/build/include/sdkconfig.h
|
$(Q) rm -rf $(BUILD_DIR_BASE)/include/config $(BUILD_DIR_BASE)/include/sdkconfig.h
|
||||||
|
Loading…
x
Reference in New Issue
Block a user