mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-19 16:19:07 +08:00
152 lines
4.1 KiB
Makefile
152 lines
4.1 KiB
Makefile
SUPPORTED_TOOLCHAIN_COMMIT_DESC := 1.22.0-92-g8facf4c
|
|
SUPPORTED_TOOLCHAIN_GCC_VERSIONS := 5.2.0
|
|
|
|
ifdef CONFIG_ESP8266_LEGACY
|
|
|
|
BOOTLOADER_FIRMWARE_DIR := $(abspath $(COMPONENT_PATH))/firmware
|
|
|
|
ESPTOOLPY_FLASHSIZE ?= $(CONFIG_ESPTOOLPY_FLASHSIZE)
|
|
|
|
ifeq ($(ESPTOOLPY_FLASHSIZE), "2MB")
|
|
ESP_INIT_DATA_DEFAULT_BIN_OFFSET := 0x1FC000
|
|
endif
|
|
|
|
ifeq ($(ESPTOOLPY_FLASHSIZE), "4MB")
|
|
ESP_INIT_DATA_DEFAULT_BIN_OFFSET := 0x3FC000
|
|
endif
|
|
|
|
ifeq ($(ESPTOOLPY_FLASHSIZE), "8MB")
|
|
ESP_INIT_DATA_DEFAULT_BIN_OFFSET := 0x7FC000
|
|
endif
|
|
|
|
ifeq ($(ESPTOOLPY_FLASHSIZE), "16MB")
|
|
ESP_INIT_DATA_DEFAULT_BIN_OFFSET := 0xFFC000
|
|
endif
|
|
|
|
ESP_INIT_DATA_DEFAULT_BIN := $(BOOTLOADER_FIRMWARE_DIR)/esp_init_data_default.bin
|
|
|
|
ESPTOOL_ALL_FLASH_ARGS += $(ESP_INIT_DATA_DEFAULT_BIN_OFFSET) $(ESP_INIT_DATA_DEFAULT_BIN)
|
|
|
|
else
|
|
|
|
ifdef CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION
|
|
|
|
PHY_INIT_DATA_OBJ = $(BUILD_DIR_BASE)/phy_init_data.o
|
|
PHY_INIT_DATA_BIN = $(BUILD_DIR_BASE)/phy_init_data.bin
|
|
|
|
# Command to flash PHY init data partition
|
|
PHY_INIT_DATA_FLASH_CMD = $(ESPTOOLPY_SERIAL) write_flash $(PHY_DATA_OFFSET) $(PHY_INIT_DATA_BIN)
|
|
ESPTOOL_ALL_FLASH_ARGS += $(PHY_DATA_OFFSET) $(PHY_INIT_DATA_BIN)
|
|
|
|
ESP8266_COMPONENT_PATH := $(COMPONENT_PATH)
|
|
|
|
$(PHY_INIT_DATA_OBJ): $(ESP8266_COMPONENT_PATH)/include/internal/phy_init_data.h $(BUILD_DIR_BASE)/include/sdkconfig.h
|
|
$(summary) CC $(notdir $@)
|
|
printf "#include \"internal/phy_init_data.h\"\n" | $(CC) -I $(BUILD_DIR_BASE)/include -I $(ESP8266_COMPONENT_PATH) -I $(ESP8266_COMPONENT_PATH)/include -c -o $@ -xc -
|
|
|
|
$(PHY_INIT_DATA_BIN): $(PHY_INIT_DATA_OBJ)
|
|
$(summary) BIN $(notdir $@)
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
phy_init_data: $(PHY_INIT_DATA_BIN)
|
|
|
|
phy_init_data-flash: $(BUILD_DIR_BASE)/phy_init_data.bin
|
|
@echo "Flashing PHY init data..."
|
|
$(PHY_INIT_DATA_FLASH_CMD)
|
|
|
|
phy_init_data-clean:
|
|
rm -f $(PHY_INIT_DATA_BIN) $(PHY_INIT_DATA_OBJ)
|
|
|
|
all: phy_init_data
|
|
flash: phy_init_data
|
|
|
|
endif # CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION
|
|
|
|
endif
|
|
|
|
# global CFLAGS for ESP8266
|
|
CFLAGS += -DICACHE_FLASH
|
|
|
|
ifdef CONFIG_ESP_FILENAME_MACRO_NO_PATH
|
|
CFLAGS += -D__ESP_FILE__='"$$(subst $$(dir $$<),,$$<)"'
|
|
CXXFLAGS += -D__ESP_FILE__='"$$(subst $$(dir $$<),,$$<)"'
|
|
endif
|
|
|
|
ifdef CONFIG_ESP_FILENAME_MACRO_RAW
|
|
CFLAGS += -D__ESP_FILE__=__FILE__
|
|
CXXFLAGS += -D__ESP_FILE__=__FILE__
|
|
endif
|
|
|
|
ifdef CONFIG_ESP_FILENAME_MACRO_NULL
|
|
CFLAGS += -D__ESP_FILE__='"null"'
|
|
CXXFLAGS += -D__ESP_FILE__='"null"'
|
|
endif
|
|
|
|
.PHONY: ota ota-clean app2 app2-flash app2-flash-all
|
|
|
|
RAW_BIN := ./build/$(PROJECT_NAME).bin
|
|
OTA_BIN := ./build/$(PROJECT_NAME).ota.bin
|
|
OTA1_BIN := ./build/$(PROJECT_NAME).app1.bin
|
|
OTA2_BIN := ./build/$(PROJECT_NAME).app2.bin
|
|
|
|
OTA_V2_TO_V3_BIN := ./build/$(PROJECT_NAME).v2_to_v3.ota.bin
|
|
|
|
ifndef CONFIG_ESP8266_BOOT_COPY_APP
|
|
ifdef CONFIG_ESPTOOLPY_FLASHSIZE_1MB
|
|
__COMBILE_OTA_BIN := 1
|
|
endif
|
|
endif
|
|
|
|
app2: all
|
|
ifdef CONFIG_ESPTOOLPY_FLASHSIZE_1MB
|
|
@rm -f ./build/esp8266/esp8266_out.ld
|
|
@export CFLAGS= && export CXXFLAGS= && make APP_OFFSET=$(APP2_OFFSET) APP_SIZE=$(APP2_SIZE)
|
|
endif
|
|
@echo "To flash all build output, run 'make flash' or:"
|
|
@echo $(ESPTOOLPY_WRITE_FLASH) $(APP2_OFFSET) $(APP_BIN)
|
|
|
|
app2-flash: app2
|
|
@$(ESPTOOLPY_WRITE_FLASH) $(APP2_OFFSET) $(APP_BIN)
|
|
|
|
app2-flash-all: app2
|
|
@$(ESPTOOLPY_WRITE_FLASH) $(patsubst $(APP_OFFSET),$(APP2_OFFSET),$(ESPTOOL_ALL_FLASH_ARGS))
|
|
|
|
$(OTA1_BIN): all_binaries
|
|
@cp $(RAW_BIN) $(OTA1_BIN)
|
|
@echo [GEN] $(OTA1_BIN)
|
|
|
|
$(OTA2_BIN): $(OTA1_BIN)
|
|
ifdef __COMBILE_OTA_BIN
|
|
@rm -f ./build/esp8266/esp8266_out.ld
|
|
@export CFLAGS= && export CXXFLAGS= && make APP_OFFSET=$(APP2_OFFSET) APP_SIZE=$(APP2_SIZE)
|
|
endif
|
|
@cp $(RAW_BIN) $(OTA2_BIN)
|
|
@echo [GEN] $(OTA2_BIN)
|
|
|
|
$(OTA_BIN): $(OTA2_BIN)
|
|
@cp $(OTA1_BIN) $(OTA_BIN)
|
|
ifdef __COMBILE_OTA_BIN
|
|
@cat $(OTA2_BIN) >> $(OTA_BIN)
|
|
@cp $(OTA1_BIN) $(RAW_BIN)
|
|
endif
|
|
@echo [GEN] $(OTA_BIN)
|
|
|
|
PYTHON ?= $(call dequote,$(CONFIG_PYTHON))
|
|
|
|
ifdef CONFIG_ESP8266_OTA_FROM_OLD
|
|
$(OTA_V2_TO_V3_BIN): all
|
|
@$(PYTHON) $(IDF_PATH)/tools/pack_fw.py --output $(OTA_V2_TO_V3_BIN) --app $(PROJECT_NAME).bin pack3 $(ESPTOOL_ALL_FLASH_ARGS)
|
|
@echo [GEN] $(OTA_V2_TO_V3_BIN)
|
|
endif
|
|
|
|
ifdef CONFIG_ESP8266_OTA_FROM_OLD
|
|
ota: $(OTA_V2_TO_V3_BIN)
|
|
else
|
|
ota: $(OTA_BIN)
|
|
endif
|
|
|
|
ota-clean:
|
|
@rm -f $(OTA_BIN) $(OTA1_BIN) $(OTA2_BIN) $(OTA_V2_TO_V3_BIN)
|
|
|
|
clean: ota-clean
|