Skip to content

Commit

Permalink
Add Tizen OS port (#8988)
Browse files Browse the repository at this point in the history
* Add Tizen OS chip platform

The platform supports the following features:
- Bluetooth
- WiFi
- Mdns
- Key/Value store
The integration with network is made with the Tizen API

* Add Tizen OS target config/build files

* Add example build files based on Tizen OS

* Integrate Tizen OS into chip build system

* Add workflow to build Tizen OS examples

* Add VSCode task to build Tizen OS examples

* Add tizen.py to build Tizen OS examples

replace gn_tizen_example.sh to build_exmaples.py
remove unused gn_tizen_example.sh

* Apply restyle script

* Apply comments

* Change tizen.py

* Add tizen toolchain

* Rename tizen_home to tizen_sdk and apply comments

* Modify lib/ files full path

* Modify sysroot setting logic
  • Loading branch information
wootak-jung authored Sep 13, 2021
1 parent 5a9c063 commit e945d16
Show file tree
Hide file tree
Showing 43 changed files with 2,491 additions and 10 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/examples-tizen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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.

name: Build example - Tizen

on:
push:
pull_request:

jobs:
tizen:
name: Tizen
env:
BUILD_TYPE: tizen

runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-tizen:latest
options: --user root
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
- "/tmp/output_binaries:/tmp/output_binaries"

steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Build example Tizen lighting app
run:
scripts/run_in_build_env.sh "./scripts/build/build_examples.py --platform tizen build"
3 changes: 2 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@
"nrf",
"qpg",
"infineon",
"telink"
"telink",
"tizen"
],
"default": "build"
},
Expand Down
3 changes: 3 additions & 0 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ if (_chip_defaults.custom_toolchain != "") {
} else if (target_os == "ios") {
_default_toolchain =
"${_build_overrides.build_root}/toolchain/ios:ios_${target_cpu}"
} else if (target_os == "tizen") {
_default_toolchain =
"${_build_overrides.build_root}/toolchain/tizen:tizen_${target_cpu}"
} else {
assert(false, "No toolchain specified, please specify custom_toolchain")
}
Expand Down
4 changes: 2 additions & 2 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ config("warnings_common") {
}

