2016-08-17 11:08:22 -04:00
|
|
|
#
|
|
|
|
# Bootloader component
|
|
|
|
#
|
|
|
|
# The bootloader is not a real component that gets linked into the project.
|
|
|
|
# Instead it is an entire standalone project ( in src/) that gets built in
|
|
|
|
# the upper projects build directory. This Makefile.projbuild provides the
|
|
|
|
# glue to build the bootloader project from the original project. It
|
|
|
|
# basically runs Make in the src/ directory but it needs to zero some variables
|
2016-08-19 02:30:39 -04:00
|
|
|
# the ESP-IDF project.mk makefile exports first, to not let them interfere.
|
2016-08-17 11:08:22 -04:00
|
|
|
#
|
|
|
|
|
|
|
|
BOOTLOADER_COMPONENT_PATH := $(COMPONENT_PATH)
|
2016-08-18 00:36:15 -04:00
|
|
|
BOOTLOADER_BUILD_DIR=$(BUILD_DIR_BASE)/bootloader
|
|
|
|
BOOTLOADER_BIN=$(BOOTLOADER_BUILD_DIR)/bootloader.bin
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-08-24 00:26:13 -04:00
|
|
|
.PHONY: bootloader-clean bootloader-flash bootloader $(BOOTLOADER_BIN)
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-08-24 01:23:00 -04:00
|
|
|
$(BOOTLOADER_BIN): $(COMPONENT_PATH)/src/sdkconfig
|
2016-08-17 11:08:22 -04:00
|
|
|
$(Q) PROJECT_PATH= \
|
|
|
|
LDFLAGS= \
|
|
|
|
CFLAGS= \
|
2016-08-18 00:36:15 -04:00
|
|
|
BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
|
2016-08-19 00:16:06 -04:00
|
|
|
$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src MAKEFLAGS= V=$(V) TARGET_BIN_LAYOUT="$(BOOTLOADER_TARGET_BIN_LAYOUT)" $(BOOTLOADER_BIN)
|
2016-08-17 11:08:22 -04:00
|
|
|
|
|
|
|
bootloader-clean:
|
|
|
|
$(Q) PROJECT_PATH= \
|
|
|
|
LDFLAGS= \
|
|
|
|
CFLAGS= \
|
2016-08-18 00:36:15 -04:00
|
|
|
BUILD_DIR_BASE=$(BOOTLOADER_BUILD_DIR) \
|
2016-08-19 00:16:06 -04:00
|
|
|
$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src app-clean MAKEFLAGS= V=$(V)
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-08-18 05:11:27 -04:00
|
|
|
clean: bootloader-clean
|
|
|
|
|
2016-08-18 00:36:15 -04:00
|
|
|
bootloader: $(BOOTLOADER_BIN)
|
2016-08-18 04:59:38 -04:00
|
|
|
@echo "Bootloader built. Default flash command is:"
|
2016-08-22 06:43:47 -04:00
|
|
|
@echo "$(ESPTOOLPY_WRITE_FLASH) 0x1000 $(BOOTLOADER_BIN)"
|
2016-08-17 11:08:22 -04:00
|
|
|
|
2016-08-18 05:11:27 -04:00
|
|
|
all_binaries: $(BOOTLOADER_BIN)
|
|
|
|
|
|
|
|
ESPTOOL_ALL_FLASH_ARGS += 0x1000 $(BOOTLOADER_BIN)
|
|
|
|
|
2016-08-17 11:08:22 -04:00
|
|
|
# synchronise the project level config to the component's
|
|
|
|
# config
|
|
|
|
$(COMPONENT_PATH)/src/sdkconfig: $(PROJECT_PATH)/sdkconfig
|
|
|
|
$(Q) cp $< $@
|
|
|
|
|
|
|
|
# bootloader-flash calls flash in the bootloader dummy project
|
|
|
|
bootloader-flash: $(BOOTLOADER_BIN)
|
2016-08-19 00:16:06 -04:00
|
|
|
$(MAKE) -C $(BOOTLOADER_COMPONENT_PATH)/src flash MAKEFLAGS= V=$(V)
|