Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choose logging backend on a per-target basis #32119

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions build/chip/chip_test_suite.gni
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ template("chip_test_suite") {

deps = [ dir_pw_unit_test ]

if (current_os != "zephyr" && current_os != "mbed") {
if (current_os != "zephyr" && current_os != "mbed" &&
chip_device_platform != "efr32") {
# Depend on stdio logging, and have it take precedence over the default platform backend
public_deps += [ "${chip_root}/src/platform/logging:force_stdio" ]
public_deps += [ "${chip_root}/src/platform/logging:stdio" ]
} else {
public_deps += [ "${chip_root}/src/platform/logging:default" ]
}
}
if (chip_link_tests) {
Expand Down
5 changes: 5 additions & 0 deletions build/chip/tests.gni
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import("//build_overrides/chip.gni")
import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/platform/device.gni")

declare_args() {
# Build monolithic test library.
chip_monolithic_tests = false
}

declare_args() {
# Enable building tests.
chip_build_tests = current_os != "freertos"
Expand Down
7 changes: 6 additions & 1 deletion config/common/cmake/chip_gn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ macro(matter_build target)
LIB_PW_RPC
LIB_MBEDTLS
DEVICE_INFO_EXAMPLE_PROVIDER
FORCE_LOGGING_STDIO
)
set(multiValueArgs GN_DEPENDENCIES)

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

# Prepare Matter libraries that the application should be linked with
set(MATTER_LIBRARIES -lCHIP)
if (FORCE_LOGGING_STDIO)
set(MATTER_LIBRARIES -lCHIPWithStdioLogging)
else()
set(MATTER_LIBRARIES -lCHIP)
endif()

if (ARG_LIB_MBEDTLS)
list(APPEND MATTER_LIBRARIES -lmbedtls)
Expand Down
1 change: 1 addition & 0 deletions config/openiotsdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ matter_build(chip
LIB_SHELL ${CONFIG_CHIP_LIB_SHELL}
LIB_TESTS ${CONFIG_CHIP_LIB_TESTS}
GN_DEPENDENCIES ${CONFIG_GN_DEPENDENCIES}
FORCE_LOGGING_STDIO ${CONFIG_CHIP_FORCE_LOGGING_STDIO}
)

target_link_libraries(chip INTERFACE
Expand Down
1 change: 1 addition & 0 deletions config/openiotsdk/cmake/chip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set(CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS "" CACHE STRING "")
set(CONFIG_CHIP_LIB_TESTS NO CACHE BOOL "")
set(CONFIG_CHIP_LIB_SHELL NO CACHE BOOL "")

set(CONFIG_CHIP_FORCE_LOGGING_STDIO NO CACHE BOOL "Enable stdio logging backend")
set(CONFIG_CHIP_DETAIL_LOGGING YES CACHE BOOL "Enable logging at detail level")
set(CONFIG_CHIP_PROGRESS_LOGGING YES CACHE BOOL "Enable logging at progress level")
set(CONFIG_CHIP_AUTOMATION_LOGGING YES CACHE BOOL "Enable logging at automation level")
Expand Down
1 change: 1 addition & 0 deletions examples/air-purifier-app/cc32xx/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ ti_simplelink_executable("air-purifier_app") {
"${chip_root}/examples/air-purifier-app/air-purifier-common",
"${chip_root}/examples/platform/cc32xx:cc32xx-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ asr_executable("clusters_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ ti_simplelink_executable("all-clusters-app") {
"${chip_root}/examples/all-clusters-app/all-clusters-common",
"${chip_root}/examples/platform/cc13x4_26x4:cc13x4_26x4-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/openthread:openthread",
]
defines = []
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/infineon/psoc6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ psoc6_executable("clusters_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
5 changes: 4 additions & 1 deletion examples/all-clusters-app/nxp/mw320/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ mw320_executable("shell_mw320") {
"${chip_root}/src/setup_payload",
]

deps = [ "${chip_root}/src/platform:syscalls_stub" ]
deps = [
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/src/platform/logging:default",
]

include_dirs = [
"${chip_root}/src/platform/nxp/mw320",
Expand Down
5 changes: 4 additions & 1 deletion examples/all-clusters-app/nxp/rt/rw61x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ rt_executable("all_cluster_app") {
"${common_example_dir}/matter_cli/source/AppMatterCli.cpp",
]

deps = [ "${chip_root}/examples/${app_common_folder}" ]
deps = [
"${chip_root}/examples/${app_common_folder}",
"${chip_root}/src/platform/logging:default",
]

sources += [
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-minimal-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ asr_executable("clusters_minimal_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ psoc6_executable("clusters_minimal_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/bridge-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ asr_executable("bridge_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/chef/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ silabs_executable("chef_app") {
deps = [
":chef-common",
":sdk",
"${chip_root}/src/platform/logging:default",
"${examples_plat_dir}:efr32-common",
]

Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ executable("chip-tool") {

deps = [
":chip-tool-utils",
"${chip_root}/src/platform/logging:force_stdio",
"${chip_root}/src/platform/logging:stdio",
]

output_dir = root_out_dir
Expand Down
2 changes: 1 addition & 1 deletion examples/common/tracing/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ executable("chip-trace-decoder") {

output_dir = root_out_dir

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

public_deps = [
"${chip_root}/src/lib",
Expand Down
1 change: 1 addition & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ k32w0_executable("contact_sensor_app") {
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w0_platform_dir}/app/support:freertos_mbedtls_utils",
]
Expand Down
1 change: 1 addition & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ k32w1_executable("contact_sensor_app") {
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w1_platform_dir}/app/support:freertos_mbedtls_utils",
]
Expand Down
1 change: 1 addition & 0 deletions examples/dishwasher-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ asr_executable("dishwasher_app") {
"${chip_root}/examples/dishwasher-app/dishwasher-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
2 changes: 1 addition & 1 deletion examples/fabric-admin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ executable("fabric-admin") {

deps = [
":fabric-admin-utils",
"${chip_root}/src/platform/logging:force_stdio",
"${chip_root}/src/platform/logging:stdio",
]

output_dir = root_out_dir
Expand Down
5 changes: 4 additions & 1 deletion examples/laundry-washer-app/nxp/rt/rw61x/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ rt_executable("laundry-washer") {
"${common_example_dir}/matter_cli/source/AppMatterCli.cpp",
]

deps = [ "${chip_root}/examples/${app_common_folder}" ]
deps = [
"${chip_root}/examples/${app_common_folder}",
"${chip_root}/src/platform/logging:default",
]

sources += [
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
Expand Down
1 change: 1 addition & 0 deletions examples/light-switch-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ asr_executable("light_switch_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/light-switch-app/genio/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ mt793x_executable("light_switch_app") {
"${chip_root}/examples/light-switch-app/light-switch-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
"${mt793x_examples_plat_dir}:genio-matter-shell",
]
Expand Down
1 change: 1 addition & 0 deletions examples/light-switch-app/infineon/cyw30739/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ template("matter_wpan_app") {

deps = [
"${chip_root}/examples/shell/shell_common:shell_common",
"${chip_root}/src/platform/logging:default",
app_data_model,
]

Expand Down
1 change: 1 addition & 0 deletions examples/light-switch-app/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ qpg_executable("light_switch_app") {
"${chip_root}/examples/light-switch-app/qpg/zap/",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
Expand Down
1 change: 1 addition & 0 deletions examples/light-switch-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ silabs_executable("light_switch_app") {
"${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc",
"${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
"${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
"${chip_root}/src/platform/logging:default",
]

if (wifi_soc) {
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ asr_executable("lighting_app") {
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/bouffalolab/bl602/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ bouffalolab_executable("lighting_app") {
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/bouffalolab/bl702/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ bouffalolab_executable("lighting_app") {
":sdk",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/bouffalolab/bl702l/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ bouffalolab_executable("lighting_app") {
":sdk",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ti_simplelink_executable("lighting_app") {
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/examples/platform/cc13x4_26x4:cc13x4_26x4-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/openthread:openthread",
]
defines = []
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/genio/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ mt793x_executable("lighting_app") {
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
"${mt793x_examples_plat_dir}:genio-matter-shell",
]
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/infineon/cyw30739/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ template("matter_wpan_app") {

deps = [
"${chip_root}/examples/shell/shell_common:shell_common",
"${chip_root}/src/platform/logging:default",
app_data_model,
]

Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/infineon/psoc6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ psoc6_executable("lighting_app") {
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ k32w0_executable("light_app") {
"${chip_root}/src/app:test-event-trigger",
"${chip_root}/src/lib",
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w0_platform_dir}/app/support:freertos_mbedtls_utils",
]
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/nxp/k32w/k32w1/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ k32w1_executable("light_app") {
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform:syscalls_stub",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w1_platform_dir}/app/support:freertos_mbedtls_utils",
]
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ qpg_executable("lighting_app") {
"${chip_root}/examples/lighting-app/qpg/zap/",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ silabs_executable("lighting_app") {

deps = [
":sdk",
"${chip_root}/src/platform/logging:default",
app_data_model,
]

Expand Down
4 changes: 4 additions & 0 deletions examples/lighting-app/stm32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ stm32_sdk("sdk") {
}

stm32_executable("lighting_app") {
deps = []

if (stm32_board == "STM32WB5MM-DK") {
output_name = "chip-stm32-lighting-example.elf"
include_dirs = [
Expand Down Expand Up @@ -118,6 +120,8 @@ stm32_executable("lighting_app") {
]
}

deps += [ "${chip_root}/src/platform/logging:default" ]

# Add the startup file to the target
sources += [ "${examples_plat_dir}/startup_files/startup_${stm32_mcu}.s" ]

Expand Down
1 change: 1 addition & 0 deletions examples/lit-icd-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ silabs_executable("lit_icd_app") {

deps = [
":sdk",
"${chip_root}/src/platform/logging:default",
app_data_model,
]

Expand Down
1 change: 1 addition & 0 deletions examples/lock-app/asr/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ asr_executable("lock_app") {
"${chip_root}/examples/lock-app/lock-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/src/setup_payload",
]

Expand Down
1 change: 1 addition & 0 deletions examples/lock-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ ti_simplelink_executable("lock_app") {
"${chip_root}/examples/lock-app/lock-common",
"${chip_root}/examples/platform/cc13x4_26x4:cc13x4_26x4-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/src/platform/logging:default",
"${chip_root}/third_party/openthread:openthread",
]
defines = []
Expand Down
Loading
Loading