if (current_os != "mac" && current_os != "ios" && current_os != "linux" &&
current_os != "win") {
current_os != "win" && current_os != "tizen") {
cflags += [ "-Wstack-usage=8192" ]
}
}
Expand Down Expand Up @@ -268,7 +268,7 @@ config("runtime_default") {
"$dir_pw_toolchain/host_clang:xcode_sysroot",
]
}
if (current_os == "linux") {
if (current_os == "linux" || current_os == "tizen") {
libs = [
"dl",
"pthread",
Expand Down
22 changes: 22 additions & 0 deletions build/toolchain/tizen/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

import("tizen_toolchain.gni")

tizen_toolchain("tizen_arm") {
toolchain_args = {
current_cpu = "arm"
arm_arch = "armv7-a"
}
}
36 changes: 36 additions & 0 deletions build/toolchain/tizen/tizen_toolchain.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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.

import("//build_overrides/build.gni")

import("${build_root}/config/sysroot.gni")
import("${build_root}/toolchain/gcc_toolchain.gni")

template("tizen_toolchain") {
_invoker_toolchain_args = invoker.toolchain_args

_tizen_toolchain_args = {
current_os = "tizen"
is_clang = true

forward_variables_from(_invoker_toolchain_args, "*")
}

gcc_toolchain(target_name) {
toolchain_args = _tizen_toolchain_args
ar = "$sysroot/bin/arm-linux-gnueabi-ar"
cc = "$sysroot/bin/arm-linux-gnueabi-gcc"
cxx = "$sysroot/bin/arm-linux-gnueabi-g++"
}
}
36 changes: 36 additions & 0 deletions config/tizen/chip-gn/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

import("${build_root}/chip/tests.gni")

assert(current_os == "tizen")

declare_args() {
chip_build_pw_rpc_lib = false
}

group("tizen") {
deps = [ "${chip_root}/src/lib" ]

if (chip_build_tests) {
deps += [ "${chip_root}/src:tests" ]
}
}

group("default") {
deps = [ ":tizen" ]
}
27 changes: 27 additions & 0 deletions config/tizen/chip-gn/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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.

import("//build_overrides/chip.gni")

declare_args() {
# Location of the Tizen SDK.
tizen_sdk_root = ""
}

chip_device_platform = "tizen"

chip_build_tests = false

chip_inet_config_enable_raw_endpoint = false
chip_inet_config_enable_dns_resolver = false
80 changes: 80 additions & 0 deletions config/tizen/chip-gn/platform/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/tizen.gni")
import("${chip_root}/config/tizen/chip-gn/args.gni")

import("${build_root}/config/linux/pkg_config.gni")
import("${chip_root}/src/platform/device.gni")

pkg_config("dlog") {
packages = [ "dlog" ]
}

pkg_config("capi-appfw-preference") {
packages = [ "capi-appfw-preference" ]
}

pkg_config("glib") {
packages = [
"glib-2.0",
"gio-unix-2.0",
]
}

if (chip_mdns == "platform") {
pkg_config("nsd-dns-sd") {
packages = [ "nsd-dns-sd" ]
}
}

if (chip_enable_wifi) {
pkg_config("capi-network-wifi-manager") {
packages = [ "capi-network-wifi-manager" ]
}
pkg_config("capi-network-softap") {
packages = [ "capi-network-softap" ]
}
}

if (chip_enable_ble) {
pkg_config("capi-network-bluetooth") {
packages = [ "capi-network-bluetooth" ]
}
}

source_set("tizen") {
public_configs = [
":dlog",
":glib",
":capi-appfw-preference",
]

if (chip_mdns == "platform") {
public_configs += [ ":nsd-dns-sd" ]
}

if (chip_enable_wifi) {
public_configs += [
":capi-network-wifi-manager",
":capi-network-softap",
]
}

if (chip_enable_ble) {
public_configs += [ ":capi-network-bluetooth" ]
}
}
88 changes: 88 additions & 0 deletions config/tizen/scripts/install_sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash

ROOTSTRAP_PATH="$1"
CHIPROOT=$(git rev-parse --show-toplevel)

NSD_DNS_LIBS="libnsd-dns-sd.so*"

echo "$ROOTSTRAP_PATH"

if [ -z "$ROOTSTRAP_PATH" ]; then
echo "ROOTSTRAP_PATH should be input"
exit 1
fi

if [[ ! -d $ROOTSTRAP_PATH ]]; then
echo "Can't find the rootstrap dir, please make dir and run this script again"
exit 1
fi

cd "$ROOTSTRAP_PATH"

# Get Tizen rootstrap
if [[ ! -f mobile-6.0-rs-device.core_0.0.123_ubuntu-64.zip ]]; then
echo "Getting tizen rootstrap..."
wget http://download.tizen.org/sdk/tizenstudio/official/binary/mobile-6.0-rs-device.core_0.0.123_ubuntu-64.zip
fi
unzip mobile-6.0-rs-device.core_0.0.123_ubuntu-64.zip
mv data/platforms/tizen-6.0/mobile/rootstraps/mobile-6.0-device.core/usr .
mv data/platforms/tizen-6.0/mobile/rootstraps/mobile-6.0-device.core/lib .

# Clean files
rm -rf data
rm -rf mobile-6.0-rs-device.*
rm pkginfo.manifest

# Copy internal dns-sd header into rootstrap
# After finishing ACR for internal APIs, we will remove this.

rm "$ROOTSTRAP_PATH/usr/lib/$NSD_DNS_LIBS"

# Get tizen packages
function download_pkg() {
if [ "$2" = "snapshots" ]; then
wget -r -nd --no-parent -A "$1" "http://download.tizen.org/snapshots/tizen/unified/latest/repos/standard/packages/armv7l/"
else
wget -r -nd --no-parent -A "$1" "http://download.tizen.org/releases/milestone/tizen/${2:-base}/latest/repos/standard/packages/armv7l/"
fi
}

# Base package
for pkg in 'pcre-devel-*.armv7l.rpm' 'libffi-devel-*.armv7l.rpm' 'libmount-devel-*.armv7l.rpm' \
'libblkid-devel-*.armv7l.rpm' 'libcap-*.armv7l.rpm' 'liblzma-*.armv7l.rpm'; do
download_pkg "$pkg"
done

# Unified package
for pkg in 'vconf-compat-*.armv7l.rpm' 'libcynara-commons-*.armv7l.rpm' 'cynara-devel-*.armv7l.rpm' \
'libcynara-client-*.armv7l.rpm' 'dbus-1*.armv7l.rpm' 'dbus-devel-*.armv7l.rpm' \
'dbus-libs-1*.armv7l.rpm' 'glib2-devel-2*.armv7l.rpm' 'libdns_sd-*.armv7l.rpm' \
'buxton2-*.armv7l.rpm' 'libsystemd-*.armv7l.rpm'; do
download_pkg "$pkg" unified
done

# Latest snapshots package (For nsd)
for pkg in 'capi-network-nsd-0*.armv7l.rpm' 'capi-network-nsd-devel*.armv7l.rpm' 'libnsd-dns-sd*.armv7l.rpm' 'libdns_sd-*.armv7l.rpm'; do
download_pkg "$pkg" snapshots
done

unrpm *.rpm

cp usr/lib/pkgconfig/openssl1.1.pc usr/lib/pkgconfig/openssl.pc

rm usr/lib/libdns_sd.so
cp usr/lib/libdns_sd.so.878.* usr/lib/libdns_sd.so

rm *.rpm

# Get toolchain
wget http://download.tizen.org/sdk/tizenstudio/official/binary/cross-arm-gcc-9.2_0.1.9_ubuntu-64.zip
unzip cross-arm-gcc-9.2_0.1.9_ubuntu-64.zip

cp -rf data/tools/arm-linux-gnueabi-gcc-9.2/* .

rm pkginfo.manifest
rm changelog
rm -rf data

rm cross-arm-gcc-9.2_0.1.9_ubuntu-64.zip
18 changes: 18 additions & 0 deletions examples/build_overrides/tizen.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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() {
# Root directory for tizen.
tizen_root = "//third_party/connectedhomeip/config/tizen/chip-gn/platform"
}
Loading

0 comments on commit e945d16

Please sign in to comment.