From 93af8754ecc0d0b19b55b3b2f7cb0f5e61e57284 Mon Sep 17 00:00:00 2001 From: Ledion Daja Date: Thu, 1 Feb 2024 08:32:04 +0100 Subject: [PATCH] modules: hal_ethos_u: add support for log level NONE Add support for log level NONE by disabling Ethos-U driver logging. Signed-off-by: Ledion Daja --- modules/hal_ethos_u/CMakeLists.txt | 5 ++++- modules/hal_ethos_u/Kconfig | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/hal_ethos_u/CMakeLists.txt b/modules/hal_ethos_u/CMakeLists.txt index 56455a21076..9de47e4457b 100644 --- a/modules/hal_ethos_u/CMakeLists.txt +++ b/modules/hal_ethos_u/CMakeLists.txt @@ -10,7 +10,10 @@ if(CONFIG_ARM_ETHOS_U AND CONFIG_MULTITHREADING) set(ETHOSU_LOG_SEVERITY_MAP err err warning info debug) list(LENGTH ETHOSU_LOG_SEVERITY_MAP ETHOSU_LOG_SEVERITY_MAP_LENGTH) - if (${CONFIG_ARM_ETHOS_U_LOG_LEVEL} LESS "${ETHOSU_LOG_SEVERITY_MAP_LENGTH}") + if (${CONFIG_ARM_ETHOS_U_LOG_LEVEL} EQUAL 0) + # The Ethos-U driver does not have a corresponding "none" log level. Disable logging instead. + set(ETHOSU_LOG_ENABLE OFF CACHE BOOL "") + elseif (${CONFIG_ARM_ETHOS_U_LOG_LEVEL} LESS "${ETHOSU_LOG_SEVERITY_MAP_LENGTH}") list(GET ETHOSU_LOG_SEVERITY_MAP ${CONFIG_ARM_ETHOS_U_LOG_LEVEL} ETHOSU_LOG_SEVERITY) set(ETHOSU_LOG_SEVERITY ${ETHOSU_LOG_SEVERITY} CACHE STRING "") else() diff --git a/modules/hal_ethos_u/Kconfig b/modules/hal_ethos_u/Kconfig index ddb2d0a8ed6..2c442de51a6 100644 --- a/modules/hal_ethos_u/Kconfig +++ b/modules/hal_ethos_u/Kconfig @@ -1,5 +1,5 @@ -# Copyright 2021-2022 Arm Limited and/or its affiliates -# +# SPDX-FileCopyrightText: Copyright 2021-2022, 2024 Arm Limited and/or its +# affiliates # SPDX-License-Identifier: Apache-2.0 config ARM_ETHOS_U @@ -45,6 +45,9 @@ choice "ARM_ETHOS_U_LOG_LEVEL_CHOICE" default ARM_ETHOS_U_LOG_LEVEL_WRN depends on STDOUT_CONSOLE +config ARM_ETHOS_U_LOG_LEVEL_NONE + bool "None" + config ARM_ETHOS_U_LOG_LEVEL_ERR bool "Error" @@ -65,6 +68,7 @@ endchoice config ARM_ETHOS_U_LOG_LEVEL int depends on STDOUT_CONSOLE + default 0 if ARM_ETHOS_U_LOG_LEVEL_NONE default 1 if ARM_ETHOS_U_LOG_LEVEL_ERR default 2 if ARM_ETHOS_U_LOG_LEVEL_WRN default 3 if ARM_ETHOS_U_LOG_LEVEL_INF