aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJonny Svärd <jonny.svaerd@arm.com>2023-10-11 13:33:44 +0000
committerJonny Svärd <jonny.svaerd@arm.com>2023-10-11 15:36:48 +0200
commit0189cd2b334b2d88302d13d6003c50a642db0bb5 (patch)
treea081432d5881e18d50afde1b41c4a133eb075b62 /CMakeLists.txt
parent90f9df900acdc0718ecd2dfdc53780664758dec5 (diff)
downloadethos-u-core-driver-0189cd2b334b2d88302d13d6003c50a642db0bb5.tar.gz
Add option to turn off logging completely23.11-rc223.11-rc123.11
Add new ETHOSU_LOG_ENABLE variable in the CMakeLists.txt to toggle logging completely off, or else by the desired severity level. Turning off the logging will also disable the LOG() macro. Change-Id: I313a97fb1569000ae22637734ef4a60eedc56f70 Signed-off-by: Jonny Svärd <jonny.svaerd@arm.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5a4bd3..bb9f22d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@ option(DRIVER_PMU_AUTOINIT "Enable PMU boot auto-initialization" OFF)
set(CMSIS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmsis" CACHE PATH "Path to CMSIS.")
set(LOG_NAMES err warning info debug)
+set(ETHOSU_LOG_ENABLE ON CACHE BOOL "Toggle driver logs on/off (Defaults to ON)")
set(ETHOSU_LOG_SEVERITY "warning" CACHE STRING "Driver log severity level ${LOG_NAMES} (Defaults to 'warning')")
set(ETHOSU_TARGET_NPU_CONFIG "ethos-u55-128" CACHE STRING "Default NPU configuration")
set_property(CACHE ETHOSU_LOG_SEVERITY PROPERTY STRINGS ${LOG_NAMES})
@@ -76,7 +77,9 @@ endif()
# Set the log level for the target
-target_compile_definitions(ethosu_core_driver PRIVATE ETHOSU_LOG_SEVERITY=${LOG_SEVERITY})
+target_compile_definitions(ethosu_core_driver PRIVATE
+ ETHOSU_LOG_SEVERITY=${LOG_SEVERITY}
+ ETHOSU_LOG_ENABLE=$<BOOL:${ETHOSU_LOG_ENABLE}>)
# Install library and include files
install(TARGETS ethosu_core_driver LIBRARY DESTINATION "lib")
@@ -95,5 +98,6 @@ message(STATUS "PROJECT_NAME : ${PROJECT_NAME}")
message(STATUS "ETHOSU_TARGET_NPU_CONFIG : ${ETHOSU_TARGET_NPU_CONFIG}")
message(STATUS "CMAKE_SYSTEM_PROCESSOR : ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "CMSIS_PATH : ${CMSIS_PATH}")
+message(STATUS "ETHOSU_LOG_ENABLE : ${ETHOSU_LOG_ENABLE}")
message(STATUS "ETHOSU_LOG_SEVERITY : ${ETHOSU_LOG_SEVERITY}")
message(STATUS "*******************************************************")