1ifdef CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION
2
3ESP_PHY_COMPONENT_PATH := $(COMPONENT_PATH)
4
5ifdef CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
6PHY_INIT_DATA_BIN = $(ESP_PHY_COMPONENT_PATH)/$(IDF_TARGET)/phy_multiple_init_data.bin
7else
8PHY_INIT_DATA_OBJ = $(BUILD_DIR_BASE)/phy_init_data.o
9PHY_INIT_DATA_BIN = $(BUILD_DIR_BASE)/phy_init_data.bin
10
11$(PHY_INIT_DATA_OBJ): $(ESP_PHY_COMPONENT_PATH)/$(IDF_TARGET)/include/phy_init_data.h $(BUILD_DIR_BASE)/include/sdkconfig.h
12	$(summary) CC $(notdir $@)
13	printf "#include \"phy_init_data.h\"\n" | $(CC) -I $(BUILD_DIR_BASE)/include -I $(ESP_PHY_COMPONENT_PATH)/../esp_common/include -I $(ESP_PHY_COMPONENT_PATH)/include -I $(ESP_PHY_COMPONENT_PATH)/$(IDF_TARGET)/include -c -o $@ -xc -
14
15$(PHY_INIT_DATA_BIN): $(PHY_INIT_DATA_OBJ)
16	$(summary) BIN $(notdir $@)
17	$(OBJCOPY) -O binary $< $@
18endif
19
20# Command to flash PHY init data partition
21PHY_INIT_DATA_FLASH_CMD = $(ESPTOOLPY_SERIAL) write_flash $(PHY_DATA_OFFSET) $(PHY_INIT_DATA_BIN)
22ESPTOOL_ALL_FLASH_ARGS += $(PHY_DATA_OFFSET) $(PHY_INIT_DATA_BIN)
23
24phy_init_data: $(PHY_INIT_DATA_BIN)
25
26phy_init_data-flash: $(PHY_INIT_DATA_BIN)
27	@echo "Flashing PHY init data..."
28	$(PHY_INIT_DATA_FLASH_CMD)
29
30ifndef CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN
31phy_init_data-clean:
32	rm -f $(PHY_INIT_DATA_BIN) $(PHY_INIT_DATA_OBJ)
33
34clean: phy_init_data-clean
35endif
36
37all: phy_init_data
38flash: phy_init_data
39
40endif # CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION
41