Skip to content

Commit 700475f

Browse files
authored
Merge branch 'master' into UpdateTIApplications_OTA_Documentation
2 parents 2993b0d + 57fc697 commit 700475f

File tree

162 files changed

+1144
-617
lines changed

Some content is hidden

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

162 files changed

+1144
-617
lines changed

.github/workflows/examples-linux-tv-casting-app.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- name: Build Linux tv-casting-app
6262
run: |
6363
./scripts/run_in_build_env.sh \
64-
"scripts/examples/gn_build_example.sh examples/tv-casting-app/linux/ out/tv-casting-app"
64+
"scripts/examples/gn_build_example.sh examples/tv-casting-app/linux/ out/tv-casting-app chip_casting_simplified=true"
6565
6666
- name: Test casting from Linux tv-casting-app to Linux tv-app
6767
run: |

build/chip/chip_test_suite.gni

+5-2
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,12 @@ template("chip_test_suite") {
9494

9595
deps = [ dir_pw_unit_test ]
9696

97-
if (current_os != "zephyr" && current_os != "mbed") {
97+
if (current_os != "zephyr" && current_os != "mbed" &&
98+
chip_device_platform != "efr32") {
9899
# Depend on stdio logging, and have it take precedence over the default platform backend
99-
public_deps += [ "${chip_root}/src/platform/logging:force_stdio" ]
100+
public_deps += [ "${chip_root}/src/platform/logging:stdio" ]
101+
} else {
102+
public_deps += [ "${chip_root}/src/platform/logging:default" ]
100103
}
101104
}
102105
if (chip_link_tests) {

build/chip/tests.gni

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ import("//build_overrides/chip.gni")
1818
import("${chip_root}/build/chip/tools.gni")
1919
import("${chip_root}/src/platform/device.gni")
2020

21+
declare_args() {
22+
# Build monolithic test library.
23+
chip_monolithic_tests = false
24+
}
25+
2126
declare_args() {
2227
# Enable building tests.
2328
chip_build_tests = current_os != "freertos"

config/common/cmake/chip_gn.cmake

+6-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ macro(matter_build target)
7777
LIB_PW_RPC
7878
LIB_MBEDTLS
7979
DEVICE_INFO_EXAMPLE_PROVIDER
80+
FORCE_LOGGING_STDIO
8081
)
8182
set(multiValueArgs GN_DEPENDENCIES)
8283

@@ -85,7 +86,11 @@ macro(matter_build target)
8586
set(MATTER_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib)
8687

8788
# Prepare Matter libraries that the application should be linked with
88-
set(MATTER_LIBRARIES -lCHIP)
89+
if (FORCE_LOGGING_STDIO)
90+
set(MATTER_LIBRARIES -lCHIPWithStdioLogging)
91+
else()
92+
set(MATTER_LIBRARIES -lCHIP)
93+
endif()
8994

9095
if (ARG_LIB_MBEDTLS)
9196
list(APPEND MATTER_LIBRARIES -lmbedtls)

config/openiotsdk/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ matter_build(chip
7979
LIB_SHELL ${CONFIG_CHIP_LIB_SHELL}
8080
LIB_TESTS ${CONFIG_CHIP_LIB_TESTS}
8181
GN_DEPENDENCIES ${CONFIG_GN_DEPENDENCIES}
82+
FORCE_LOGGING_STDIO ${CONFIG_CHIP_FORCE_LOGGING_STDIO}
8283
)
8384

8485
target_link_libraries(chip INTERFACE

config/openiotsdk/cmake/chip.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ set(CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS "" CACHE STRING "")
2727
set(CONFIG_CHIP_LIB_TESTS NO CACHE BOOL "")
2828
set(CONFIG_CHIP_LIB_SHELL NO CACHE BOOL "")
2929

30+
set(CONFIG_CHIP_FORCE_LOGGING_STDIO NO CACHE BOOL "Enable stdio logging backend")
3031
set(CONFIG_CHIP_DETAIL_LOGGING YES CACHE BOOL "Enable logging at detail level")
3132
set(CONFIG_CHIP_PROGRESS_LOGGING YES CACHE BOOL "Enable logging at progress level")
3233
set(CONFIG_CHIP_AUTOMATION_LOGGING YES CACHE BOOL "Enable logging at automation level")

examples/air-purifier-app/cc32xx/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ ti_simplelink_executable("air-purifier_app") {
100100
"${chip_root}/examples/air-purifier-app/air-purifier-common",
101101
"${chip_root}/examples/platform/cc32xx:cc32xx-attestation-credentials",
102102
"${chip_root}/src/lib",
103+
"${chip_root}/src/platform/logging:default",
103104
"${chip_root}/src/setup_payload",
104105
]
105106

examples/all-clusters-app/asr/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ asr_executable("clusters_app") {
108108
"${chip_root}/examples/common/QRCode",
109109
"${chip_root}/examples/providers:device_info_provider",
110110
"${chip_root}/src/lib",
111+
"${chip_root}/src/platform/logging:default",
111112
"${chip_root}/src/setup_payload",
112113
]
113114

examples/all-clusters-app/cc13x4_26x4/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ ti_simplelink_executable("all-clusters-app") {
9696
"${chip_root}/examples/all-clusters-app/all-clusters-common",
9797
"${chip_root}/examples/platform/cc13x4_26x4:cc13x4_26x4-attestation-credentials",
9898
"${chip_root}/src/lib",
99+
"${chip_root}/src/platform/logging:default",
99100
"${chip_root}/third_party/openthread:openthread",
100101
]
101102
defines = []

examples/all-clusters-app/infineon/psoc6/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ psoc6_executable("clusters_app") {
138138
"${chip_root}/examples/common/QRCode",
139139
"${chip_root}/examples/providers:device_info_provider",
140140
"${chip_root}/src/lib",
141+
"${chip_root}/src/platform/logging:default",
141142
"${chip_root}/src/setup_payload",
142143
]
143144

examples/all-clusters-app/nxp/mw320/BUILD.gn

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ mw320_executable("shell_mw320") {
6363
"${chip_root}/src/setup_payload",
6464
]
6565

66-
deps = [ "${chip_root}/src/platform:syscalls_stub" ]
66+
deps = [
67+
"${chip_root}/src/platform:syscalls_stub",
68+
"${chip_root}/src/platform/logging:default",
69+
]
6770

6871
include_dirs = [
6972
"${chip_root}/src/platform/nxp/mw320",

examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn

+8-2
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,12 @@ rt_executable("all_cluster_app") {
168168
"${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp",
169169
"${common_example_dir}/icd/source/ICDUtil.cpp",
170170
"${common_example_dir}/matter_button/source/AppMatterButtonEmpty.cpp",
171-
"${common_example_dir}/matter_cli/source/AppMatterCli.cpp",
172171
]
173172

174-
deps = [ "${chip_root}/examples/${app_common_folder}" ]
173+
deps = [
174+
"${chip_root}/examples/${app_common_folder}",
175+
"${chip_root}/src/platform/logging:default",
176+
]
175177

176178
sources += [
177179
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
@@ -185,6 +187,10 @@ rt_executable("all_cluster_app") {
185187
"${chip_root}/examples/shell/shell_common:shell_common",
186188
"${chip_root}/src/lib/shell:shell",
187189
]
190+
sources += [
191+
"${common_example_dir}/matter_cli/source/AppCLIBase.cpp",
192+
"${common_example_dir}/matter_cli/source/AppCLIFreeRTOS.cpp",
193+
]
188194
}
189195

190196
if (chip_enable_ota_requestor) {

examples/all-clusters-minimal-app/asr/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ asr_executable("clusters_minimal_app") {
9494
"${chip_root}/examples/common/QRCode",
9595
"${chip_root}/examples/providers:device_info_provider",
9696
"${chip_root}/src/lib",
97+
"${chip_root}/src/platform/logging:default",
9798
"${chip_root}/src/setup_payload",
9899
]
99100

examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ psoc6_executable("clusters_minimal_app") {
126126
"${chip_root}/examples/common/QRCode",
127127
"${chip_root}/examples/providers:device_info_provider",
128128
"${chip_root}/src/lib",
129+
"${chip_root}/src/platform/logging:default",
129130
"${chip_root}/src/setup_payload",
130131
]
131132

examples/bridge-app/asr/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ asr_executable("bridge_app") {
9595
"${chip_root}/examples/common/QRCode",
9696
"${chip_root}/examples/providers:device_info_provider",
9797
"${chip_root}/src/lib",
98+
"${chip_root}/src/platform/logging:default",
9899
"${chip_root}/src/setup_payload",
99100
]
100101

examples/chef/silabs/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ silabs_executable("chef_app") {
9494
deps = [
9595
":chef-common",
9696
":sdk",
97+
"${chip_root}/src/platform/logging:default",
9798
"${examples_plat_dir}:efr32-common",
9899
]
99100

examples/chip-tool/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ executable("chip-tool") {
132132

133133
deps = [
134134
":chip-tool-utils",
135-
"${chip_root}/src/platform/logging:force_stdio",
135+
"${chip_root}/src/platform/logging:stdio",
136136
]
137137

138138
output_dir = root_out_dir

examples/common/tracing/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ executable("chip-trace-decoder") {
120120

121121
output_dir = root_out_dir
122122

123-
deps = [ "${chip_root}/src/platform/logging:force_stdio" ]
123+
deps = [ "${chip_root}/src/platform/logging:stdio" ]
124124

125125
public_deps = [
126126
"${chip_root}/src/lib",

examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ k32w0_executable("contact_sensor_app") {
114114
"${chip_root}/examples/providers:device_info_provider",
115115
"${chip_root}/src/lib",
116116
"${chip_root}/src/platform:syscalls_stub",
117+
"${chip_root}/src/platform/logging:default",
117118
"${chip_root}/third_party/mbedtls:mbedtls",
118119
"${k32w0_platform_dir}/app/support:freertos_mbedtls_utils",
119120
]

examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ k32w1_executable("contact_sensor_app") {
110110
"${chip_root}/examples/providers:device_info_provider",
111111
"${chip_root}/src/lib",
112112
"${chip_root}/src/platform:syscalls_stub",
113+
"${chip_root}/src/platform/logging:default",
113114
"${chip_root}/third_party/mbedtls:mbedtls",
114115
"${k32w1_platform_dir}/app/support:freertos_mbedtls_utils",
115116
]

examples/dishwasher-app/asr/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ asr_executable("dishwasher_app") {
9292
"${chip_root}/examples/dishwasher-app/dishwasher-common",
9393
"${chip_root}/examples/providers:device_info_provider",
9494
"${chip_root}/src/lib",
95+
"${chip_root}/src/platform/logging:default",
9596
"${chip_root}/src/setup_payload",
9697
]
9798

examples/fabric-admin/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ executable("fabric-admin") {
157157

158158
deps = [
159159
":fabric-admin-utils",
160-
"${chip_root}/src/platform/logging:force_stdio",
160+
"${chip_root}/src/platform/logging:stdio",
161161
]
162162

163163
output_dir = root_out_dir

examples/laundry-washer-app/nxp/common/main/AppTask.cpp

+58-49
Original file line numberDiff line numberDiff line change
@@ -29,80 +29,87 @@
2929

3030
#ifdef ENABLE_CHIP_SHELL
3131
#include <lib/shell/Engine.h>
32-
32+
#include <map>
3333
using namespace chip::Shell;
34+
#define MATTER_CLI_LOG(message) (streamer_printf(streamer_get(), message))
3435
#endif /* ENABLE_CHIP_SHELL */
3536

3637
using namespace chip;
3738
using namespace chip::app::Clusters;
3839

3940
app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate;
4041

41-
CHIP_ERROR cliOpState(int argc, char * argv[])
42+
#ifdef ENABLE_CHIP_SHELL
43+
const static std::map<std::string, uint8_t> map_cmd_errstate{
44+
{ "no_error", (uint8_t) OperationalState::ErrorStateEnum::kNoError },
45+
{ "unable_to_start_or_resume", (uint8_t) OperationalState::ErrorStateEnum::kUnableToStartOrResume },
46+
{ "unable_to_complete_operation", (uint8_t) OperationalState::ErrorStateEnum::kUnableToCompleteOperation },
47+
{ "command_invalid_in_state", (uint8_t) OperationalState::ErrorStateEnum::kCommandInvalidInState }
48+
};
49+
50+
const static std::map<std::string, uint8_t> map_cmd_opstate{ { "stop", (uint8_t) OperationalState::OperationalStateEnum::kStopped },
51+
{ "run", (uint8_t) OperationalState::OperationalStateEnum::kRunning },
52+
{ "pause", (uint8_t) OperationalState::OperationalStateEnum::kPaused },
53+
{ "error",
54+
(uint8_t) OperationalState::OperationalStateEnum::kError } };
55+
56+
static void InvalidStateHandler(void)
4257
{
43-
if ((argc != 1) && (argc != 2))
44-
{
45-
ChipLogError(Shell, "Target State is missing");
46-
return CHIP_ERROR_INVALID_ARGUMENT;
47-
}
48-
if (!strcmp(argv[0], "stop"))
58+
ChipLogError(Shell, "Invalid State/Error to set");
59+
MATTER_CLI_LOG("Invalid. Supported commands are:\n");
60+
for (auto const & it : map_cmd_opstate)
4961
{
50-
ChipLogDetail(Shell, "OpSState : Set to %s state", argv[0]);
51-
OperationalState::GetOperationalStateInstance()->SetOperationalState(
52-
to_underlying(OperationalState::OperationalStateEnum::kStopped));
62+
MATTER_CLI_LOG(("\t opstate " + it.first + "\n").c_str());
5363
}
54-
else if (!strcmp(argv[0], "run"))
64+
for (auto const & it : map_cmd_errstate)
5565
{
56-
ChipLogDetail(Shell, "OpSState : Set to %s state", argv[0]);
57-
OperationalState::GetOperationalStateInstance()->SetOperationalState(
58-
to_underlying(OperationalState::OperationalStateEnum::kRunning));
66+
MATTER_CLI_LOG(("\t opstate error " + it.first + "\n").c_str());
5967
}
60-
else if (!strcmp(argv[0], "pause"))
68+
}
69+
70+
static CHIP_ERROR cliOpState(int argc, char * argv[])
71+
{
72+
bool inputErr = false;
73+
if ((argc != 1) && (argc != 2))
6174
{
62-
ChipLogDetail(Shell, "OpSState : Set to %s state", argv[0]);
63-
OperationalState::GetOperationalStateInstance()->SetOperationalState(
64-
to_underlying(OperationalState::OperationalStateEnum::kPaused));
75+
inputErr = true;
76+
goto exit;
6577
}
66-
else if (!strcmp(argv[0], "error"))
78+
79+
if (map_cmd_opstate.find(argv[0]) != map_cmd_opstate.end())
6780
{
68-
OperationalState::Structs::ErrorStateStruct::Type err;
81+
OperationalState::GetOperationalStateInstance()->SetOperationalState(map_cmd_opstate.at(argv[0]));
6982
ChipLogDetail(Shell, "OpSState : Set to %s state", argv[0]);
70-
if (!strcmp(argv[1], "no_error"))
71-
{
72-
ChipLogDetail(Shell, "OpSState_error : Error: %s state", argv[1]);
73-
err.errorStateID = (uint8_t) OperationalState::ErrorStateEnum::kNoError;
74-
}
75-
else if (!strcmp(argv[1], "unable_to_start_or_resume"))
76-
{
77-
ChipLogDetail(Shell, "OpSState_error : Error: %s state", argv[1]);
78-
err.errorStateID = (uint8_t) OperationalState::ErrorStateEnum::kUnableToStartOrResume;
79-
}
80-
else if (!strcmp(argv[1], "unable_to_complete_operation"))
81-
{
82-
ChipLogDetail(Shell, "OpSState_error : Error: %s state", argv[1]);
83-
err.errorStateID = (uint8_t) OperationalState::ErrorStateEnum::kUnableToCompleteOperation;
84-
}
85-
else if (!strcmp(argv[1], "command_invalid_in_state"))
86-
{
87-
ChipLogDetail(Shell, "OpSState_error : Error: %s state", argv[1]);
88-
err.errorStateID = (uint8_t) OperationalState::ErrorStateEnum::kCommandInvalidInState;
89-
}
90-
else
83+
if (!strcmp(argv[0], "error") && argc == 2)
9184
{
92-
ChipLogError(Shell, "Invalid Error State to set");
93-
return CHIP_ERROR_INVALID_ARGUMENT;
85+
OperationalState::Structs::ErrorStateStruct::Type err;
86+
if (map_cmd_errstate.find(argv[1]) != map_cmd_errstate.end())
87+
{
88+
ChipLogDetail(Shell, "OpSState_error : Set to %s state", argv[1]);
89+
err.errorStateID = map_cmd_errstate.at(argv[1]);
90+
OperationalState::GetOperationalStateInstance()->OnOperationalErrorDetected(err);
91+
}
92+
else
93+
{
94+
inputErr = true;
95+
goto exit;
96+
}
9497
}
95-
OperationalState::GetOperationalStateInstance()->OnOperationalErrorDetected(err);
96-
OperationalState::GetOperationalStateInstance()->SetOperationalState(
97-
to_underlying(OperationalState::OperationalStateEnum::kError));
9898
}
9999
else
100100
{
101-
ChipLogError(Shell, "Invalid State to set");
101+
inputErr = true;
102+
}
103+
exit:
104+
if (inputErr)
105+
{
106+
InvalidStateHandler();
102107
return CHIP_ERROR_INVALID_ARGUMENT;
103108
}
109+
104110
return CHIP_NO_ERROR;
105111
}
112+
#endif /* ENABLE_CHIP_SHELL */
106113

107114
void LaundryWasherApp::AppTask::PreInitMatterStack()
108115
{
@@ -121,7 +128,9 @@ void LaundryWasherApp::AppTask::AppMatter_RegisterCustomCliCommands()
121128
#ifdef ENABLE_CHIP_SHELL
122129
/* Register application commands */
123130
static const shell_command_t kCommands[] = {
124-
{ .cmd_func = cliOpState, .cmd_name = "opstate", .cmd_help = "Set the Operational State" },
131+
{ .cmd_func = cliOpState,
132+
.cmd_name = "opstate",
133+
.cmd_help = "Set the Operational State. Usage:[stop|run|pause|dock|error 'state'] " },
125134
};
126135
Engine::Root().RegisterCommands(kCommands, sizeof(kCommands) / sizeof(kCommands[0]));
127136
#endif

examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn

+8-2
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,12 @@ rt_executable("laundry-washer") {
169169
"${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp",
170170
"${common_example_dir}/icd/source/ICDUtil.cpp",
171171
"${common_example_dir}/matter_button/source/AppMatterButtonEmpty.cpp",
172-
"${common_example_dir}/matter_cli/source/AppMatterCli.cpp",
173172
]
174173

175-
deps = [ "${chip_root}/examples/${app_common_folder}" ]
174+
deps = [
175+
"${chip_root}/examples/${app_common_folder}",
176+
"${chip_root}/src/platform/logging:default",
177+
]
176178

177179
sources += [
178180
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
@@ -190,6 +192,10 @@ rt_executable("laundry-washer") {
190192
"${chip_root}/examples/shell/shell_common:shell_common",
191193
"${chip_root}/src/lib/shell:shell",
192194
]
195+
sources += [
196+
"${common_example_dir}/matter_cli/source/AppCLIBase.cpp",
197+
"${common_example_dir}/matter_cli/source/AppCLIFreeRTOS.cpp",
198+
]
193199
}
194200

195201
if (chip_enable_ota_requestor) {

0 commit comments

Comments
 (0)