Hi,
I'm developing my log system in a project with a secure partition with TF-M. I am following this log system design document. In my project I have, as a test, the following code:
SPMLOG_DBGMSG("SPMLOG_DBGMSG\r\n"); SPMLOG_ERRMSG("SPMLOG_ERRMSG\r\n"); LOG_ERRFMT("LOG_ERRFMT\r\n");
I can use the SPM Log System functions (SPMLOG_DBGMSG and SPMLOG_ERRMSG) successfully. However, I would like to be able to add a color format to the output, to make the error messages to be displayed in red. As you can see, it has default color:
But i would like to print something like this:
I understand that with Partition Log System I will be able to color it. However, when I use LOG_ERRFMT (from Partition Log System), I get the following error:
undefined reference to `LOG_ERRFMT'
I suppose that some include may be missing, but I don't know which one. Is there a way to use LOG_ERRFMT or change the color of SPM_LOG_ERRMSG messages? If there is a third way to display colored log error messages in TF-M, that would also work for me.
Thanks in advance,
Pablo
Useful information about the project:
- I'm using the nRF5340DK development kit.
- nRF SDK v2.0.0
- The project is based on the example: TF-M Secure Partition Sample.
- I'm building with "Enable debug options" option enabled
Project configuration (prj.conf):
#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
CONFIG_BUILD_WITH_TFM=y
CONFIG_TFM_PROFILE_TYPE_NOT_SET=y
CONFIG_LOG=y
CONFIG_LOG_BUFFER_SIZE=2048
CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD=0
# DEBUG
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_DEFAULT_LEVEL=4
#CONFIG_LOG_PRINTK=y
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_DEBUG_THREAD_INFO=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_ASSERT=y
CONFIG_NO_OPTIMIZATIONS=y
CONFIG_THREAD_NAME=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_SHOW_COLOR=y
CONFIG_TFM_SPM_LOG_LEVEL_ERROR=y
CONFIG_TFM_PARTITION_LOG_LEVEL_DEBUG=y
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_HEAP_MEM_POOL_SIZE=49152