diff --git a/cmake/SCPModuleTrace.cmake b/cmake/SCPModuleLogLocal.cmake similarity index 52% rename from cmake/SCPModuleTrace.cmake rename to cmake/SCPModuleLogLocal.cmake index eff6adc955e69d4d93330b3d7904c13ec8551259..9123245df90ff99f7e4f34ca53e1858039304e3f 100644 --- a/cmake/SCPModuleTrace.cmake +++ b/cmake/SCPModuleLogLocal.cmake @@ -1,6 +1,6 @@ # # Arm SCP/MCP Software -# Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -13,19 +13,19 @@ include(SCPPreprocessSource) # # .. command:: scp_module_trace # -# Checks if SCP_TRACE_ENABLE_MOD_` is set and enables `FWK_TRACE` +# Checks if SCP_LOG_ENABLE_MOD_` is set and enables `FWK_LOG_LOCAL` # -# .. cmake:: scp_module_trace() +# .. cmake:: scp_module_log() # -macro(scp_module_trace module_name) +macro(scp_module_log_local module_name) # Creates a module name tag moving to upper case and replacing `-` by `_`. string(TOUPPER ${module_name} SCP_MODULE_TAG) string(REPLACE "-" "_" SCP_MODULE_TAG ${SCP_MODULE_TAG}) - set(MOD_TRACE_ENABLE_FLAG "SCP_TRACE_ENABLE_MOD_${SCP_MODULE_TAG}") + set(MOD_LOG_ENABLE_FLAG "SCP_LOG_LOCAL_ENABLE_MOD_${SCP_MODULE_TAG}") # Checks if the enable flag is set. - if(${MOD_TRACE_ENABLE_FLAG}) - add_compile_definitions(PUBLIC FWK_TRACE_ENABLE) + if(${MOD_LOG_ENABLE_FLAG}) + add_compile_definitions(PUBLIC FWK_LOG_LOCAL_ENABLE) endif() endmacro() diff --git a/doc/framework.md b/doc/framework.md index 080e623652a65bdf9f337029242c473efddb5cc1..bd9954bb0d736500e3603cbdde49a762155d730a 100644 --- a/doc/framework.md +++ b/doc/framework.md @@ -634,17 +634,17 @@ const struct fwk_module module_xxx = { When `SCP_ENABLE_MARKED_LIST` is set, the maximum size of linked list will be traced and marked. -#### Tracing -To enable tracing functionality `FWK_TRACE_ENABLE` should be defined. -There is an example configuration for CMake that should be included in -`CMakeLists.txt` in every module that uses this feature. This configuration - requires `SCP_TRACE_ENABLE_MOD_` to be defined as a build flag +#### Module-level logging +To enable module-level logging `FWK_LOG_LOCAL_ENABLE` should be defined. +Below is a configuration for CMake that should be included in +`CMakeLists.txt` of every module that uses this feature. This configuration + requires `SCP_LOG_LOCAL_ENABLE_MOD_` to be defined as a build flag parameter. ``` -include(SCPModuleTrace) +include(SCPModuleLogLocal) ... -scp_module_trace(${SCP_MODULE}) +scp_module_log_local(${SCP_MODULE}) ``` diff --git a/framework/include/fwk_log.h b/framework/include/fwk_log.h index c13f16d88c1a7b6abcb6421e72422ee126c2dec0..4e9e7b2eab14ed2b9087178bdf69c75e10ce0312 100644 --- a/framework/include/fwk_log.h +++ b/framework/include/fwk_log.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -218,17 +218,17 @@ #define FWK_LOG_FLUSH() fwk_log_flush() /*! - * \def FWK_TRACE + * \def FWK_LOG_LOCAL * - * \brief Trace a message. + * \brief Log a module-level message. * * \param[in] ... Format string and any associated parameters. */ -#ifdef FWK_TRACE_ENABLE -# define FWK_TRACE(...) fwk_log_printf(__VA_ARGS__) +#ifdef FWK_LOG_LOCAL_ENABLE +# define FWK_LOG_LOCAL(...) fwk_log_printf(__VA_ARGS__) #else -# define FWK_TRACE(...) +# define FWK_LOG_LOCAL(...) #endif /*! diff --git a/framework/src/fwk_core.c b/framework/src/fwk_core.c index 9b338be6700720eff1d01bc553180ef212b50029..68a88555816d69eae2c640cbce8a7b5af8c1b9bf 100644 --- a/framework/src/fwk_core.c +++ b/framework/src/fwk_core.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -21,7 +21,7 @@ #include #ifdef FWK_EVENTS_WATERMARK_TRACE_ENABLE -# define FWK_TRACE_ENABLE +# define FWK_LOG_LOCAL_ENABLE #endif #include @@ -153,13 +153,13 @@ static int put_event( if (intr_state == NOT_INTERRUPT_STATE) { fwk_list_push_tail(&ctx.event_queue, &allocated_event->slist_node); - FWK_TRACE( + FWK_LOG_LOCAL( "[FWK] event_queue peak: %d", fwk_list_get_max(&ctx.event_queue)); } else { fwk_list_push_tail(&ctx.isr_event_queue, &allocated_event->slist_node); - FWK_TRACE( + FWK_LOG_LOCAL( "[FWK] isr_event_queue peak: %d", fwk_list_get_max(&ctx.isr_event_queue)); } @@ -277,7 +277,8 @@ static bool process_isr(void) fwk_list_push_tail(&ctx.event_queue, &isr_event->slist_node); - FWK_TRACE("[FWK] event_queue peak: %d", fwk_list_get_max(&ctx.event_queue)); + FWK_LOG_LOCAL( + "[FWK] event_queue peak: %d", fwk_list_get_max(&ctx.event_queue)); return true; } diff --git a/module/smcf/src/mod_smcf.c b/module/smcf/src/mod_smcf.c index f790be00844b58935fe2d0848420452b7a9935ff..20b3a95f7afb65750b0c75747aed12271e9f41f7 100644 --- a/module/smcf/src/mod_smcf.c +++ b/module/smcf/src/mod_smcf.c @@ -176,14 +176,14 @@ static void sample_data_set_complete_handler( status = fwk_put_event(&req); if (status != FWK_SUCCESS) { - FWK_TRACE("[SMCF] Send data sample event failed!"); + FWK_LOG_LOCAL("[SMCF] Send data sample event failed!"); } } static void no_handler_for_this_interrupt_source( struct smcf_element_ctx *element_ctx) { - FWK_TRACE("[SMCF] Interrupt received but the event is not handled"); + FWK_LOG_LOCAL("[SMCF] Interrupt received but the event is not handled"); } static void (*mgi_interrupt_manager_table[SMCF_MGI_IRQ_SOURCE_MAX])( @@ -555,7 +555,7 @@ static int smcf_process_event( * local SMCF event */ if (fwk_id_is_equal(event->id, smcf_event_id_new_data_sample)) { - FWK_TRACE("[SMCF] New data sample event received"); + FWK_LOG_LOCAL("[SMCF] New data sample event received"); #ifdef BUILD_HAS_NOTIFICATION status = smcf_new_data_sample_ready_notify(); #endif diff --git a/tools/config/cppcheck/cppcheck_suppress_list.txt b/tools/config/cppcheck/cppcheck_suppress_list.txt index fccc111ac94184b60d861e9a883723b46ae5b617..37a0424ee00dafb5751ccc01cd04dec43b1fb762 100755 --- a/tools/config/cppcheck/cppcheck_suppress_list.txt +++ b/tools/config/cppcheck/cppcheck_suppress_list.txt @@ -36,7 +36,7 @@ preprocessorErrorDirective:*arch/arm/src/arch_mm.c:16 preprocessorErrorDirective:*arch/arm/armv8-a/src/arch_mm.c:17 // Cppcheck is not able to parse returned boolean values inside if conditions -internalAstError:*framework/src/fwk_core.c:312 +internalAstError:*framework/src/fwk_core.c:313 // Suppress CMSIS errors *:*/CMSIS*/*