Skip to content

Commit

Permalink
Merge branch 'master' into chef-robotic-vacuum-cleaner-326681447
Browse files Browse the repository at this point in the history
  • Loading branch information
stingchang authored May 14, 2024
2 parents 3008435 + 3219a5f commit 0e89480
Show file tree
Hide file tree
Showing 109 changed files with 15,573 additions and 2,908 deletions.
1 change: 1 addition & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ NTP
nullable
nullptr
NUM
NuttX
NVM
NVS
nwdiag
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/examples-nuttx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright (c) 2024 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 - NuttX

on:
push:
pull_request:
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
cancel-in-progress: true

env:
CHIP_NO_LOG_TIMESTAMPS: true

jobs:
nuttx:
name: NuttX

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

container:
image: ghcr.io/project-chip/chip-build-nuttx:51
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout submodules & Bootstrap
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: nuttx
extra-submodule-parameters: " --recursive"
- name: Build example simulator NuttX Lighting App
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target nuttx-x64-light \
build \
"
7 changes: 6 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
--skip-dir platform/webos \
--skip-dir platform/Zephyr \
--skip-dir test_driver \
--skip-dir platform/NuttX \
--known-failure app/app-platform/ContentApp.cpp \
--known-failure app/app-platform/ContentApp.h \
--known-failure app/app-platform/ContentAppPlatform.cpp \
Expand Down Expand Up @@ -118,6 +119,10 @@ jobs:
--known-failure app/util/DataModelHandler.h \
--known-failure app/util/ember-compatibility-functions.cpp \
--known-failure app/util/ember-compatibility-functions.h \
--known-failure app/util/ember-global-attribute-access-interface.cpp \
--known-failure app/util/ember-global-attribute-access-interface.h \
--known-failure app/util/ember-io-storage.cpp \
--known-failure app/util/ember-io-storage.h \
--known-failure app/util/endpoint-config-api.h \
--known-failure app/util/generic-callbacks.h \
--known-failure app/util/generic-callback-stubs.cpp \
Expand Down Expand Up @@ -205,7 +210,7 @@ jobs:
# TODO: TLVDebug should ideally not be excluded here.
# TODO: protocol_decoder.cpp should ideally not be excluded here.
# TODO: PersistentStorageMacros.h should ideally not be excluded here.
git grep -I -n "PRI.64" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)examples/chip-tool' ':(exclude)examples/tv-casting-app' ':(exclude)src/app/MessageDef/MessageDefHelper.cpp' ':(exclude)src/app/tests/integration/chip_im_initiator.cpp' ':(exclude)src/lib/core/TLVDebug.cpp' ':(exclude)src/lib/dnssd/tests/TestTxtFields.cpp' ':(exclude)src/lib/format/protocol_decoder.cpp' ':(exclude)src/lib/support/PersistentStorageMacros.h' ':(exclude)src/messaging/tests/echo/echo_requester.cpp' ':(exclude)src/platform/Linux' ':(exclude)src/platform/Ameba' ':(exclude)src/platform/ESP32' ':(exclude)src/platform/Darwin' ':(exclude)src/darwin' ':(exclude)src/platform/webos' ':(exclude)zzz_generated/chip-tool' ':(exclude)src/tools/chip-cert/Cmd_PrintCert.cpp' && exit 1 || exit 0
git grep -I -n "PRI.64" -- './*' ':(exclude).github/workflows/lint.yml' ':(exclude)examples/chip-tool' ':(exclude)examples/tv-casting-app' ':(exclude)src/app/MessageDef/MessageDefHelper.cpp' ':(exclude)src/app/tests/integration/chip_im_initiator.cpp' ':(exclude)src/lib/core/TLVDebug.cpp' ':(exclude)src/lib/dnssd/tests/TestTxtFields.cpp' ':(exclude)src/lib/format/protocol_decoder.cpp' ':(exclude)src/lib/support/PersistentStorageMacros.h' ':(exclude)src/messaging/tests/echo/echo_requester.cpp' ':(exclude)src/platform/Linux' ':(exclude)src/platform/Ameba' ':(exclude)src/platform/ESP32' ':(exclude)src/platform/Darwin' ':(exclude)src/darwin' ':(exclude)src/platform/webos' ':(exclude)zzz_generated/chip-tool' ':(exclude)src/tools/chip-cert/Cmd_PrintCert.cpp' ':(exclude)src/platform/NuttX' && exit 1 || exit 0
# git grep exits with 0 if it finds a match, but we want
# to fail (exit nonzero) on match. And we want to exclude this file,
Expand Down
14 changes: 13 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@
"${workspaceFolder}/src/lib/**",
"${workspaceFolder}/src/system/**",
"${workspaceFolder}/third_party/nlassert/repo/include/**",
"${workspaceFolder}/third_party/nlio/repo/include/**"
"${workspaceFolder}/third_party/nlio/repo/include/**",
"${workspaceFolder}/darwin/Framework/CHIP/**",
"${workspaceFolder}/src/messaging/**",
"${workspaceFolder}/src/protocols/**",
"${workspaceFolder}/src/tracing/**",
"${workspaceFolder}/src/transport/**",
"${workspaceFolder}/src/inet/**",
"${workspaceFolder}/src/credentials/**",
"${workspaceFolder}/src/data_model/**",
"${workspaceFolder}/src/app/**",
"${workspaceFolder}/src/crytpo/**",
"${workspaceFolder}/src/platform/**"
],
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
Expand All @@ -35,6 +46,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.associations": {
"*.mm": "cpp",
"iostream": "cpp",
"array": "cpp",
"atomic": "cpp",
Expand Down
5 changes: 5 additions & 0 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ config("strict_warnings") {

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

if (current_os == "nuttx") {
cflags -= [ "-Wshadow" ]
cflags_cc -= [ "-Wnon-virtual-dtor" ]
}

configs = []
ldflags = []

Expand Down
29 changes: 29 additions & 0 deletions config/nuttx/chip-gn/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2024 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")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
target_cpu = ""
target_os = "nuttx"

import("${chip_root}/config/nuttx/chip-gn/args.gni")
}
57 changes: 57 additions & 0 deletions config/nuttx/chip-gn/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright (c) 2024 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("${chip_root}/build/chip/tests.gni")

