Skip to content

Commit 3e9f59b

Browse files
authored
Merge branch 'project-chip:master' into feature/basic-app-install-flow
2 parents 5839b4a + 3219a5f commit 3e9f59b

File tree

107 files changed

+15561
-2908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+15561
-2908
lines changed

.github/.wordlist.txt

+1
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,7 @@ NTP
965965
nullable
966966
nullptr
967967
NUM
968+
NuttX
968969
NVM
969970
NVS
970971
nwdiag

.github/workflows/examples-nuttx.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright (c) 2024 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Build example - NuttX
16+
17+
on:
18+
push:
19+
pull_request:
20+
merge_group:
21+
workflow_dispatch:
22+
23+
concurrency:
24+
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
25+
cancel-in-progress: true
26+
27+
env:
28+
CHIP_NO_LOG_TIMESTAMPS: true
29+
30+
jobs:
31+
nuttx:
32+
name: NuttX
33+
34+
runs-on: ubuntu-latest
35+
if: github.actor != 'restyled-io[bot]'
36+
37+
container:
38+
image: ghcr.io/project-chip/chip-build-nuttx:51
39+
volumes:
40+
- "/tmp/bloat_reports:/tmp/bloat_reports"
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
- name: Checkout submodules & Bootstrap
45+
uses: ./.github/actions/checkout-submodules-and-bootstrap
46+
with:
47+
platform: nuttx
48+
extra-submodule-parameters: " --recursive"
49+
- name: Build example simulator NuttX Lighting App
50+
run: |
51+
./scripts/run_in_build_env.sh \
52+
"./scripts/build/build_examples.py \
53+
--target nuttx-x64-light \
54+
build \
55+
"

.github/workflows/lint.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ jobs:
9090
--skip-dir platform/webos \
9191
--skip-dir platform/Zephyr \
9292
--skip-dir test_driver \
93+
--skip-dir platform/NuttX \
9394
--known-failure app/app-platform/ContentApp.cpp \
9495
--known-failure app/app-platform/ContentApp.h \
9596
--known-failure app/app-platform/ContentAppPlatform.cpp \
@@ -118,6 +119,10 @@ jobs:
118119
--known-failure app/util/DataModelHandler.h \
119120
--known-failure app/util/ember-compatibility-functions.cpp \
120121
--known-failure app/util/ember-compatibility-functions.h \
122+
--known-failure app/util/ember-global-attribute-access-interface.cpp \
123+
--known-failure app/util/ember-global-attribute-access-interface.h \
124+
--known-failure app/util/ember-io-storage.cpp \
125+
--known-failure app/util/ember-io-storage.h \
121126
--known-failure app/util/endpoint-config-api.h \
122127
--known-failure app/util/generic-callbacks.h \
123128
--known-failure app/util/generic-callback-stubs.cpp \
@@ -205,7 +210,7 @@ jobs:
205210
# TODO: TLVDebug should ideally not be excluded here.
206211
# TODO: protocol_decoder.cpp should ideally not be excluded here.
207212
# TODO: PersistentStorageMacros.h should ideally not be excluded here.
208-
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
213+
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
209214
210215
# git grep exits with 0 if it finds a match, but we want
211216
# to fail (exit nonzero) on match. And we want to exclude this file,

.vscode/settings.json

