Skip to content

Commit

Permalink
Pull request #120: Unify develop
Browse files Browse the repository at this point in the history
Merge in WMN_TOOLS/matter from unify_develop to silabs

Squashed commit of the following:

commit 13e9430082964ada7ea0478566c9a08f462ec1e9
Author: Anders Esbensen <[email protected]>
Date:   Wed Oct 5 14:19:01 2022 +0000

    Pull request project-chip#141: Added MSLA license file

    Merge in WMN_TOOLS/matter from feature/added_msla_license to unify_develop

    Squashed commit of the following:

    commit f458f8544ed79bb5692ec04dbe01db544f650826
    Author: Anders Esbensen <[email protected]>
    Date:   Wed Oct 5 16:00:50 2022 +0200

        Added MSLA license file

commit 2cdc42127cf9fa9677cdc4fec7768c2360e4af83
Author: Dennis Jensen <[email protected]>
Date:   Wed Oct 5 14:06:10 2022 +0000

    Pull request #130: UIC-2300: Node state monitor tests

    Merge in WMN_TOOLS/matter from feature/UIC-2300_Unit_test_matter_node_state_monitor to unify_develop

    Squashed commit of the following:

    commit e0523a5a0536970c1a8d344304f3db3f7cfc0737
    Author: Dennis Jensen <[email protected]>
    Date:   Wed Sep 28 12:17:28 2022 +0200

        UIC-2300: Node state monitor tests

        Changes:
        * Testing the node state monitor.
        * Made the node state monitor more fail safe.
        * Added a wrapper around ember interface.
        * Testing the wrapper interface is called properly.

commit b7048f3d8cb1e9f833e7748afacc356bfb35da66
Author: Kei Shirakizawa <[email protected]>
Date:   Wed Oct 5 13:45:02 2022 +0000

    Pull request project-chip#140: UIC-2462 contd.: Fix comments for GN files

    Merge in WMN_TOOLS/matter from feature/UIC-2462-fix-gn-files to unify_develop

    Squashed commit of the following:

    commit d996c149eb3b130f9b1e540f3197cd185781e389
    Author: Kei Shirakizawa <[email protected]>
    Date:   Wed Oct 5 15:31:26 2022 +0200

        UIC-2462 contd.: Fix comments for GN files

... and 23 more commits
  • Loading branch information
jsloth authored and jmartinez-silabs committed Jan 24, 2024
1 parent 57c9949 commit 935f76e
Show file tree
Hide file tree
Showing 76 changed files with 74,289 additions and 2,572 deletions.
70 changes: 68 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ def initWorkspaceAndScm()
sh 'git submodule set-url ./third_party/silabs/gecko_sdk https://stash.silabs.com/scm/embsw/gecko_sdk_release.git'

// Matter Init --Checkout relevant submodule
sh 'scripts/checkout_submodules.py --shallow --recursive --platform efr32'
sh 'scripts/checkout_submodules.py --shallow --recursive --platform efr32 linux'

dir('third_party/silabs/matter_support/matter/efr32'){
stash name: 'BootLoader', includes: 'bootloader_binaries/*.*'
}

sh 'du -sk'

}

dir(buildOverlayDir+'/matter-scripts'){
Expand All @@ -72,7 +74,14 @@ def initWorkspaceAndScm()
userRemoteConfigs : [[credentialsId: 'svc_gsdk',
url: 'https://stash.silabs.com/scm/wmn_sqa/sqa-tools.git']]]
}

dir(buildOverlayDir+"/overlay/unify"){
checkout scm: [$class: 'GitSCM',
branches: [[name: 'ver_1.2.1-103-g34db9516-unify-matter-bridge']],
extensions: [[$class: 'CloneOption', depth: 1, noTags: false, reference: '', shallow: true],
[$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true,
recursiveSubmodules: true, reference: '', shallow: true, trackingSubmodules: false]],
userRemoteConfigs: [[credentialsId: 'svc_gsdk', url: 'https://bitbucket-cph.silabs.com/scm/stash/uic/uic.git']]]
}
}

def runInWorkspace(Map args, Closure cl)
Expand Down Expand Up @@ -282,6 +291,58 @@ def buildChipTool()
}
}

