2 # Copyright (c) 2021 Project CHIP Authors
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 # This is a project Makefile. It is assumed the directory this Makefile resides in is a
19 # project subdirectory.
22 PROJECT_NAME := persistent-storage
24 EXTRA_COMPONENT_DIRS += $(PROJECT_PATH)/third_party/connectedhomeip/config/esp32/components \
26 CXXFLAGS += -std=gnu++17 -Os -DLWIP_IPV6_SCOPES=0
27 CPPFLAGS += -Os -DLWIP_IPV6_SCOPES=0 -DCHIP_HAVE_CONFIG_H
28 CFLAGS += -Os -DLWIP_IPV6_SCOPES=0
30 top: all flashing_script
32 include $(IDF_PATH)/make/project.mk
34 FLASHING_SCRIPT=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py
36 $(FLASHING_SCRIPT): $(APP_BIN) $(BOOTLOADER_BIN) $(PARTITION_TABLE_BIN) $(PROJECT_PATH)/sdkconfig
37 @third_party/connectedhomeip/scripts/flashing/gen_flashing_script.py esp32 \
38 --output $(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py \
39 --port $(ESPPORT) --baud $(ESPBAUD) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER) \
40 --application $(subst $(BUILD_DIR_BASE)/,,$(APP_BIN)) \
41 --bootloader $(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN)) \
42 --partition $(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN)) \
43 --use-partition-file $(PARTITION_TABLE_BIN) \
44 --use-parttool $(IDF_PATH)/components/partition_table/parttool.py \
45 --use-sdkconfig $(PROJECT_PATH)/sdkconfig
47 flashing_script: $(FLASHING_SCRIPT) $(BUILD_DIR_BASE)/esp32_firmware_utils.py $(BUILD_DIR_BASE)/firmware_utils.py
48 @echo To flash $(subst $(CURDIR)/,,$(APP_BIN)), run $(subst $(CURDIR)/,,$(FLASHING_SCRIPT))
50 $(BUILD_DIR_BASE)/esp32_firmware_utils.py: third_party/connectedhomeip/scripts/flashing/esp32_firmware_utils.py
53 $(BUILD_DIR_BASE)/firmware_utils.py: third_party/connectedhomeip/scripts/flashing/firmware_utils.py
56 .PHONY: flashing_script