Skip to content

Commit

Permalink
Start the shell structure refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs committed Oct 23, 2024
1 parent bc3abb6 commit 21c86db
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 56 deletions.
2 changes: 1 addition & 1 deletion examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#endif

#ifdef ENABLE_CHIP_SHELL
#include "matter_shell.h"
#include "MatterShell.h"
#endif

#ifdef HEAP_MONITORING
Expand Down
22 changes: 2 additions & 20 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,6 @@ source_set("test-event-trigger") {
]
}

source_set("matter-shell") {
if (chip_build_libshell) {
defines = [ "ENABLE_CHIP_SHELL" ]

sources = [ "${silabs_common_plat_dir}/matter_shell.cpp" ]
include_dirs = [
".",
"${silabs_common_plat_dir}",
]

public_deps = [
"${chip_root}/examples/shell/shell_common:shell_common",
"${chip_root}/src/lib/shell:shell",
"${chip_root}/src/lib/shell:shell_core",
]
}
}

config("siwx917-common-config") {
defines = [ "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_sec}" ]

Expand Down Expand Up @@ -226,10 +208,10 @@ source_set("siwx917-common") {
}

if (chip_build_libshell) {
deps += [ ":matter-shell" ]
deps += [ "${silabs_common_plat_dir}/shell:matter" ]

if (chip_enable_icd_server) {
deps += [ "${chip_root}/examples/platform/silabs/icd:shell" ]
deps += [ "${silabs_common_plat_dir}/shell:icd" ]
}
}

Expand Down
22 changes: 2 additions & 20 deletions examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,6 @@ source_set("openthread_core_config_efr32_chip_examples") {
}
}

source_set("matter-shell") {
if (chip_build_libshell) {
defines = [ "ENABLE_CHIP_SHELL" ]

sources = [ "${silabs_common_plat_dir}/matter_shell.cpp" ]
include_dirs = [
".",
"${silabs_common_plat_dir}",
]

public_deps = [
"${chip_root}/examples/shell/shell_common:shell_common",
"${chip_root}/src/lib/shell:shell",
"${chip_root}/src/lib/shell:shell_core",
]
}
}

config("efr32-common-config") {
defines = [ "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_sec}" ]

Expand Down Expand Up @@ -294,10 +276,10 @@ source_set("efr32-common") {
}

if (chip_build_libshell) {
deps += [ ":matter-shell" ]
deps += [ "${silabs_common_plat_dir}/shell:matter" ]

if (chip_enable_icd_server) {
public_deps += [ "${silabs_common_plat_dir}/icd:shell" ]
deps += [ "${silabs_common_plat_dir}/shell:icd" ]
}
}

Expand Down
32 changes: 20 additions & 12 deletions examples/platform/silabs/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,34 @@ import("//build_overrides/efr32_sdk.gni")
import("${chip_root}/src/app/icd/icd.gni")
import("${chip_root}/third_party/silabs/silabs_board.gni")

# This is necessary since the BUILD.gn for both platforms are still split
shell_dependency_path = "${chip_root}/examples/platform/silabs/efr32"
if (use_SiWx917) {
shell_dependency_path = "${chip_root}/examples/platform/silabs/SiWx917"
}

config("shell-config") {
defines = [ "ENABLE_CHIP_SHELL" ]

include_dirs = [ "." ]
}

source_set("shell") {
# Common Matter Shell fines Silabs sample apps.
# This source_set needs to be added as a dependency to all sources_sets that implement shell commands
source_set("matter") {
sources = [
"ICDShellCommands.cpp",
"ICDShellCommands.h",
"MatterShell.cpp",
"MatterShell.h",
]

deps = [
"${chip_root}/src/app/icd/server:icd-server-config",
"${shell_dependency_path}:matter-shell",
public_deps = [
"${chip_root}/examples/shell/shell_common:shell_common",
"${chip_root}/src/lib/shell:shell",
"${chip_root}/src/lib/shell:shell_core",
]

public_configs = [ ":shell-config" ]
}

source_set("icd") {
sources = [
"ICDShellCommands.cpp",
"ICDShellCommands.h",
]

deps = [ ":matter" ]
}
2 changes: 1 addition & 1 deletion examples/platform/silabs/shell/MatterShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include "matter_shell.h"
#include "MatterShell.h"
#include "sl_component_catalog.h"
#include <ChipShellCollection.h>
#include <cmsis_os2.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/
#include "AppConfig.h"
#include "matter_shell.h"
#include "MatterShell.h"
#include <cmsis_os2.h>
#include <platform/CHIPDeviceLayer.h>
#include <sl_cmsis_os2_common.h>
Expand Down
6 changes: 6 additions & 0 deletions src/lib/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ static_library("shell") {
output_dir = "${root_out_dir}/lib"

sources = []
deps = []

if (chip_target_style == "unix") {
sources += [ "streamer_stdio.cpp" ]
Expand All @@ -57,9 +58,14 @@ static_library("shell") {
} else if (chip_device_platform == "efr32" ||
chip_device_platform == "SiWx917") {
sources += [
# Temporary workaround to prevent a circular dependecy while restructuring the silabs shell files
"${chip_root}/examples/platform/silabs/shell/MatterShell.h",
"MainLoopSilabs.cpp",
"streamer_silabs.cpp",
]

# Temporary workaround to prevent a circular dependecy while restructuring the silabs shell files
include_dirs = [ "${chip_root}/examples/platform/silabs/shell/" ]
} else if (chip_device_platform == "nxp") {
sources += [
"MainLoopDefault.cpp",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/shell/MainLoopSilabs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include "matter_shell.h"
#include "MatterShell.h"
#include "streamer.h"
#include <lib/shell/Engine.h>
#include <lib/support/CHIPMem.h>
Expand Down

0 comments on commit 21c86db

Please sign in to comment.