Skip to content

Commit 8686f21

Browse files
wqx6bzbarsky-apple
andauthored
Fix examples building when enabling external platform (#31188)
* Add extra include directory for external platform * Add external platform build task CI for ESP32 lighting app * Fix some headers including * Update examples/platform/esp32/external_platform/ESP32_custom/BUILD.gn Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> --------- Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent 9279628 commit 8686f21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+301
-0
lines changed

.github/workflows/examples-esp32.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,6 @@ jobs:
162162

163163
- name: Build example Light Switch App (Target:ESP32C3)
164164
run: scripts/examples/esp_example.sh light-switch-app sdkconfig.defaults.esp32c3
165+
166+
- name: Build example Lighting App (external platform)
167+
run: scripts/examples/esp_example.sh lighting-app sdkconfig.ext_plat.defaults

config/esp32/components/chip/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ if (CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM)
224224
chip_gn_arg_append("chip_shell_platform" "\"esp32\"")
225225
endif()
226226
chip_gn_arg_append("chip_platform_target" "\"//${CONFIG_CHIP_EXTERNAL_PLATFORM_DIR}\"")
227+
chip_gn_arg_append("chip_external_platform_include_dir" "\"//${CONFIG_CHIP_EXTERNAL_PLATFORM_INCLUDE_DIR}\"")
227228
endif()
228229

229230
# Set up CHIP project configuration file

config/esp32/components/chip/Kconfig

+6
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,12 @@ menu "CHIP Device Layer"
10701070
help
10711071
The directory of the external platform.
10721072

1073+
config CHIP_EXTERNAL_PLATFORM_INCLUDE_DIR
1074+
string "The external platform including directory"
1075+
depends on CHIP_ENABLE_EXTERNAL_PLATFORM
1076+
help
1077+
The including directory of the external platform.
1078+
10731079
endmenu
10741080

10751081
menu "Matter Manufacturing Options"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#
2+
# Copyright (c) 2021 Project CHIP Authors
3+
# All rights reserved.
4+
#
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
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
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.
16+
#
17+
# Description:
18+
# Some useful defaults for the demo app configuration.
19+
#
20+
21+
# Default to 921600 baud when flashing and monitoring device
22+
CONFIG_ESPTOOLPY_BAUD_921600B=y
23+
CONFIG_ESPTOOLPY_BAUD=921600
24+
CONFIG_ESPTOOLPY_COMPRESSED=y
25+
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
26+
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
27+
28+
#enable BT
29+
CONFIG_BT_ENABLED=y
30+
CONFIG_BT_NIMBLE_ENABLED=y
31+
32+
#disable BT connection reattempt
33+
CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n
34+
35+
#enable lwip ipv6 autoconfig
36+
CONFIG_LWIP_IPV6_AUTOCONFIG=y
37+
38+
#enable debug shell
39+
CONFIG_ENABLE_CHIP_SHELL=y
40+
41+
# Use a custom partition table
42+
CONFIG_PARTITION_TABLE_CUSTOM=y
43+
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
44+
45+
#enable lwIP route hooks
46+
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
47+
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
48+
49+
# Serial Flasher config
50+
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
51+
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
52+
53+
# Disable softap support by default
54+
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
55+
# This example uses the older version of RMT driver to work with both
56+
# idf-v4.4.3 and idf-v5.0, so suppressing the warnings by setting below option
57+
CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y
58+
59+
# Enable HKDF in mbedtls
60+
CONFIG_MBEDTLS_HKDF_C=y
61+
62+
# Disable Read Client
63+
CONFIG_DISABLE_READ_CLIENT=y
64+
65+
# Increase LwIP IPv6 address number
66+
CONFIG_LWIP_IPV6_NUM_ADDRESSES=6
67+
68+
CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM=y
69+
CONFIG_CHIP_EXTERNAL_PLATFORM_DIR="../../examples/platform/esp32/external_platform/ESP32_custom/"
70+
CONFIG_CHIP_EXTERNAL_PLATFORM_INCLUDE_DIR="../../examples/platform/esp32/"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/BLEManagerImpl.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Copyright (c) 2023 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/chip.gni")
16+
17+
import("${chip_root}/build/chip/buildconfig_header.gni")
18+
import("${chip_root}/src/platform/device.gni")
19+
20+
declare_args() {
21+
# By default use default/example implementation of CommissionableDataProvider,
22+
# DeviceAttestationCredentialsProvider and DeviceInstanceInfoProvider
23+
chip_use_transitional_commissionable_data_provider = true
24+
chip_use_factory_data_provider = false
25+
chip_use_device_info_provider = false
26+
chip_config_software_version_number = 0
27+
chip_enable_chipoble = true
28+
chip_bt_nimble_enabled = true
29+
chip_bt_bluedroid_enabled = true
30+
chip_max_discovered_ip_addresses = 5
31+
chip_enable_route_hook = false
32+
}
33+
34+
buildconfig_header("custom_buildconfig") {
35+
header = "CHIPDeviceBuildConfig.h"
36+
header_dir = "platform"
37+
38+
defines = [
39+
"CHIP_DEVICE_CONFIG_ENABLE_WPA=false",
40+
"CHIP_ENABLE_OPENTHREAD=${chip_enable_openthread}",
41+
"CHIP_DEVICE_CONFIG_THREAD_FTD=${chip_openthread_ftd}",
42+
"OPENTHREAD_CONFIG_ENABLE_TOBLE=false",
43+
"CHIP_BYPASS_RENDEZVOUS=false",
44+
"CHIP_STACK_LOCK_TRACKING_ENABLED=true",
45+
"CHIP_STACK_LOCK_TRACKING_ERROR_FATAL=false",
46+
"CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING=false",
47+
"CHIP_DEVICE_CONFIG_RUN_AS_ROOT=false",
48+
"CHIP_DEVICE_LAYER_TARGET_ESP32=1",
49+
"CHIP_DEVICE_LAYER_TARGET=ESP32_custom",
50+
"CHIP_USE_TRANSITIONAL_COMMISSIONABLE_DATA_PROVIDER=1",
51+
"BLE_PLATFORM_CONFIG_INCLUDE=<external_platform/ESP32_custom/BlePlatformConfig.h>",
52+
"CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE=<external_platform/ESP32_custom/CHIPDevicePlatformConfig.h>",
53+
"CHIP_PLATFORM_CONFIG_INCLUDE=<external_platform/ESP32_custom/CHIPPlatformConfig.h>",
54+
"INET_CONFIG_INCLUDE=<external_platform/ESP32_custom/InetPlatformConfig.h>",
55+
"SYSTEM_PLATFORM_CONFIG_INCLUDE=<external_platform/ESP32_custom/SystemPlatformConfig.h>",
56+
"EXTERNAL_CONFIGURATIONMANAGERIMPL_HEADER=<external_platform/ESP32_custom/ConfigurationManagerImpl.h>",
57+
"EXTERNAL_CHIPDEVICEPLATFORMEVENT_HEADER=<external_platform/ESP32_custom/CHIPDevicePlatformEvent.h>",
58+
"EXTERNAL_CONNECTIVITYMANAGERIMPL_HEADER=<external_platform/ESP32_custom/ConnectivityManagerImpl.h>",
59+
"EXTERNAL_BLEMANAGERIMPL_HEADER=<external_platform/ESP32_custom/BLEManagerImpl.h>",
60+
"EXTERNAL_KEYVALUESTOREMANAGERIMPL_HEADER=<external_platform/ESP32_custom/KeyValueStoreManagerImpl.h>",
61+
"EXTERNAL_PLATFORMMANAGERIMPL_HEADER=<external_platform/ESP32_custom/PlatformManagerImpl.h>",
62+
"CHIP_CONFIG_SOFTWARE_VERSION_NUMBER=${chip_config_software_version_number}",
63+
"CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}",
64+
]
65+
66+
if (chip_enable_ota_requestor) {
67+
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR=1" ]
68+
}
69+
}
70+
71+
group("platform_buildconfig") {
72+
public_deps = [ ":custom_buildconfig" ]
73+
}
74+
75+
static_library("ESP32_custom") {
76+
sources = [
77+
"${chip_root}/src/platform/SingletonConfigurationManager.cpp",
78+
"CHIPDevicePlatformConfig.h",
79+
"CHIPDevicePlatformEvent.h",
80+
"ConfigurationManagerImpl.cpp",
81+
"ConfigurationManagerImpl.h",
82+
"ConnectivityManagerImpl.cpp",
83+
"ConnectivityManagerImpl.h",
84+
"DiagnosticDataProviderImpl.cpp",
85+
"DiagnosticDataProviderImpl.h",
86+
"ESP32Config.cpp",
87+
"ESP32Config.h",
88+
"ESP32Utils.cpp",
89+
"ESP32Utils.h",
90+
"KeyValueStoreManagerImpl.cpp",
91+
"KeyValueStoreManagerImpl.h",
92+
"Logging.cpp",
93+
"LwIPCoreLock.cpp",
94+
"PlatformManagerImpl.cpp",
95+
"PlatformManagerImpl.h",
96+
"SystemTimeSupport.cpp",
97+
"SystemTimeSupport.h",
98+
]
99+
100+
deps = [
101+
"${chip_root}/src/lib/dnssd:platform_header",
102+
"${chip_root}/src/platform/logging:headers",
103+
"${chip_root}/src/setup_payload",
104+
]
105+
106+
public_deps = [
107+
":platform_buildconfig",
108+
"${chip_root}/src/crypto",
109+
"${chip_root}/src/platform:platform_base",
110+
]
111+
112+
if (chip_enable_ota_requestor) {
113+
sources += [
114+
"OTAImageProcessorImpl.cpp",
115+
"OTAImageProcessorImpl.h",
116+
]
117+
}
118+
119+
if (chip_enable_chipoble) {
120+
sources += [ "BLEManagerImpl.h" ]
121+
}
122+
123+
if (chip_bt_nimble_enabled) {
124+
sources += [ "nimble/BLEManagerImpl.cpp" ]
125+
}
126+
127+
if (chip_bt_bluedroid_enabled) {
128+
sources += [ "bluedroid/BLEManagerImpl.cpp" ]
129+
}
130+
131+
if (chip_enable_wifi) {
132+
sources += [
133+
"ConnectivityManagerImpl_WiFi.cpp",
134+
"NetworkCommissioningDriver.cpp",
135+
"NetworkCommissioningDriver.h",
136+
"route_hook/ESP32RouteHook.c",
137+
"route_hook/ESP32RouteHook.h",
138+
"route_hook/ESP32RouteTable.c",
139+
"route_hook/ESP32RouteTable.h",
140+
]
141+
if (chip_mdns == "platform") {
142+
sources += [
143+
"DnssdImpl.cpp",
144+
"DnssdImpl.h",
145+
]
146+
}
147+
}
148+
149+
if (chip_use_factory_data_provider) {
150+
sources += [
151+
"ESP32FactoryDataProvider.cpp",
152+
"ESP32FactoryDataProvider.h",
153+
]
154+
}
155+
156+
if (chip_use_device_info_provider) {
157+
sources += [
158+
"ESP32DeviceInfoProvider.cpp",
159+
"ESP32DeviceInfoProvider.h",
160+
]
161+
}
162+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/BlePlatformConfig.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/CHIPDevicePlatformConfig.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/CHIPDevicePlatformEvent.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/CHIPPlatformConfig.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ChipDeviceScanner.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ConfigurationManagerImpl.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ConfigurationManagerImpl.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ConnectivityManagerImpl.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ConnectivityManagerImpl.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ConnectivityManagerImpl_Ethernet.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ConnectivityManagerImpl_WiFi.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/DiagnosticDataProviderImpl.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/DiagnosticDataProviderImpl.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/DnssdImpl.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32CHIPCryptoPAL.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32CHIPCryptoPAL.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32Config.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32Config.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32DeviceInfoProvider.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32DeviceInfoProvider.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32FactoryDataProvider.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32FactoryDataProvider.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32SecureCertDACProvider.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32SecureCertDACProvider.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32Utils.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ESP32Utils.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/InetPlatformConfig.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/KeyValueStoreManagerImpl.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/KeyValueStoreManagerImpl.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/Logging.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/LwIPCoreLock.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/NetworkCommissioningDriver.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/NetworkCommissioningDriver.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/NetworkCommissioningDriver_Ethernet.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/OTAImageProcessorImpl.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/OTAImageProcessorImpl.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/OpenthreadLauncher.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/OpenthreadLauncher.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/PlatformManagerImpl.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/PlatformManagerImpl.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ScopedNvsHandle.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/SystemPlatformConfig.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/SystemTimeSupport.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/SystemTimeSupport.h
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../src/platform/ESP32/ThreadStackManagerImpl.cpp

0 commit comments

Comments
 (0)