assert(current_os == "nuttx")

declare_args() {
chip_build_example_providers = false
chip_example_lighting = false
}

static_library("nuttx") {
output_name = "libchipnuttx"

public_deps = [
"${chip_root}/examples/platform/linux:app-main",
"${chip_root}/src/lib",
]

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

if (chip_build_example_providers) {
public_deps += [ "${chip_root}/examples/providers:device_info_provider" ]
}

if (chip_example_lighting) {
public_deps += [
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/examples/lighting-app/lighting-common:lighting-manager",
]
}

output_dir = "${root_out_dir}/lib"

complete_static_lib = true
}

group("default") {
deps = [ ":nuttx" ]
}
32 changes: 32 additions & 0 deletions config/nuttx/chip-gn/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2024 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("${chip_root}/src/crypto/crypto.gni")

chip_device_platform = "nuttx"

chip_build_tests = false

chip_project_config_include = ""
chip_system_project_config_include = ""
chip_ble_project_config_include = ""

chip_crypto = "mbedtls"
chip_external_mbedtls = true

custom_toolchain = "${chip_root}/config/nuttx/chip-gn/toolchain:nuttx"

pw_build_PIP_CONSTRAINTS = [ "${chip_root}/scripts/setup/constraints.txt" ]
33 changes: 33 additions & 0 deletions config/nuttx/chip-gn/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) 2024 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/toolchain/gcc_toolchain.gni")
import("//build_overrides/build.gni")

declare_args() {
nuttx_ar = ""
nuttx_cc = ""
nuttx_cxx = ""
}

gcc_toolchain("nuttx") {
ar = nuttx_ar
cc = nuttx_cc
cxx = nuttx_cxx

toolchain_args = {
current_os = "nuttx"
is_clang = false
}
}
2 changes: 1 addition & 1 deletion examples/lighting-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void ApplicationShutdown()
}
}

int main(int argc, char * argv[])
extern "C" int main(int argc, char * argv[])
{
if (ChipLinuxAppInit(argc, argv) != 0)
{
Expand Down
1 change: 1 addition & 0 deletions examples/tv-app/android/java/LevelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ void LevelManager::PostLevelChanged(chip::EndpointId endpoint, uint8_t value)

jboolean LevelManager::SetLevel(jint endpoint, jint value)
{
chip::DeviceLayer::StackLock stack;
chip::Protocols::InteractionModel::Status status = app::Clusters::LevelControl::Attributes::CurrentLevel::Set(
static_cast<chip::EndpointId>(endpoint), static_cast<uint8_t>(value));
return status == chip::Protocols::InteractionModel::Status::Success;
Expand Down
18 changes: 18 additions & 0 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from builders.mbed import MbedApp, MbedBoard, MbedBuilder, MbedProfile
from builders.mw320 import MW320App, MW320Builder
from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder
from builders.nuttx import NuttXApp, NuttXBoard, NuttXBuilder
from builders.nxp import NxpApp, NxpBoard, NxpBuilder
from builders.openiotsdk import OpenIotSdkApp, OpenIotSdkBuilder, OpenIotSdkCryptoBackend
from builders.qpg import QpgApp, QpgBoard, QpgBuilder
Expand Down Expand Up @@ -324,6 +325,22 @@ def BuildNrfTarget():
return target


def BuildNuttXTarget():
target = BuildTarget('nuttx', NuttXBuilder)

# Boards
target.AppendFixedTargets([
TargetPart('x64', board=NuttXBoard.SIM),
])

# Apps
target.AppendFixedTargets([
TargetPart('light', app=NuttXApp.LIGHT),
])

return target


def BuildAndroidTarget():
target = BuildTarget('android', AndroidBuilder)

Expand Down Expand Up @@ -795,6 +812,7 @@ def BuildOpenIotSdkTargets():
BuildMW320Target(),
BuildNrfTarget(),
BuildNrfNativeTarget(),
BuildNuttXTarget(),
BuildQorvoTarget(),
BuildStm32Target(),
BuildTizenTarget(),
Expand Down
Loading

0 comments on commit 0e89480

Please sign in to comment.