2 # Copyright (c) 2020 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 := chip-all-clusters-app
24 # The list of extra component dirs must be in sync with that in all-clusters-app/esp32/CMakeLists.txt
25 EXTRA_COMPONENT_DIRS += $(PROJECT_PATH)/third_party/connectedhomeip/config/esp32/components \
26 $(PROJECT_PATH)/../../common/m5stack-tft/repo/components \
27 $(PROJECT_PATH)/../../common/QRCode \
28 $(PROJECT_PATH)/../../common/screen-framework \
30 CXXFLAGS += -std=c++14 -Os -DLWIP_IPV6_SCOPES=0
31 CPPFLAGS += -Os -DLWIP_IPV6_SCOPES=0 -DCHIP_HAVE_CONFIG_H
32 CFLAGS += -Os -DLWIP_IPV6_SCOPES=0
34 top: all flashing_script
36 include $(IDF_PATH)/make/project.mk
38 FLASHING_SCRIPT=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py
40 # Describes what files are required to be bundled in a package for self-contained
43 # NOTE: ESP32 still depends on $IDF_PATH being set
44 FLASHING_BUNDLE=$(BUILD_DIR_BASE)/$(PROJECT_NAME).flashbundle.txt
46 $(FLASHING_SCRIPT): $(APP_BIN) $(BOOTLOADER_BIN) $(PARTITION_TABLE_BIN) $(PROJECT_PATH)/sdkconfig
47 @third_party/connectedhomeip/scripts/flashing/gen_flashing_script.py esp32 \
48 --output $(BUILD_DIR_BASE)/$(PROJECT_NAME).flash.py \
49 --port $(ESPPORT) --baud $(ESPBAUD) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER) \
50 --application $(subst $(BUILD_DIR_BASE)/,,$(APP_BIN)) \
51 --bootloader $(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN)) \
52 --partition $(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN)) \
53 --use-partition-file $(PARTITION_TABLE_BIN) \
54 --use-parttool $(IDF_PATH)/components/partition_table/parttool.py \
55 --use-sdkconfig $(PROJECT_PATH)/sdkconfig
58 echo "$(subst $(BUILD_DIR_BASE)/,,$(FLASHING_SCRIPT))" >$@
59 echo "esp32_firmware_utils.py" >> $@
60 echo "firmware_utils.py" >>$@
61 echo "$(subst $(BUILD_DIR_BASE)/,,$(APP_BIN))" >>$@
62 echo "$(subst $(BUILD_DIR_BASE)/,,$(BOOTLOADER_BIN))" >>$@
63 echo "$(subst $(BUILD_DIR_BASE)/,,$(PARTITION_TABLE_BIN))" >>$@
65 flashing_script: $(FLASHING_SCRIPT) $(BUILD_DIR_BASE)/esp32_firmware_utils.py $(BUILD_DIR_BASE)/firmware_utils.py $(FLASHING_BUNDLE)
66 @echo To flash $(subst $(CURDIR)/,,$(APP_BIN)), run $(subst $(CURDIR)/,,$(FLASHING_SCRIPT))
68 $(BUILD_DIR_BASE)/esp32_firmware_utils.py: third_party/connectedhomeip/scripts/flashing/esp32_firmware_utils.py
71 $(BUILD_DIR_BASE)/firmware_utils.py: third_party/connectedhomeip/scripts/flashing/firmware_utils.py
74 .PHONY: flashing_script