diff options
Diffstat (limited to 'meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0006-Platform-corstone1000-Add-common-platform-logger.patch')
-rw-r--r-- | meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0006-Platform-corstone1000-Add-common-platform-logger.patch | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0006-Platform-corstone1000-Add-common-platform-logger.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0006-Platform-corstone1000-Add-common-platform-logger.patch deleted file mode 100644 index a7c17abff7..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0006-Platform-corstone1000-Add-common-platform-logger.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 9545d9bb44f8fb5af438fb40cab7fefc95d5a9a4 Mon Sep 17 00:00:00 2001 -From: Mohamed Omar Asaker <mohamed.omarasaker@arm.com> -Date: Thu, 22 Dec 2022 09:24:50 +0000 -Subject: [PATCH 6/10] Platform:corstone1000: Add common platform logger - -platform_log defines log messages macros to be used by the platform code -It allows defining the module name to be added at the beginning of the log -message. -Based on build type PLAT_LOG_LEVEL is defined. -In case of Debug/RelWithDebInfo PLAT_LOG_LEVEL is defined to Debug level -else it is defined to OFF. - -usage in source file: -... -INFO("msg"); -ERROR("msg"); -WARN("msg"); -VERBOSE("msg"); -DBG("msg"); -... - -Signed-off-by: Mohamed Omar Asaker <mohamed.omarasaker@arm.com> -Upstream-Status: Pending [Not submitted to upstream yet] ---- - .../target/arm/corstone1000/CMakeLists.txt | 1 + - .../ext/target/arm/corstone1000/config.cmake | 4 +- - .../target/arm/corstone1000/platform_log.h | 60 +++++++++++++++++++ - 3 files changed, 64 insertions(+), 1 deletion(-) - create mode 100644 platform/ext/target/arm/corstone1000/platform_log.h - -diff --git a/platform/ext/target/arm/corstone1000/CMakeLists.txt b/platform/ext/target/arm/corstone1000/CMakeLists.txt -index 9db2864033..a120f39ea4 100644 ---- a/platform/ext/target/arm/corstone1000/CMakeLists.txt -+++ b/platform/ext/target/arm/corstone1000/CMakeLists.txt -@@ -152,6 +152,7 @@ target_compile_definitions(platform_bl2 - $<$<BOOL:${PLATFORM_IS_FVP}>:PLATFORM_IS_FVP> - $<$<BOOL:${TFM_S_REG_TEST}>:TFM_S_REG_TEST> - $<$<BOOL:${ENABLE_FWU_AGENT_DEBUG_LOGS}>:ENABLE_FWU_AGENT_DEBUG_LOGS> -+ PLAT_LOG_LEVEL=${PLAT_LOG_LEVEL} - ) - - # boot_hal_bl2.c is compiled as part of 'bl2' target and not inside -diff --git a/platform/ext/target/arm/corstone1000/config.cmake b/platform/ext/target/arm/corstone1000/config.cmake -index b71ca672f3..de0b4b64c1 100644 ---- a/platform/ext/target/arm/corstone1000/config.cmake -+++ b/platform/ext/target/arm/corstone1000/config.cmake -@@ -63,6 +63,8 @@ set(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE ON CACHE BOOL "Enable Inte - - if (${CMAKE_BUILD_TYPE} STREQUAL Debug OR ${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo) - set(ENABLE_FWU_AGENT_DEBUG_LOGS TRUE CACHE BOOL "Enable Firmware update agent debug logs.") --else() -+ set(PLAT_LOG_LEVEL 4 CACHE STRING "Set platform log level.") -+ else() - set(ENABLE_FWU_AGENT_DEBUG_LOGS FALSE CACHE BOOL "Enable Firmware update agent debug logs.") -+ set(PLAT_LOG_LEVEL 0 CACHE STRING "Set platform log level.") - endif() -diff --git a/platform/ext/target/arm/corstone1000/platform_log.h b/platform/ext/target/arm/corstone1000/platform_log.h -new file mode 100644 -index 0000000000..b3a6e98026 ---- /dev/null -+++ b/platform/ext/target/arm/corstone1000/platform_log.h -@@ -0,0 +1,60 @@ -+/* -+ * Copyright (c) 2023, Arm Limited. All rights reserved. -+ * -+ * SPDX-License-Identifier: BSD-3-Clause -+ * -+ */ -+ -+#ifndef __PLATFORM_LOG_H__ -+#define __PLATFORM_LOG_H__ -+ -+#define PLAT_LOG_LEVEL_OFF (0) -+#define PLAT_LOG_LEVEL_ERROR (1) -+#define PLAT_LOG_LEVEL_WARN (2) -+#define PLAT_LOG_LEVEL_INFO (3) -+#define PLAT_LOG_LEVEL_DEBUG (4) -+ -+#ifndef PLAT_LOG_MODULE_NAME -+#define MODULE_NAME_STR " " -+#else -+#define MODULE_NAME_STR "["PLAT_LOG_MODULE_NAME"]: " -+#endif -+ -+#ifndef PLAT_LOG_LEVEL -+#warning "Logging level is not defined, default is PLAT_LOG_LEVEL_ERROR." -+#define PLAT_LOG_LEVEL PLAT_LOG_LEVEL_ERROR -+#endif -+ -+ -+/* System can override PRINTF with other rich format function*/ -+#ifndef PRINTF -+#if PLAT_LOG_LEVEL > PLAT_LOG_LEVEL_OFF -+#include <stdio.h> -+#define PRINTF printf -+#endif -+#endif -+ -+#if PLAT_LOG_LEVEL >= PLAT_LOG_LEVEL_ERROR -+ #define ERROR(f_, ...) do { PRINTF("\033[31;4m[ERR]:\033[m%s"f_"\r\n", MODULE_NAME_STR, ##__VA_ARGS__); } while (0) -+#else -+ #define ERROR(f_, ...) do { } while(0) -+#endif -+#if PLAT_LOG_LEVEL >= PLAT_LOG_LEVEL_WARN -+ #define WARN(f_, ...) do { PRINTF("\033[33;4m[WRN]:\033[m%s"f_"\r\n", MODULE_NAME_STR, ##__VA_ARGS__); } while (0) -+#else -+ #define WARN(f_, ...) do { } while(0) -+#endif -+#if PLAT_LOG_LEVEL >= PLAT_LOG_LEVEL_INFO -+ #define INFO(f_, ...) do { PRINTF("[INF]:%s"f_"\r\n", MODULE_NAME_STR, ##__VA_ARGS__); } while (0) -+#else -+ #define INFO(f_, ...) do { } while(0) -+#endif -+#if PLAT_LOG_LEVEL >= PLAT_LOG_LEVEL_DEBUG -+ #define VERBOSE(f_, ...) do { PRINTF("[DBG]:%s" f_"\r\n",MODULE_NAME_STR, ##__VA_ARGS__); } while (0) -+ #define DEBUG(f_, ...) do { PRINTF("[DBG]:%s" f_"\r\n",MODULE_NAME_STR, ##__VA_ARGS__); } while (0) -+#else -+ #define VERBOSE(f_, ...) do { } while(0) -+ #define DEBUG(f_, ...) do { } while(0) -+#endif -+ -+#endif /* __PLATFORM_LOG_H__ */ --- -2.25.1 - |