Skip to content

Commit

Permalink
Merge 9ae29cc into b8cb560
Browse files Browse the repository at this point in the history
  • Loading branch information
cabin15 authored Feb 2, 2022
2 parents b8cb560 + 9ae29cc commit 5332517
Show file tree
Hide file tree
Showing 26 changed files with 1,844 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,6 @@
[submodule "third_party/mbed-mcu-boot/repo"]
path = third_party/mbed-mcu-boot/repo
url = https://github.com/ATmobica/mcuboot.git
[submodule "third_party/webos_sdk"]
path = third_party/webos_sdk
url = https://github.com/cabin15/webos-ose-ndk
8 changes: 8 additions & 0 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ if (_chip_defaults.custom_toolchain != "") {
} else if (target_os == "tizen") {
_default_toolchain =
"${_build_overrides.build_root}/toolchain/tizen:tizen_${target_cpu}"
} else if (target_os == "webos") {
if (target_cpu == "arm" || target_cpu == "arm64") {
print("target_os = webos / target_cpu = ${target_cpu}")
_default_toolchain = "//build/toolchain/webos"
} else {
assert(false,
"Unsupported target_cpu: ${current_cpu}. Shall be arm for webOS")
}
} else {
assert(false, "No toolchain specified, please specify custom_toolchain")
}
Expand Down
20 changes: 18 additions & 2 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ if (current_os == "mac") {
import("${build_root}/config/mac/mac_sdk.gni")
}

if (current_os == "webos") {
import("${build_root}/config/webos/webos_sdk.gni")
target_defines += []
target_cflags += [ "--sysroot=" + sysroot_webos ]
target_cflags_cc += []
target_cflags_c += []
target_ldflags += [ "--sysroot=" + sysroot_webos ]
}

declare_args() {
# Enable -Werror. This can be disabled if using a different compiler
# with unfixed or unsupported wanings.
Expand Down Expand Up @@ -191,7 +200,7 @@ config("warnings_common") {
}

if (current_os != "mac" && current_os != "ios" && current_os != "linux" &&
current_os != "win" && current_os != "tizen") {
current_os != "win" && current_os != "tizen" && current_os != "webos") {
cflags += [ "-Wstack-usage=8192" ]
}
}
Expand All @@ -207,6 +216,13 @@ config("strict_warnings") {
"-Wformat-security",
]

if (current_os == "webos") {
cflags -= [
"-Wshadow",
"-Wvla",
]
}

cflags_cc = [ "-Wnon-virtual-dtor" ]

