Fix tracing in libts

Libts deployments did not include posix_trace.c in the build and as
a result setting TRACE_LEVEL to any value above TRACE_LEVEL_NONE
resulted in a build error.

- Add the missing C file to the build to fix this error.
- Make the arm-linux version of libts to implement tracing
the same way as linux-pc.

Change-Id: I1db6117a0e8aa4955de063e7b22618d4a254973f
Signed-off-by: Gabor Toth <gabor.toth2@arm.com>
diff --git a/deployments/libts/arm-linux/CMakeLists.txt b/deployments/libts/arm-linux/CMakeLists.txt
index 1c190a8..5416656 100644
--- a/deployments/libts/arm-linux/CMakeLists.txt
+++ b/deployments/libts/arm-linux/CMakeLists.txt
@@ -24,6 +24,13 @@
 set(MM_COMM_BUFFER_SIZE "8*4*1024" CACHE STRING "Size of the MM communicate buffer in bytes")
 
 #-------------------------------------------------------------------------------
+#  For user-specific tracing set to TRACE_LEVEL_NONE and implement:
+#  void trace_puts(const char *str)
+#-------------------------------------------------------------------------------
+
+set(TRACE_PREFIX "LIBTS" CACHE STRING "Trace prefix")
+set(TRACE_LEVEL "TRACE_LEVEL_DEBUG" CACHE STRING "Trace level")
+#-------------------------------------------------------------------------------
 #  Components that are specific to deployment in the arm-linux environment.
 #
 #-------------------------------------------------------------------------------
diff --git a/deployments/libts/libts-import.cmake b/deployments/libts/libts-import.cmake
index eb3afc5..d0b728d 100644
--- a/deployments/libts/libts-import.cmake
+++ b/deployments/libts/libts-import.cmake
@@ -16,6 +16,10 @@
 version_semver_read(FILE "${CMAKE_CURRENT_LIST_DIR}/version.txt" MAJOR _major MINOR _minor PATCH _patch)
 set(_verstring "${_major}.${_minor}.${_patch}")
 
+if (COVERAGE)
+	set(LIBTS_BUILD_TYPE "DebugCoverage" CACHE STRING "Build type." FORCE)
+endif()
+
 find_package(libts "${_verstring}" QUIET PATHS ${CMAKE_CURRENT_BINARY_DIR}/libts_install/${TS_ENV}/lib/cmake/libts)
 if(NOT libts_FOUND)
 	if (CFG_FORCE_PREBUILT_LIBTS)
diff --git a/deployments/libts/libts.cmake b/deployments/libts/libts.cmake
index 0f1a022..20c3c0e 100644
--- a/deployments/libts/libts.cmake
+++ b/deployments/libts/libts.cmake
@@ -24,6 +24,10 @@
 
 add_library(libts::ts ALIAS ts)
 
+if (COVERAGE)
+	set(LIBTS_BUILD_TYPE "DebugCoverage" CACHE STRING "Build type." FORCE)
+endif()
+
 #-------------------------------------------------------------------------------
 #  Components that are common across all deployments
 #
@@ -32,6 +36,8 @@
 	TARGET "ts"
 	BASE_DIR ${TS_ROOT}
 	COMPONENTS
+		"environments/${TS_ENV}"
+		"components/common/trace"
 		"components/rpc/common/caller"
 		"components/rpc/common/interface"
 		"components/service/locator"
@@ -45,6 +51,7 @@
 
 # Enable exporting interface symbols for library public interface
 target_compile_definitions(ts PRIVATE
+	EXPORT_PUBLIC_INTERFACE_TRACE
 	EXPORT_PUBLIC_INTERFACE_RPC_CALLER
 	EXPORT_PUBLIC_INTERFACE_RPC_SERVICE
 	EXPORT_PUBLIC_INTERFACE_SERVICE_LOCATOR
diff --git a/deployments/libts/linux-pc/CMakeLists.txt b/deployments/libts/linux-pc/CMakeLists.txt
index 300f77d..80ef7e4 100644
--- a/deployments/libts/linux-pc/CMakeLists.txt
+++ b/deployments/libts/linux-pc/CMakeLists.txt
@@ -22,6 +22,13 @@
 target_include_directories(ts PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
 
 #-------------------------------------------------------------------------------
+#  For user-specific tracing set to TRACE_LEVEL_NONE and implement:
+#  void trace_puts(const char *str)
+#-------------------------------------------------------------------------------
+
+set(TRACE_PREFIX "LIBTS" CACHE STRING "Trace prefix")
+set(TRACE_LEVEL "TRACE_LEVEL_DEBUG" CACHE STRING "Trace level")
+#-------------------------------------------------------------------------------
 #  External project source-level dependencies
 #
 #-------------------------------------------------------------------------------
@@ -63,7 +70,6 @@
 		"components/common/uuid"
 		"components/common/endian"
 		"components/common/utils"
-		"components/common/trace"
 		"components/common/crc32"
 		"components/common/mbedtls"
 		"components/config/ramstore"
@@ -161,14 +167,6 @@
 )
 
 #-------------------------------------------------------------------------------
-#  Configure added components
-#
-#-------------------------------------------------------------------------------
-# Force trace level to TRACE_LEVEL_NONE to disable trace messages. This is
-# needed till proper trace enablement for the linux-pc environment is done.
-target_compile_definitions(ts PUBLIC TRACE_LEVEL=0)
-
-#-------------------------------------------------------------------------------
 #  Extend with components that are common across all deployments of
 #  libts
 #