def buildUnifyBridge()
{
actionWithRetry {
node(buildFarmLargeLabel)
{
def workspaceTmpDir = createWorkspaceOverlay(advanceStageMarker.getBuildStagesList(),
buildOverlayDir)
def dirPath = workspaceTmpDir + createWorkspaceOverlay.overlayMatterPath
def unifyCheckoutDir = workspaceTmpDir + "/overlay/unify"
def saveDir = 'matter/out/'
try {
def unify_bridge_docker = docker.image('nexus.silabs.net/unify-cache/unify-matter:1.0.1-armhf')
dir(dirPath)
{
unify_bridge_docker.inside("-u root -v${unifyCheckoutDir}:/unify")
{
withEnv(['PW_ENVIRONMENT_ROOT='+dirPath])
{
echo "Build libunify"
sh 'cd /unify && cmake -DCMAKE_INSTALL_PREFIX=$PWD/stage -GNinja -DCMAKE_TOOLCHAIN_FILE=../cmake/armhf_debian.cmake -B build_unify_armhf/ -S components'
sh 'cd /unify && cmake --build build_unify_armhf'
sh 'cd /unify && cmake --install build_unify_armhf --prefix $PWD/stage'

echo "Build Unify Matter Bridge"
sh 'rm -rf ./.environment'
sh 'git config --global --add safe.directory $(pwd)'
sh 'git config --global --add safe.directory $(pwd)/third_party/pigweed/repo'
dir ("silabs_examples/unify-matter-bridge/linux")
{
def out_path = "../../../out/silabs_examples/unify-matter-bridge/armhf_debian_buster"
def pkg_config_export = "export PKG_CONFIG_PATH=:/unify/stage/share/pkgconfig:/usr/lib/arm-linux-gnueabihf/pkgconfig"
sh "../../../scripts/run_in_build_env.sh \"${pkg_config_export}; gn gen ${out_path} --args='target_cpu=\\\"arm\\\"'\""
sh "../../../scripts/run_in_build_env.sh \"${pkg_config_export}; ninja -C ${out_path}\""
}
}
}
}
} catch (e) {
deactivateWorkspaceOverlay(advanceStageMarker.getBuildStagesList(),
workspaceTmpDir,
"matter",
'-name no-files')
throw e
}
deactivateWorkspaceOverlay(advanceStageMarker.getBuildStagesList(),
workspaceTmpDir,
saveDir,
'-name unify-matter-bridge')
}
}
}

