-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32 gn support #2325
ESP32 gn support #2325
Changes from 3 commits
a43a0a8
ba63884
53d6ef3
8b76957
8fe0166
b6ca383
0311aac
c971db5
f18dbb9
a314a60
8b2f0da
c3b66a4
6464896
03022d2
eef2d25
f005571
40b537c
cb14fd0
9a43217
e36e955
c578d06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2020 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# The location of the build configuration file. | ||
buildconfig = "//build/config/BUILDCONFIG.gn" | ||
|
||
# CHIP uses angle bracket includes. | ||
check_system_includes = true | ||
|
||
# Allow loading paths relative to //gn. | ||
secondary_source = "//third_party/connectedhomeip/gn/" | ||
|
||
default_args = { | ||
target_cpu = "esp32" | ||
target_os = "freertos" | ||
|
||
import("//args.gni") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (c) 2020 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Options from standalone-chip.mk that differ from configure defaults. These | ||
# options are used from examples/. | ||
|
||
import("//build_overrides/chip.gni") | ||
|
||
config("esp32_config") { | ||
defines = [] | ||
if (is_debug) { | ||
defines = [ "BUILD_RELEASE=0" ] | ||
} else { | ||
defines = [ "BUILD_RELEASE=1" ] | ||
} | ||
} | ||
|
||
group("esp32") { | ||
deps = [ "${chip_root}/src/lib" ] | ||
public_configs = [ ":esp32_config" ] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright (c) 2020 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Options from standalone-chip.mk that differ from configure defaults. These | ||
# options are used from examples/. | ||
|
||
#import("//build_overrides/chip.gni") | ||
|
||
chip_device_platform = "esp32" | ||
|
||
chip_project_config_include = "" | ||
chip_system_project_config_include = "" | ||
chip_ble_project_config_include = "" | ||
|
||
lwip_platform = "esp32" | ||
lwip_ipv6 = true | ||
lwip_ipv4 = true | ||
lwip_api = true | ||
|
||
chip_build_tests = false | ||
chip_inet_config_enable_raw_endpoint = false | ||
chip_inet_config_enable_dns_resolver = false | ||
|
||
#Enabling this causes some error | ||
#chip_inet_config_enable_tun_endpoint = false | ||
chip_inet_config_enable_tcp_endpoint = true | ||
chip_inet_config_enable_udp_endpoint = true | ||
|
||
custom_toolchain = "//third_party/connectedhomeip/config/esp32/toolchain:esp32" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../examples/build_overrides |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (c) 2020 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import("//build_overrides/chip.gni") | ||
|
||
import("//build/toolchain/gcc_toolchain.gni") | ||
|
||
declare_args() { | ||
ar_ext = "" | ||
cc_ext = "" | ||
cxx_ext = "" | ||
cpu_ext = "" | ||
} | ||
|
||
gcc_toolchain("esp32") { | ||
ar = ar_ext | ||
cc = cc_ext | ||
cxx = cxx_ext | ||
|
||
toolchain_args = { | ||
current_os = "freertos" | ||
current_cpu = cpu_ext | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be "xtensa" ? The cpu variable is typically used to determine the architecture. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've been going back and forth on that myself. Finally I thought there is nothing 'xtensa' specific here, the toolchain is esp32-specific, the SDK is esp32-specific, so might as well call it 'esp32'. Thoughts? What typically goes into generic 'cpu' specific files? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An important use case is writing assembly code. See e.g. |
||
is_clang = false | ||
import("${chip_root}/src/platform/ESP32/args.gni") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) 2020 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,10 @@ buildconfig_header("ble_buildconfig") { | |
defines += | ||
[ "BLE_PLATFORM_CONFIG_INCLUDE=${chip_ble_platform_config_include}" ] | ||
} | ||
if (chip_device_platform == "esp32") { | ||
defines += | ||
[ "BLE_PLATFORM_CONFIG_INCLUDE=${chip_ble_platform_config_include}" ] | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this block intended to be added? It looks like BLE_PLATFORM_CONFIG_INCLUDE is set twice here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, the upper 'if' condition had a typo, fixed. |
||
} | ||
|
||
source_set("ble_config_header") { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,11 @@ static_library("crypto") { | |
public_configs = [] | ||
if (chip_crypto == "mbedtls") { | ||
sources += [ "CHIPCryptoPALmbedTLS.cpp" ] | ||
public_deps += [ "${mbedtls_root}:mbedtls" ] | ||
|
||
# ESP32 has its own mbedTLS | ||
if (target_cpu != "esp32") { | ||
public_deps += [ "${mbedtls_root}:mbedtls" ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this and set the |mbedtls_target| argument. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
} | ||
} else if (chip_crypto == "openssl") { | ||
sources += [ "CHIPCryptoPALOpenSSL.cpp" ] | ||
public_configs += [ ":openssl_config" ] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,9 @@ | |
#include <lwip/ip.h> | ||
#include <lwip/raw.h> | ||
#include <lwip/tcpip.h> | ||
#if CHIP_SEPARATE_CONFIG_H | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Andrei is adding this to arch.h |
||
#include <lwip/lwip_buildconfig.h> | ||
#endif // CHIP_SEPARATE_CONFIG_H | ||
#endif // CHIP_SYSTEM_CONFIG_USE_LWIP | ||
|
||
#if CHIP_SYSTEM_CONFIG_USE_SOCKETS | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,12 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { | |
"CHIP_DEVICE_LAYER_TARGET=EFR32", | ||
] | ||
} | ||
if (chip_device_platform == "esp32") { | ||
defines += [ | ||
"CHIP_DEVICE_LAYER_TARGET_ESP32=1", | ||
"CHIP_DEVICE_LAYER_TARGET=ESP32", | ||
] | ||
} | ||
} | ||
|
||
config("platform_config") { | ||
|
@@ -261,6 +267,30 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { | |
"nRF5/ThreadStackManagerImpl.h", | ||
] | ||
} | ||
} else if (chip_device_platform == "esp32") { | ||
sources += [ | ||
"ESP32/BLEManagerImpl.cpp", | ||
"ESP32/BLEManagerImpl.h", | ||
"ESP32/CHIPDevicePlatformConfig.h", | ||
"ESP32/CHIPDevicePlatformEvent.h", | ||
"ESP32/ConfigurationManagerImpl.cpp", | ||
"ESP32/ConfigurationManagerImpl.h", | ||
"ESP32/ConnectivityManagerImpl.cpp", | ||
"ESP32/ConnectivityManagerImpl.h", | ||
"ESP32/ESP32Config.cpp", | ||
"ESP32/ESP32Config.h", | ||
"ESP32/ESP32Utils.cpp", | ||
"ESP32/ESP32Utils.h", | ||
"ESP32/Logging.cpp", | ||
"ESP32/LwIPCoreLock.cpp", | ||
"ESP32/NetworkProvisioningServerImpl.h", | ||
"ESP32/PlatformManagerImpl.cpp", | ||
"ESP32/PlatformManagerImpl.h", | ||
"ESP32/SoftwareUpdateManagerImpl.h", | ||
"ESP32/SystemTimeSupport.cpp", | ||
"FreeRTOS/SystemTimeSupport.cpp", | ||
] | ||
# public_configs += [ "${chip_root}/src/crypto:crypto_config" ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
} else if (chip_device_platform == "efr32") { | ||
sources += [ | ||
"EFR32/BLEManagerImpl.cpp", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they're defined here, probably makes sense to name them something like
esp32_ar
esp32_cc
esp32_cxx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed