From 5c7a73d47d142bbcb041a532d6d6288a8553a35b Mon Sep 17 00:00:00 2001 From: QuentinCaldeira-eaton <164154640+QuentinCaldeira-eaton@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:51:15 +0200 Subject: [PATCH] Missing log function in Zephyr standalone platform (#34413) * Add missing log option Signed-off-by: Caldeira, Quentin * Add missing logging Kconfig I've created this one with the previous PR, but I didn't see that it was ignored by .gitignore because I named it Kconfig.log, so rename it to Kconfig.logging Always with the purpose to separate each function in a dedicated Kconfig to source in your application, to avoid Kconfig warning, and let your prj.conf be application configuration only Signed-off-by: Caldeira, Quentin * Move CHIP_APP_LOG_LEVEL Because every zephyr's user seems to rely on the zephyr logging system, move the log declaration into the zephyr folder Signed-off-by: Caldeira, Quentin --------- Signed-off-by: Caldeira, Quentin --- config/nrfconnect/chip-module/Kconfig | 9 ----- config/nxp/chip-module/Kconfig | 9 ----- config/telink/chip-module/Kconfig | 9 ----- config/zephyr/Kconfig | 9 +++++ config/zephyr/chip-module/Kconfig.logging | 41 +++++++++++++++++++++++ 5 files changed, 50 insertions(+), 27 deletions(-) create mode 100644 config/zephyr/chip-module/Kconfig.logging diff --git a/config/nrfconnect/chip-module/Kconfig b/config/nrfconnect/chip-module/Kconfig index d4ccccd983ed3f..dcd26199f9a1a3 100644 --- a/config/nrfconnect/chip-module/Kconfig +++ b/config/nrfconnect/chip-module/Kconfig @@ -34,15 +34,6 @@ config CHIP_NRF_PLATFORM config CHIP_DEVICE_VENDOR_NAME default "Nordic Semiconductor ASA" -config CHIP_APP_LOG_LEVEL - int "Logging level in application" - default LOG_DEFAULT_LEVEL - depends on LOG - help - Sets the logging level in the Matter application. Use this configuration - option only within the application. To set the logging level for the - Matter stack, use the MATTER_LOG_LEVEL configuration option. - config CHIP_NFC_COMMISSIONING bool "Share onboarding payload in NFC tag" default n diff --git a/config/nxp/chip-module/Kconfig b/config/nxp/chip-module/Kconfig index ae95e1ce348f57..152d1161f9f435 100644 --- a/config/nxp/chip-module/Kconfig +++ b/config/nxp/chip-module/Kconfig @@ -30,15 +30,6 @@ config CHIP_NXP_PLATFORM config CHIP_DEVICE_VENDOR_NAME default "NXP Semiconductors" -config CHIP_APP_LOG_LEVEL - int "Logging level in application" - default LOG_DEFAULT_LEVEL - depends on LOG - help - Sets the logging level in the Matter application. Use this configuration - option only within the application. To set the logging level for the - Matter stack, use the MATTER_LOG_LEVEL configuration option. - config CHIP_EXAMPLE_DEVICE_INFO_PROVIDER bool "Include default device information provider build" default y diff --git a/config/telink/chip-module/Kconfig b/config/telink/chip-module/Kconfig index 46dc36b8973d77..d09f4534835ddf 100644 --- a/config/telink/chip-module/Kconfig +++ b/config/telink/chip-module/Kconfig @@ -22,15 +22,6 @@ if CHIP config CHIP_DEVICE_VENDOR_NAME default "Telink Semiconductor" -config CHIP_APP_LOG_LEVEL - int "Logging level in application" - default LOG_DEFAULT_LEVEL - depends on LOG - help - Sets the logging level in the Matter application. Use this configuration - option only within the application. To set the logging level for the - Matter stack, use the MATTER_LOG_LEVEL configuration option. - config CHIP_NFC_COMMISSIONING bool "Share onboarding payload in NFC tag" default n diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 95cea7cec1a707..fb06e106e29a38 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -42,6 +42,15 @@ menuconfig CHIP if CHIP +config CHIP_APP_LOG_LEVEL + int "Logging level in application" + default LOG_DEFAULT_LEVEL + depends on LOG + help + Sets the logging level in the Matter application. Use this configuration + option only within the application. To set the logging level for the + Matter stack, use the MATTER_LOG_LEVEL configuration option. + # Device and firmware identifers config CHIP_DEVICE_VENDOR_ID diff --git a/config/zephyr/chip-module/Kconfig.logging b/config/zephyr/chip-module/Kconfig.logging new file mode 100644 index 00000000000000..85cf1847a49cce --- /dev/null +++ b/config/zephyr/chip-module/Kconfig.logging @@ -0,0 +1,41 @@ +# +# Copyright (c) 2021 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. +# + +config LOG + default y + +if LOG + +choice LOG_MODE + default LOG_MODE_MINIMAL +endchoice + +choice MATTER_LOG_LEVEL_CHOICE + default MATTER_LOG_LEVEL_DBG +endchoice + +config CHIP_APP_LOG_LEVEL + default 4 # debug + +config LOG_DEFAULT_LEVEL + default 1 # error + +# disable synchronous printk to avoid blocking IRQs which +# may affect time sensitive components +config PRINTK_SYNC + default n + +endif # LOG \ No newline at end of file