def exportIoTReports()
{
actionWithRetry {
Expand Down Expand Up @@ -783,6 +844,11 @@ def pipeline()
{
advanceStageMarker()

//---------------------------------------------------------------------
// Build Unify Matter Bridge
//---------------------------------------------------------------------
parallelNodesBuild["Unify Matter Bridge"] = {this.buildUnifyBridge()}

//---------------------------------------------------------------------
// Build OpenThread Examples
//---------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions silabs_examples/unify-matter-bridge/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**Copyright 2022 Silicon Laboratories Inc. www.silabs.com**

The licensor of this software is Silicon Laboratories Inc. Your use of this
software is governed by the terms of Silicon Labs Master Software License
Agreement (MSLA) available at
www.silabs.com/about-us/legal/master-software-license-agreement. This software
is distributed to you in Source Code format and is governed by the sections of
the MSLA applicable to Source Code.
80 changes: 62 additions & 18 deletions silabs_examples/unify-matter-bridge/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,77 @@
ARG VERSION=latest
FROM connectedhomeip/chip-build:${VERSION}
FROM debian:buster

ENV DEBIAN_FRONTEND=noninteractive

SHELL ["/bin/bash", "-c"]

ARG ARCH="armhf"

ARG TARGET_DEPS="libavahi-client-dev libssl-dev libsystemd-dev libwrap0-dev uthash-dev \
libsqlite3-dev libedit-dev libyaml-cpp0.6 libmosquitto-dev\
libreadline-dev libncurses5-dev libncursesw5-dev libyaml-cpp-dev \
libboost-atomic-dev libboost-chrono-dev libboost-date-time-dev \
libboost-filesystem-dev libboost-regex-dev libboost-program-options-dev \
libboost-serialization-dev libboost-system-dev libboost-thread-dev \
libboost-log-dev procps libmbedtls-dev libglib2.0-dev"

ARG HOST_DEPS="ninja-build git git-lfs curl pkg-config \
ruby ruby-dev \
gcc g++ gdb-multiarch \
build-essential \
clang nlohmann-json3-dev \
libdbus-glib-1-dev libssl-dev libgirepository1.0-dev"

# configure additional arches in dpkg/apt
RUN for arch in ${ARCH} ; do \
dpkg --add-architecture $arch ; \
echo $arch ; \
done

RUN apt-get update \
&& apt-get install --no-install-recommends -y curl gnupg2 ca-certificates \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
${HOST_DEPS} \
$(for dep in ${TARGET_DEPS} ; do \
for arch in ${ARCH} ; do echo $dep:$arch ; done ; \
done) \
$(for arch in ${ARCH} ; do echo crossbuild-essential-${arch} ; done)\
&& rm -rf /var/lib/apt/lists/*

# Install python 3.9
RUN curl -L https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh --output /tmp/Miniconda.sh \
&& cd /tmp \
&& echo 78f39f9bae971ec1ae7969f0516017f2413f17796670f7040725dd83fcff5689 Miniconda.sh > /tmp/Miniconda.sh.sha256 \
&& sha256sum -c /tmp/Miniconda.sh.sha256 \
&& bash /tmp/Miniconda.sh -b -p /usr/local/miniconda \
&& /usr/local/miniconda/condabin/conda init bash \
&& ln -sf /usr/local/miniconda/bin/python3.9 /usr/bin/python3 \
&& ln -sf /usr/local/miniconda/bin/pip3 /usr/bin/pip3

# Rust Version to install
ENV RUST_VERSION=1.60.0
ENV RUST_VERSION=1.64.0
# Rust and Cargo home directories
ENV RUSTUP_HOME=/opt/rustup-home
ENV CARGO_HOME=/opt/cargo-home

# Install Rust and Cargo
RUN curl https://sh.rustup.rs -sSf --output /tmp/sh.rustup.rs \
&& cd /tmp && chmod +x sh.rustup.rs \
&& ./sh.rustup.rs -y --profile minimal --default-toolchain ${RUST_VERSION}\
&& if [[ $ARCH == *"armhf"* ]]; then export RUST_TRIPLES="$RUST_TRIPLES armv7-unknown-linux-gnueabihf"; fi \
&& if [[ $ARCH == *"amd64"* ]]; then export RUST_TRIPLES="$RUST_TRIPLES x86_64-unknown-linux-gnu"; fi \
&& ./sh.rustup.rs -y --profile minimal --target ${RUST_TRIPLES} --default-toolchain ${RUST_VERSION} \
&& rm /tmp/sh.rustup.rs \
&& /opt/cargo-home/bin/cargo install cargo2junit \
# remove the main branch reference once the maintainer tagged 81d73b4
&& /opt/cargo-home/bin/cargo install cargo-deb --git https://github.com/kornelski/cargo-deb.git --branch main \
&& chmod -R a+rw ${RUSTUP_HOME} ${CARGO_HOME} \
&& find ${RUSTUP_HOME} ${CARGO_HOME} -type d -exec chmod a+x {} \;
ENV PATH="${CARGO_HOME}/bin:${PATH}"

#Target dependencies
RUN apt update && \
apt install -y \
libsqlite3-dev libedit-dev libyaml-cpp0.6 libmosquitto-dev\
libyaml-cpp-dev \
libboost-atomic-dev libboost-chrono-dev libboost-date-time-dev \
libboost-filesystem-dev libboost-regex-dev libboost-program-options-dev \
libboost-serialization-dev libboost-system-dev libboost-thread-dev \
libboost-log-dev nlohmann-json3-dev

#Build host dependencies
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN apt install -y ruby ruby-dev
# Install cmake 1.19.2
RUN curl -L https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2-Linux-x86_64.sh --output /tmp/cmake-3.19.2-Linux-x86_64.sh \
&& cd /tmp \
&& echo 2fc84c1bd5a5fa8850426905a76147fbf897cf67ef324b009bcdb7eceafa9662 cmake-3.19.2-Linux-x86_64.sh > /tmp/cmake-3.19.2-Linux-x86_64.sh.sha256 \
&& sha256sum -c cmake-3.19.2-Linux-x86_64.sh.sha256 \
&& chmod +x /tmp/cmake*.sh \
&& /tmp/cmake*.sh --prefix=/usr/local --skip-license \
&& rm /tmp/cmake*
28 changes: 15 additions & 13 deletions silabs_examples/unify-matter-bridge/linux/.gn
Original file line number Diff line number Diff line change
@@ -1,18 +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.
# ******************************************************************************
# * # License
# * <b>Copyright 2022 Silicon Laboratories Inc. www.silabs.com</b>
# ******************************************************************************
# * The licensor of this software is Silicon Laboratories Inc. Your use of this
# * software is governed by the terms of Silicon Labs Master Software License
# * Agreement (MSLA) available at
# * www.silabs.com/about-us/legal/master-software-license-agreement. This
# * software is distributed to you in Source Code format and is governed by the
# * sections of the MSLA applicable to Source Code.
# *
# ******************************************************************************

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

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
Expand All @@ -21,5 +21,7 @@ buildconfig = "${build_root}/config/BUILDCONFIG.gn"
check_system_includes = true

default_args = {
pw_unit_test_AUTOMATIC_RUNNER = "$dir_pigweed/targets/host/run_test"

import("//args.gni")
}
65 changes: 54 additions & 11 deletions silabs_examples/unify-matter-bridge/linux/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,53 +1,96 @@
# ******************************************************************************
# * # License
# * <b>Copyright 2022 Silicon Laboratories Inc. www.silabs.com</b>
# ******************************************************************************
# * The licensor of this software is Silicon Laboratories Inc. Your use of this
# * software is governed by the terms of Silicon Labs Master Software License
# * Agreement (MSLA) available at
# * www.silabs.com/about-us/legal/master-software-license-agreement. This
# * software is distributed to you in Source Code format and is governed by the
# * sections of the MSLA applicable to Source Code.
# *
# ******************************************************************************

import("//build_overrides/chip.gni")
import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/build/chip/tests.gni")
import("${chip_root}/build/config/linux/pkg_config.gni")
import("${chip_root}/build/config/compiler/compiler.gni")

assert(chip_build_tools)

pkg_config("unify") {
packages = [ "libunify" ]
}

executable("unify-matter-bridge") {
config("unify-config") {
include_dirs = [
"src",
"src/cluster_translator",
"src/device_type_mapper",
"src/matter_node_state_monitor",
"src/matter_wrappers",
"include",
"zap-handlers/gen"
]

ldflags = [ "-lboost_system" ]

}

static_library("unify-matter-bridge-lib") {

sources = [
"src/matter_data_storage.cpp",
"src/attribute_state_cache.cpp",
"src/cluster_translator/bridged_device_basic_info_attribute_translator.cpp",
"src/cluster_translator/group_command_translator.cpp",
"src/cluster_translator/group_translator.cpp",
"src/cluster_translator/identify_attribute_translator.cpp",
"src/cluster_translator/identify_command_translator.cpp",

#"src/cluster_translator/level_attribute_translator.cpp",
#"src/cluster_translator/level_command_translator.cpp",
"src/cluster_translator/on_off_attribute_translator.cpp",
"src/cluster_translator/on_off_command_translator.cpp",
"src/demo_uic_cli.cpp",
"src/device_type_mapper/matter_device_translator.cpp",
"src/device_type_mapper/matter_device_types_clusters_list_updated.inc",
"src/dummy.cpp",
"src/matter_bridge_config.c",
"src/matter_bridge_main.cpp",
"src/matter_bridge_cli.cpp",
"src/matter_node_state_monitor/matter_cluster_interactor.cpp",
"src/matter_node_state_monitor/matter_endpoint_builder.cpp",
"src/matter_node_state_monitor/matter_node_state_monitor.cpp",
"zap-handlers/gen/command_translator.cpp",
"zap-handlers/gen/attribute_translator.cpp",
"zap-handlers/gen/unify_accessors.cpp",
"src/uic_mqtt_wrapper.cpp"
]

deps = [
public_deps = [
"${chip_root}/examples/platform/linux:app-main",
"//../unify-matter-bridge-common",
]
configs += [ ":unify" ]

output_dir = root_out_dir

public_configs = [ ":unify-config" , ":unify" ]

}

executable("unify-matter-bridge") {
sources = [
"src/matter_bridge_main.cpp",
]

deps = [
":unify-matter-bridge-lib"
]
}

group("linux") {
deps = [ ":unify-matter-bridge" ]
}


if (chip_build_tests) {
group("check") {
deps = [
"//src/tests",
]
}
}
Loading

0 comments on commit 935f76e

Please sign in to comment.