forked from espressif/esp-idf
Make: Fix make bootloader, make bootloader-flash, cleaning of bootloader
Should resolve TW6610
This commit is contained in:
committed by
Ivan Grokhotkov
parent
bd6ea4393c
commit
45d1baa24b
@@ -11,7 +11,8 @@
|
|||||||
|
|
||||||
BOOTLOADER_COMPONENT_PATH := $(COMPONENT_PATH)
|
BOOTLOADER_COMPONENT_PATH := $(COMPONENT_PATH)
|
||||||
EXTRA_CLEAN_TARGETS += bootloader-clean
|
EXTRA_CLEAN_TARGETS += bootloader-clean
|
||||||
BOOTLOADER_BIN=$(BUILD_DIR_BASE)/bootloader.bin
|
BOOTLOADER_BUILD_DIR=$(BUILD_DIR_BASE)/bootloader
|
||||||
|
BOOTLOADER_BIN=$(BOOTLOADER_BUILD_DIR)/bootloader.bin
|
||||||
|
|
||||||
.PHONY: bootloader-clean bootloader-flash bootloader
|
.PHONY: bootloader-clean bootloader-flash bootloader
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ $(BOOTLOADER_BIN): $(COMPONENT_PATH)/src/sdkconfig
|
|||||||
COMPONENT_INCLUDES= \
|
COMPONENT_INCLUDES= \
|
||||||
LDFLAGS= \
|
LDFLAGS= \
|
||||||
CFLAGS= \
|
CFLAGS= \
|
||||||
BUILD_DIR_BASE=$(BUILD_DIR_BASE)/bootloader \
|
BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
|
||||||
make -C $(BOOTLOADER_COMPONENT_PATH)/src MAKEFLAGS= V=$(V) TARGET_BIN_LAYOUT="$(BOOTLOADER_TARGET_BIN_LAYOUT)"
|
make -C $(BOOTLOADER_COMPONENT_PATH)/src MAKEFLAGS= V=$(V) TARGET_BIN_LAYOUT="$(BOOTLOADER_TARGET_BIN_LAYOUT)"
|
||||||
|
|
||||||
bootloader-clean:
|
bootloader-clean:
|
||||||
@@ -30,10 +31,10 @@ bootloader-clean:
|
|||||||
COMPONENT_INCLUDES= \
|
COMPONENT_INCLUDES= \
|
||||||
LDFLAGS= \
|
LDFLAGS= \
|
||||||
CFLAGS= \
|
CFLAGS= \
|
||||||
BUILD_DIR_BASE=$(BUILD_DIR_BASE)/bootloader \
|
BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
|
||||||
make -C $(BOOTLOADER_COMPONENT_PATH)/src clean MAKEFLAGS= V=$(V)
|
make -C $(BOOTLOADER_COMPONENT_PATH)/src clean MAKEFLAGS= V=$(V)
|
||||||
|
|
||||||
bootloader: $(BUILD_DIR_BASE)/bootloader.bin
|
bootloader: $(BOOTLOADER_BIN)
|
||||||
|
|
||||||
# synchronise the project level config to the component's
|
# synchronise the project level config to the component's
|
||||||
# config
|
# config
|
||||||
@@ -42,4 +43,4 @@ $(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) CONFIG_APP_OFFSET=0x1000
|
make -C $(BOOTLOADER_COMPONENT_PATH)/src flash MAKEFLAGS= V=$(V)
|
||||||
|
@@ -10,3 +10,6 @@ COMPONENTS := esptool_py
|
|||||||
#adding it in the main/Makefile directory.
|
#adding it in the main/Makefile directory.
|
||||||
|
|
||||||
include $(SDK_PATH)/make/project.mk
|
include $(SDK_PATH)/make/project.mk
|
||||||
|
|
||||||
|
# override configured app offset, as bootloader "app" is at 0x1000
|
||||||
|
CONFIG_APP_OFFSET := 0x1000
|
||||||
|
@@ -16,12 +16,13 @@ all: project
|
|||||||
# disable built-in make rules, makes debugging saner
|
# disable built-in make rules, makes debugging saner
|
||||||
MAKEFLAGS +=-rR
|
MAKEFLAGS +=-rR
|
||||||
|
|
||||||
# Figure out PROJECT_PATH if not set, check for unacceptable Makefile entry points
|
# Figure out PROJECT_PATH if not set
|
||||||
ifeq ("$(PROJECT_PATH)","")
|
ifeq ("$(PROJECT_PATH)","")
|
||||||
#The path to the project: we assume the Makefile including this file resides
|
#The path to the project: we assume the Makefile including this file resides
|
||||||
#in the root of that directory.
|
#in the root of that directory.
|
||||||
PROJECT_PATH := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
|
PROJECT_PATH := $(abspath $(dir $(firstword $(MAKEFILE_LIST))))
|
||||||
export PROJECT_PATH
|
export PROJECT_PATH
|
||||||
|
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.
|
||||||
@@ -59,6 +60,8 @@ COMPONENT_PATHS_BUILDABLE := $(foreach cp,$(COMPONENT_PATHS),$(if $(wildcard $(c
|
|||||||
|
|
||||||
# Assemble global list of include dirs (COMPONENT_INCLUDES), and
|
# Assemble global list of include dirs (COMPONENT_INCLUDES), and
|
||||||
# LDFLAGS args (COMPONENT_LDFLAGS) supplied by each component.
|
# LDFLAGS args (COMPONENT_LDFLAGS) supplied by each component.
|
||||||
|
COMPONENT_INCLUDES :=
|
||||||
|
COMPONENT_LDFLAGS :=
|
||||||
#
|
#
|
||||||
# Also add any inter-component dependencies for each component.
|
# Also add any inter-component dependencies for each component.
|
||||||
|
|
||||||
@@ -72,7 +75,7 @@ COMPONENT_PATHS_BUILDABLE := $(foreach cp,$(COMPONENT_PATHS),$(if $(wildcard $(c
|
|||||||
#
|
#
|
||||||
# Debugging this? Replace $(shell with $(error and you'll see the full command as-run.
|
# Debugging this? Replace $(shell with $(error and you'll see the full command as-run.
|
||||||
define GetVariable
|
define GetVariable
|
||||||
$(shell "$(MAKE)" -s --no-print-directory -C $(1) get_variable COMPONENT_INCLUDES=dummy COMPONENT_LDFLAGS=dummy PROJECT_PATH=$(PROJECT_PATH) GET_VARIABLE=$(2) | sed -En "s/^$(2)=(.+)/\1/p" )
|
$(shell "$(MAKE)" -s --no-print-directory -C $(1) get_variable PROJECT_PATH=$(PROJECT_PATH) GET_VARIABLE=$(2) | sed -En "s/^$(2)=(.+)/\1/p" )
|
||||||
endef
|
endef
|
||||||
|
|
||||||
ifeq ("$(COMPONENT_INCLUDES)","")
|
ifeq ("$(COMPONENT_INCLUDES)","")
|
||||||
@@ -129,6 +132,7 @@ export CC CXX LD AR OBJCOPY
|
|||||||
PYTHON=$(call dequote,$(CONFIG_PYTHON))
|
PYTHON=$(call dequote,$(CONFIG_PYTHON))
|
||||||
|
|
||||||
PROJECT_ELF:=$(BUILD_DIR_BASE)/$(PROJECT_NAME).elf
|
PROJECT_ELF:=$(BUILD_DIR_BASE)/$(PROJECT_NAME).elf
|
||||||
|
PROJECT_MAP:=$(PROJECT_ELF:.elf=.map)
|
||||||
PROJECT_BIN:=$(PROJECT_ELF:.elf=.bin)
|
PROJECT_BIN:=$(PROJECT_ELF:.elf=.bin)
|
||||||
|
|
||||||
# Include any Makefile.projbuild file letting components add
|
# Include any Makefile.projbuild file letting components add
|
||||||
@@ -139,10 +143,13 @@ COMPONENT_PATH := $(1)
|
|||||||
endef
|
endef
|
||||||
$(foreach componentpath,$(COMPONENT_PATHS),$(eval $(call includeProjBuildMakefile,$(componentpath))))
|
$(foreach componentpath,$(COMPONENT_PATHS),$(eval $(call includeProjBuildMakefile,$(componentpath))))
|
||||||
|
|
||||||
|
# once we know component paths, we can include the config
|
||||||
|
include $(SDK_PATH)/make/project_config.mk
|
||||||
|
|
||||||
# ELF depends on the -build target of every component
|
# ELF depends on the -build target of every component
|
||||||
$(PROJECT_ELF): $(addsuffix -build,$(notdir $(COMPONENT_PATHS_BUILDABLE)))
|
$(PROJECT_ELF): $(addsuffix -build,$(notdir $(COMPONENT_PATHS_BUILDABLE)))
|
||||||
$(vecho) LD $(notdir $@)
|
$(vecho) LD $(notdir $@)
|
||||||
$(Q) $(CC) $(LDFLAGS) -o $@ -Wl,-Map=$(patsubst %.elf,%.map,$@)
|
$(Q) $(CC) $(LDFLAGS) -o $@ -Wl,-Map=$(PROJECT_MAP)
|
||||||
|
|
||||||
# Generation of $(PROJECT_BIN) from $(PROJECT_ELF) is added by the esptool
|
# Generation of $(PROJECT_BIN) from $(PROJECT_ELF) is added by the esptool
|
||||||
# component's Makefile.projbuild
|
# component's Makefile.projbuild
|
||||||
@@ -174,12 +181,9 @@ $(foreach component,$(COMPONENT_PATHS_BUILDABLE),$(eval $(call GenerateComponent
|
|||||||
$(foreach component,$(COMPONENT_PATHS_BUILDABLE),$(eval $(call GenerateComponentTarget,$(component),build,$(PROJECT_PATH)/build/include/sdkconfig.h)))
|
$(foreach component,$(COMPONENT_PATHS_BUILDABLE),$(eval $(call GenerateComponentTarget,$(component),build,$(PROJECT_PATH)/build/include/sdkconfig.h)))
|
||||||
$(foreach component,$(COMPONENT_PATHS_BUILDABLE),$(eval $(call GenerateComponentTarget,$(component),clean)))
|
$(foreach component,$(COMPONENT_PATHS_BUILDABLE),$(eval $(call GenerateComponentTarget,$(component),clean)))
|
||||||
|
|
||||||
include $(SDK_PATH)/make/project_config.mk
|
|
||||||
|
|
||||||
clean: $(addsuffix -clean,$(notdir $(COMPONENT_PATHS_BUILDABLE))) $(EXTRA_CLEAN_TARGETS)
|
clean: $(addsuffix -clean,$(notdir $(COMPONENT_PATHS_BUILDABLE))) $(EXTRA_CLEAN_TARGETS)
|
||||||
$(vecho) RM $(PROJECT_ELF)
|
$(vecho) RM $(PROJECT_ELF)
|
||||||
$(Q) rm -f $(PROJECT_ELF)
|
$(Q) rm -f $(PROJECT_ELF) $(PROJECT_BIN) $(PROJECT_MAP)
|
||||||
$(Q) rm -rf $(PROJECT_PATH)/build/include/config $(PROJECT_PATH)/build/include/sdkconfig.h
|
$(Q) rm -rf $(PROJECT_PATH)/build/include/config $(PROJECT_PATH)/build/include/sdkconfig.h
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ $(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
|
|||||||
MAKEFLAGS="" \
|
MAKEFLAGS="" \
|
||||||
CFLAGS="" \
|
CFLAGS="" \
|
||||||
LDFLAGS="" \
|
LDFLAGS="" \
|
||||||
|
CC=$(HOSTCC) LD=$(HOSTLD) \
|
||||||
$(MAKE) -C $(KCONFIG_TOOL_DIR)
|
$(MAKE) -C $(KCONFIG_TOOL_DIR)
|
||||||
|
|
||||||
menuconfig: $(KCONFIG_TOOL_DIR)/mconf $(SDK_PATH)/Kconfig $(BUILD_DIR_BASE)
|
menuconfig: $(KCONFIG_TOOL_DIR)/mconf $(SDK_PATH)/Kconfig $(BUILD_DIR_BASE)
|
||||||
|
Reference in New Issue
Block a user