mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
build system: Don't build an sdkconfig for bootloader, share the top-level one
This works because all CONFIG variables are exported into child make processes.
This commit is contained in:
parent
830e5caf4d
commit
155f912433
@ -13,21 +13,18 @@ ifndef IS_BOOTLOADER_BUILD
|
||||
BOOTLOADER_COMPONENT_PATH := $(COMPONENT_PATH)
|
||||
BOOTLOADER_BUILD_DIR=$(abspath $(BUILD_DIR_BASE)/bootloader)
|
||||
BOOTLOADER_BIN=$(BOOTLOADER_BUILD_DIR)/bootloader.bin
|
||||
BOOTLOADER_SDKCONFIG=$(BOOTLOADER_BUILD_DIR)/sdkconfig
|
||||
|
||||
# Custom recursive make for bootloader sub-project
|
||||
BOOTLOADER_MAKE=+$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src \
|
||||
V=$(V) SDKCONFIG=$(BOOTLOADER_SDKCONFIG) \
|
||||
BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
|
||||
V=$(V) BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
|
||||
|
||||
.PHONY: bootloader-clean bootloader-flash bootloader $(BOOTLOADER_BIN)
|
||||
|
||||
$(BOOTLOADER_BIN): | $(BOOTLOADER_BUILD_DIR)/sdkconfig
|
||||
$(BOOTLOADER_BIN):
|
||||
$(Q) $(BOOTLOADER_MAKE) $@
|
||||
|
||||
bootloader-clean:
|
||||
$(Q) $(BOOTLOADER_MAKE) app-clean config-clean
|
||||
$(Q) rm -f $(BOOTLOADER_SDKCONFIG) $(BOOTLOADER_SDKCONFIG).old
|
||||
$(Q) $(BOOTLOADER_MAKE) app-clean
|
||||
|
||||
clean: bootloader-clean
|
||||
|
||||
@ -43,15 +40,10 @@ ESPTOOL_ALL_FLASH_ARGS += 0x1000 $(BOOTLOADER_BIN)
|
||||
bootloader-flash: $(BOOTLOADER_BIN)
|
||||
$(ESPTOOLPY_WRITE_FLASH) 0x1000 $^
|
||||
|
||||
# synchronise the project level config to the bootloader's
|
||||
# config
|
||||
$(BOOTLOADER_SDKCONFIG): $(PROJECT_PATH)/sdkconfig | $(BOOTLOADER_BUILD_DIR)
|
||||
$(Q) cp $< $@
|
||||
|
||||
$(BOOTLOADER_BUILD_DIR):
|
||||
$(Q) mkdir -p $@
|
||||
|
||||
else
|
||||
CFLAGS += -D BOOTLOADER_BUILD=1 -I $(IDF_PATH)/components/esp32/include
|
||||
CFLAGS += -D BOOTLOADER_BUILD=1 -I $(IDF_PATH)/components/esp32/include
|
||||
|
||||
endif
|
||||
|
@ -4,6 +4,9 @@
|
||||
#
|
||||
|
||||
PROJECT_NAME := bootloader
|
||||
|
||||
#We cannot include the esp32 component directly but we need its includes.
|
||||
#This is fixed by adding CFLAGS from Makefile.projbuild
|
||||
COMPONENTS := esptool_py bootloader log spi_flash
|
||||
|
||||
# The bootloader pseudo-component is also included in this build, for its Kconfig.projbuild to be included.
|
||||
@ -12,7 +15,7 @@ COMPONENTS := esptool_py bootloader log spi_flash
|
||||
IS_BOOTLOADER_BUILD := 1
|
||||
export IS_BOOTLOADER_BUILD
|
||||
|
||||
#We cannot include the esp32 component directly but we need its includes.
|
||||
#This is fixed by adding CFLAGS from Makefile.projbuild
|
||||
# include the top-level "project" include directory, for sdkconfig.h
|
||||
CFLAGS += -I$(BUILD_DIR_BASE)/../include
|
||||
|
||||
include $(IDF_PATH)/make/project.mk
|
||||
|
@ -66,7 +66,7 @@ COMPONENT_INCLUDES := $(OWN_INCLUDES) $(filter-out $(OWN_INCLUDES),$(COMPONENT_I
|
||||
# project.mk evaluates dependencies before calling down to here. See
|
||||
# GenerateProjectVarsTarget in project.mk.
|
||||
component_project_vars.mk::
|
||||
$(details) "Rebuilding component project variables list $(abspath $@)"
|
||||
$(details) "Building component project variables list $(abspath $@)"
|
||||
@echo "# Automatically generated build file. Do not edit." > $@
|
||||
@echo "COMPONENT_INCLUDES += $(addprefix $(COMPONENT_PATH)/,$(COMPONENT_ADD_INCLUDEDIRS))" >> $@
|
||||
@echo "COMPONENT_LDFLAGS += $(COMPONENT_ADD_LDFLAGS)" >> $@
|
||||
|
@ -56,13 +56,17 @@ export COMMON_MAKEFILES
|
||||
BUILD_DIR_BASE ?= $(PROJECT_PATH)/build
|
||||
export BUILD_DIR_BASE
|
||||
|
||||
ifndef IS_BOOTLOADER_BUILD
|
||||
# Include project config file, if it exists.
|
||||
# (bootloader build doesn't need this, config is exported from top-level)
|
||||
#
|
||||
# (Note that we only rebuild auto.conf automatically for some targets,
|
||||
# see project_config.mk for details.)
|
||||
#
|
||||
SDKCONFIG_MAKEFILE := $(BUILD_DIR_BASE)/include/config/auto.conf
|
||||
-include $(SDKCONFIG_MAKEFILE)
|
||||
export $(filter CONFIG_%,$(.VARIABLES))
|
||||
endif
|
||||
|
||||
#Component directories. These directories are searched for components.
|
||||
#The project Makefile can override these component dirs, or define extra component directories.
|
||||
@ -114,7 +118,7 @@ include $(COMPONENT_PROJECT_VARS)
|
||||
#
|
||||
# Rebuilds if component.mk, makefiles or sdkconfig changes.
|
||||
define GenerateProjectVarsTarget
|
||||
$(BUILD_DIR_BASE)/$(2)/component_project_vars.mk: $(1)/component.mk $(COMMON_MAKEFILES) $(if $(MAKE_RESTARTS),,$(SDKCONFIG_MAKEFILE)) $(BUILD_DIR_BASE)/$(2)
|
||||
$(BUILD_DIR_BASE)/$(2)/component_project_vars.mk: $(1)/component.mk $(COMMON_MAKEFILES) $(SDKCONFIG) | $(BUILD_DIR_BASE)/$(2)
|
||||
$(Q) +$(MAKE) -C $(BUILD_DIR_BASE)/$(2) -f $(1)/component.mk component_project_vars.mk COMPONENT_PATH=$(1)
|
||||
endef
|
||||
$(foreach comp,$(COMPONENT_PATHS_BUILDABLE), $(eval $(call GenerateProjectVarsTarget,$(comp),$(notdir $(comp)))))
|
||||
@ -238,8 +242,12 @@ COMPONENT_PATH := $(1)
|
||||
endef
|
||||
$(foreach componentpath,$(COMPONENT_PATHS),$(eval $(call includeProjBuildMakefile,$(componentpath))))
|
||||
|
||||
ifndef IS_BOOTLOADER_BUILD
|
||||
# once we know component paths, we can include the config generation targets
|
||||
#
|
||||
# (bootloader build doesn't need this, config is exported from top-level)
|
||||
include $(IDF_PATH)/make/project_config.mk
|
||||
endif
|
||||
|
||||
# A "component" library is any library in the LDFLAGS where
|
||||
# the name of the library is also a name of the component
|
||||
|
Loading…
Reference in New Issue
Block a user