+13-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,18 @@
1414
"${workspaceFolder}/src/lib/**",
1515
"${workspaceFolder}/src/system/**",
1616
"${workspaceFolder}/third_party/nlassert/repo/include/**",
17-
"${workspaceFolder}/third_party/nlio/repo/include/**"
17+
"${workspaceFolder}/third_party/nlio/repo/include/**",
18+
"${workspaceFolder}/darwin/Framework/CHIP/**",
19+
"${workspaceFolder}/src/messaging/**",
20+
"${workspaceFolder}/src/protocols/**",
21+
"${workspaceFolder}/src/tracing/**",
22+
"${workspaceFolder}/src/transport/**",
23+
"${workspaceFolder}/src/inet/**",
24+
"${workspaceFolder}/src/credentials/**",
25+
"${workspaceFolder}/src/data_model/**",
26+
"${workspaceFolder}/src/app/**",
27+
"${workspaceFolder}/src/crytpo/**",
28+
"${workspaceFolder}/src/platform/**"
1829
],
1930
"[cpp]": {
2031
"editor.defaultFormatter": "xaver.clang-format"
@@ -35,6 +46,7 @@
3546
"editor.defaultFormatter": "esbenp.prettier-vscode"
3647
},
3748
"files.associations": {
49+
"*.mm": "cpp",
3850
"iostream": "cpp",
3951
"array": "cpp",
4052
"atomic": "cpp",

build/config/compiler/BUILD.gn

+5
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ config("strict_warnings") {
271271

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

274+
if (current_os == "nuttx") {
275+
cflags -= [ "-Wshadow" ]
276+
cflags_cc -= [ "-Wnon-virtual-dtor" ]
277+
}
278+
274279
configs = []
275280
ldflags = []
276281

config/nuttx/chip-gn/.gn

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2024 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
import("//build_overrides/chip.gni")
17+
18+
# The location of the build configuration file.
19+
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
20+
21+
# CHIP uses angle bracket includes.
22+
check_system_includes = true
23+
24+
default_args = {
25+
target_cpu = ""
26+
target_os = "nuttx"
27+
28+
import("${chip_root}/config/nuttx/chip-gn/args.gni")
29+
}

config/nuttx/chip-gn/BUILD.gn

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) 2024 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/build.gni")
16+
import("//build_overrides/chip.gni")
17+
18+
import("${chip_root}/build/chip/tests.gni")
19+
20+
assert(current_os == "nuttx")
21+
22+
declare_args() {
23+
chip_build_example_providers = false
24+
chip_example_lighting = false
25+
}
26+
27+
static_library("nuttx") {
28+
output_name = "libchipnuttx"
29+
30+
public_deps = [
31+
"${chip_root}/examples/platform/linux:app-main",
32+
"${chip_root}/src/lib",
33+
]
34+
35+
if (chip_build_tests) {
36+
public_deps += [ "${chip_root}/src:tests" ]
37+
}
38+
39+
if (chip_build_example_providers) {
40+
public_deps += [ "${chip_root}/examples/providers:device_info_provider" ]
41+
}
42+
43+
if (chip_example_lighting) {
44+
public_deps += [
45+
"${chip_root}/examples/lighting-app/lighting-common",
46+
"${chip_root}/examples/lighting-app/lighting-common:lighting-manager",
47+
]
48+
}
49+
50+
output_dir = "${root_out_dir}/lib"
51+
52+
complete_static_lib = true
53+
}
54+
55+
group("default") {
56+
deps = [ ":nuttx" ]
57+
}

config/nuttx/chip-gn/args.gni

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) 2024 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/chip.gni")
16+
17+
import("${chip_root}/src/crypto/crypto.gni")
18+
19+
chip_device_platform = "nuttx"
20+
21+
chip_build_tests = false
22+
23+
chip_project_config_include = ""
24+
chip_system_project_config_include = ""
25+
chip_ble_project_config_include = ""
26+
27+
chip_crypto = "mbedtls"
28+
chip_external_mbedtls = true
29+
30+
custom_toolchain = "${chip_root}/config/nuttx/chip-gn/toolchain:nuttx"
31+
32+
pw_build_PIP_CONSTRAINTS = [ "${chip_root}/scripts/setup/constraints.txt" ]
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2024 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build/toolchain/gcc_toolchain.gni")
16+
import("//build_overrides/build.gni")
17+
18+
declare_args() {
19+
nuttx_ar = ""
20+
nuttx_cc = ""
21+
nuttx_cxx = ""
22+
}
23+
24+
gcc_toolchain("nuttx") {
25+
ar = nuttx_ar
26+
cc = nuttx_cc
27+
cxx = nuttx_cxx
28+
29+
toolchain_args = {
30+
current_os = "nuttx"
31+
is_clang = false
32+
}
33+
}

examples/lighting-app/linux/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void ApplicationShutdown()
9595
}
9696
}
9797

98-
int main(int argc, char * argv[])
98+
extern "C" int main(int argc, char * argv[])
9999
{
100100
if (ChipLinuxAppInit(argc, argv) != 0)
101101
{

scripts/build/build/targets.py

+18
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from builders.mbed import MbedApp, MbedBoard, MbedBuilder, MbedProfile
2828
from builders.mw320 import MW320App, MW320Builder
2929
from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder
30+
from builders.nuttx import NuttXApp, NuttXBoard, NuttXBuilder
3031
from builders.nxp import NxpApp, NxpBoard, NxpBuilder
3132
from builders.openiotsdk import OpenIotSdkApp, OpenIotSdkBuilder, OpenIotSdkCryptoBackend
3233
from builders.qpg import QpgApp, QpgBoard, QpgBuilder
@@ -324,6 +325,22 @@ def BuildNrfTarget():
324325
return target
325326

326327

328+
def BuildNuttXTarget():
329+
target = BuildTarget('nuttx', NuttXBuilder)
330+
331+
# Boards
332+
target.AppendFixedTargets([
333+
TargetPart('x64', board=NuttXBoard.SIM),
334+
])
335+
336+
# Apps
337+
target.AppendFixedTargets([
338+
TargetPart('light', app=NuttXApp.LIGHT),
339+
])
340+
341+
return target
342+
343+
327344
def BuildAndroidTarget():
328345
target = BuildTarget('android', AndroidBuilder)
329346

@@ -795,6 +812,7 @@ def BuildOpenIotSdkTargets():
795812
BuildMW320Target(),
796813
BuildNrfTarget(),
797814
BuildNrfNativeTarget(),
815+
BuildNuttXTarget(),
798816
BuildQorvoTarget(),
799817
BuildStm32Target(),
800818
BuildTizenTarget(),

0 commit comments

Comments
 (0)