tfm: Add BL2 log level configuration and disable it with TFM silent conf

Add choice for BL2 log level configuration.
Silence TF-M BL2 logging when TF-M is configured to be silent.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2023-10-26 10:57:30 +02:00 committed by Carles Cufí
commit 96c5052733
2 changed files with 34 additions and 0 deletions

View file

@ -101,6 +101,25 @@ if (CONFIG_BUILD_WITH_TFM)
list(APPEND TFM_CMAKE_ARGS -DTFM_EXCEPTION_INFO_DUMP=OFF)
endif()
if (CONFIG_TFM_BL2)
if (CONFIG_TFM_BL2_LOG_LEVEL_DEBUG)
set(TFM_BL2_LOG_LEVEL "DEBUG")
elseif (CONFIG_TFM_BL2_LOG_LEVEL_INFO)
set(TFM_BL2_LOG_LEVEL "INFO")
elseif (CONFIG_TFM_BL2_LOG_LEVEL_WARNING)
set(TFM_BL2_LOG_LEVEL "WARNING")
elseif (CONFIG_TFM_BL2_LOG_LEVEL_ERROR)
set(TFM_BL2_LOG_LEVEL "ERROR")
elseif (CONFIG_TFM_BL2_LOG_LEVEL_OFF OR CONFIG_TFM_LOG_LEVEL_SILENCE)
set(TFM_BL2_LOG_LEVEL "OFF")
endif()
if (DEFINED TFM_BL2_LOG_LEVEL)
# BL2 uses MCUBOOT_LOG_LEVEL configuration
list(APPEND TFM_CMAKE_ARGS -DMCUBOOT_LOG_LEVEL=${TFM_BL2_LOG_LEVEL})
endif()
endif()
if (CONFIG_TFM_PARTITION_LOG_LEVEL_DEBUG)
set(TFM_PARTITION_LOG_LEVEL "TFM_PARTITION_LOG_LEVEL_DEBUG")
elseif (CONFIG_TFM_PARTITION_LOG_LEVEL_INFO)

View file

@ -397,6 +397,21 @@ config ROM_START_OFFSET
needs to be updated if TF-M switches to use a different header
size for BL2.
choice TFM_BL2_LOG_LEVEL
prompt "BL2 Log Level" if !TFM_LOG_LEVEL_SILENCE
default TFM_BL2_LOG_LEVEL_INFO
config TFM_BL2_LOG_LEVEL_DEBUG
bool "Debug"
config TFM_BL2_LOG_LEVEL_INFO
bool "Info"
config TFM_BL2_LOG_LEVEL_WARNING
bool "Warning"
config TFM_BL2_LOG_LEVEL_ERROR
bool "Error"
config TFM_BL2_LOG_LEVEL_OFF
bool "Off"
endchoice
endif # !TFM_BL2
# Option to instruct flashing a merged binary consisting of BL2 (optionally),