ldflags = []
Expand Down Expand Up @@ -271,7 +287,7 @@ config("runtime_default") {
"$dir_pw_toolchain/host_clang:xcode_sysroot",
]
}
if (current_os == "linux" || current_os == "tizen") {
if (current_os == "linux" || current_os == "tizen" || current_os == "webos") {
libs = [
"dl",
"pthread",
Expand Down
17 changes: 17 additions & 0 deletions build/config/webos/webos_sdk.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2021 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.

declare_args() {
sysroot_webos = ""
}
25 changes: 25 additions & 0 deletions build/toolchain/webos/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 The Pigweed Authors
# 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("webos_toolchain.gni")

print(target_os)

webos_toolchain("webos") {
toolchain_args = {
target_os = "linux"
target_cpu = "${current_cpu}"
}
}
37 changes: 37 additions & 0 deletions build/toolchain/webos/webos_toolchain.gni
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.

declare_args() {
cc_webos = ""
cxx_webos = ""
ar_webos = ""
ld_webos = ""
}

import("//build/toolchain/gcc_toolchain.gni")

template("webos_toolchain") {
print("WebOS_ToolChian")
gcc_toolchain(target_name) {
ar = ar_webos
cc = cc_webos + " -O2 -Wno-format-security -Wno-error -Wno-cpp"
cxx = cxx_webos + " -O2 -Wno-format-security -Wno-error -Wno-cpp"
toolchain_args = {
current_cpu = "${current_cpu}"
current_os = invoker.current_os
is_clang = false
forward_variables_from(invoker.toolchain_args, "*")
}
}
}
45 changes: 45 additions & 0 deletions scripts/examples/webos_example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
#
# Copyright (c) 2022 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.
#

# Activating connectedhomeip build environment
source scripts/activate.sh

# Extract webOS SDK
cat third_party/webos_sdk/v2.14.1/webos_sdk.tar* | (
cd third_party/webos_sdk/v2.14.1/
tar xvzf -
)

# Grant execute permission for NDK install script
chmod 555 third_party/webos_sdk/v2.14.1/webos-sdk-x86_64-cortexa7t2hf-neon-vfpv4-toolchain-2.14.1.g.sh

# Install webOS OSE NDK
echo "##### Install webOS OSE NDK #####"
third_party/webos_sdk/v2.14.1/webos-sdk-x86_64-cortexa7t2hf-neon-vfpv4-toolchain-2.14.1.g.sh -d third_party/webos_sdk/v2.14.1 -y

# Activating webOS NDK build environment
echo "##### Activating webOS NDK build environment #####"
source third_party/webos_sdk/v2.14.1/environment-setup-cortexa7t2hf-neon-vfpv4-webos-linux-gnueabi
echo ""

# Build webos example
echo "##### Build webos example #####"
echo "##### Performing gn gen #####"
gn gen out/host --args="is_debug=false target_os=\"webos\" target_cpu=\"arm\" chip_enable_python_modules=false ar_webos=\"$AR\" cc_webos=\"$CC\" cxx_webos=\"$CXX\" sysroot_webos=\"$PKG_CONFIG_SYSROOT_DIR\" chip_build_tests=false enable_syslog=true chip_config_network_layer_ble=false"

echo "##### Building by ninja #####"
ninja -C out/host
2 changes: 1 addition & 1 deletion src/crypto/crypto.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare_args() {

if (chip_crypto == "") {
if (current_os == "android" || current_os == "freertos" ||
current_os == "zephyr" || current_os == "mbed") {
current_os == "zephyr" || current_os == "mbed" || current_os == "webos") {
chip_crypto = "mbedtls"
} else {
chip_crypto = "openssl"
Expand Down
12 changes: 11 additions & 1 deletion src/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if (chip_device_platform != "none") {

if (chip_stack_lock_tracking == "auto") {
if (chip_device_platform == "linux" || chip_device_platform == "tizen" ||
chip_device_platform == "android") {
chip_device_platform == "android" || chip_device_platform == "webos") {
# TODO: should be fatal for development. Change once bugs are fixed
chip_stack_lock_tracking = "log"
} else {
Expand Down Expand Up @@ -222,6 +222,14 @@ if (chip_device_platform != "none") {
"CHIP_DEVICE_LAYER_TARGET_CYW30739=1",
"CHIP_DEVICE_LAYER_TARGET=CYW30739",
]
} else if (chip_device_platform == "webos") {
defines += [
"CHIP_DEVICE_LAYER_TARGET_WEBOS=1",
"CHIP_DEVICE_LAYER_TARGET=Linux",
"CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}",
]
defines -=
[ "CHIP_DEVICE_CONFIG_ENABLE_WPA=${chip_device_config_enable_wpa}" ]
}
}
} else {
Expand Down Expand Up @@ -348,6 +356,8 @@ if (chip_device_platform != "none") {
_platform_target = "P6"
} else if (chip_device_platform == "ameba") {
_platform_target = "Ameba"
} else if (chip_device_platform == "webos") {
_platform_target = "webos"
} else if (chip_device_platform == "fake") {
_platform_target = "fake"
} else if (chip_device_platform == "cyw30739") {
Expand Down
12 changes: 9 additions & 3 deletions src/platform/device.gni
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ if (chip_device_platform == "auto") {
chip_device_platform = "tizen"
} else if (current_os == "android") {
chip_device_platform = "android"
} else if (current_os == "webos") {
chip_device_platform = "webos"
} else {
chip_device_platform = "none"
}
Expand All @@ -55,7 +57,8 @@ declare_args() {
chip_enable_wifi =
chip_device_platform == "linux" || chip_device_platform == "esp32" ||
chip_device_platform == "mbed" || chip_device_platform == "tizen" ||
chip_device_platform == "android" || chip_device_platform == "ameba"
chip_device_platform == "android" || chip_device_platform == "ameba" ||
chip_device_platform == "webos"

# Enable ble support.
if (chip_device_platform == "fake") {
Expand All @@ -73,7 +76,7 @@ declare_args() {
# Select DNS-SD implementation
if (chip_device_platform == "linux" || chip_device_platform == "esp32" ||
chip_device_platform == "mbed" || chip_device_platform == "p6" ||
chip_device_platform == "ameba") {
chip_device_platform == "ameba" || chip_device_platform == "webos") {
chip_mdns = "minimal"
} else if (chip_device_platform == "darwin" ||
chip_device_platform == "cc13x2_26x2" || current_os == "android" ||
Expand Down Expand Up @@ -116,6 +119,8 @@ if (chip_device_platform == "cc13x2_26x2") {
_chip_device_layer = "Ameba"
} else if (chip_device_platform == "cyw30739") {
_chip_device_layer = "CYW30739"
} else if (chip_device_platform == "webos") {
_chip_device_layer = "webos"
}

if (chip_device_platform != "external") {
Expand Down Expand Up @@ -160,5 +165,6 @@ assert(
chip_device_platform == "k32w0" || chip_device_platform == "qpg" ||
chip_device_platform == "telink" || chip_device_platform == "mbed" ||
chip_device_platform == "p6" || chip_device_platform == "android" ||
chip_device_platform == "ameba" || chip_device_platform == "cyw30739",
chip_device_platform == "ameba" || chip_device_platform == "cyw30739" ||
chip_device_platform == "webos",
"Please select a valid value for chip_device_platform")
Loading

0 comments on commit 5332517

Please sign in to comment.