modules: hal_ethos_u: fix log configuration in CMake file

The core driver ETHOSU_LOG_SEVERITY CMake variable is a cache variable,
and thus will not be configured by the ETHOSU_LOG_SEVERITY CMake
variable of the hal_ethos_u module with local scope.
Change ETHOSU_LOG_SEVERITY local variable to be a cache var.

In addition, change condition test from LESS_EQUAL to LESS in order
to prevent an out-of-range index when accessing list variable.

Signed-off-by: Ledion Daja <ledion.daja@arm.com>
This commit is contained in:
Ledion Daja 2024-01-31 16:53:44 +01:00 committed by Carles Cufí
parent 4c25482ef6
commit 2fff293cc7

View file

@ -1,5 +1,5 @@
# Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
#
# SPDX-FileCopyrightText: <text>Copyright 2022, 2024 Arm Limited and/or its
# affiliates <open-source-office@arm.com></text>
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_ARM_ETHOS_U AND CONFIG_MULTITHREADING)
@ -10,10 +10,11 @@ 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_EQUAL "${ETHOSU_LOG_SEVERITY_MAP_LENGTH}")
if (${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()
set(ETHOSU_LOG_SEVERITY debug)
set(ETHOSU_LOG_SEVERITY debug CACHE STRING "")
endif()
add_subdirectory(${ZEPHYR_CURRENT_MODULE_DIR} ethos-u-core-driver)