Improved Logging - Core Software

Logging macros:
Added ethosu_logging.h as a lib, containing logging macros controlled by
a parameter ETHOSU_LOG_SEVERITY set in core_software CMakeLists.txt

Updated inference_process:
Updated inference_process to include ethosu_logging and use the logging
macros rather than printf()

Updated message_process:
Updated message_process to include ethosu_logging and use the
logging macros rather than printf()

Updated ethosu_monitor:
Updated ethosu_monitor to include ethosu_logging and use the
logging macros rather than printf()

Updated layer_by_layer_profiler:
Updated layer_by_layer_profiler to include ethosu_logging and use the
logging macros rather than printf()

Updated mhu_v2:
Updated mhu_v2 to include ethosu_logging and use the
logging macros rather than printf()

Change-Id: I5d6fd80b7645b3e0af5b494eea6dbb7755f02122
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc0d39e..62db31e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,16 @@
 set(CORE_SOFTWARE_RTOS "None" CACHE STRING "Select RTOS to include. (None, MbedOS, FreeRTOS, Zephyr)")
 string(TOLOWER ${CORE_SOFTWARE_RTOS} CORE_SOFTWARE_RTOS_LOWER)
 
+set(LOG_NAMES err warning info debug)
+set(ETHOSU_LOG_SEVERITY "warning" CACHE STRING "Driver log severity level ${LOG_NAMES} (Defaults to warning)")
+set_property(CACHE ETHOSU_LOG_SEVERITY PROPERTY STRINGS ${LOG_NAMES})
+
+# Check that ETHOSU_LOG_SEVERITY has one of the supported levels
+list(FIND LOG_NAMES ${ETHOSU_LOG_SEVERITY} LOG_SEVERITY)
+if (${LOG_SEVERITY} EQUAL -1)
+    message(FATAL_ERROR "Unsupported log level ${ETHOSU_LOG_SEVERITY}")
+endif()
+
 #
 # Build
 #
@@ -78,3 +88,10 @@
 
 # Merge libraries into static library
 target_link_libraries(ethosu_core INTERFACE tflu ethosu_applications ethosu_drivers)
+
+message(STATUS "*******************************************************")
+message(STATUS "PROJECT_NAME                           : ${PROJECT_NAME}")
+message(STATUS "CORE_SOFTWARE_RTOS                     : ${CORE_SOFTWARE_RTOS}")
+message(STATUS "CORE_SOFTWARE_ACCELERATOR              : ${CORE_SOFTWARE_ACCELERATOR}")
+message(STATUS "ETHOSU_LOG_SEVERITY                    : ${ETHOSU_LOG_SEVERITY}")
+message(STATUS "*******************************************************")
\ No newline at end of file