MLECO-2948: Minor refactoring for platform modules.

Reducing dependency on cmsis-device sources as these will
be removed under MLECO-2944. Also, starting to refactor
to allow HAL to drop NPU and TA init routines - this will
happen in future CRs.

Added platform driver for native, and subsequent patches
will attempt to get rid of the HAL "profile" specific
sources and allow platform stub implementations at a level
below HAL. This will allow platforms drivers to only
override the range of functions that they actually want to
implement and will fall back on stubs for the rest. In this
CR only "utils" have been removed.

Change-Id: I09b4a28e20847a07a956c818c6f47c74aab89063
diff --git a/source/hal/platform/mps3/CMakeLists.txt b/source/hal/platform/mps3/CMakeLists.txt
index 46db2aa..cd95d6c 100644
--- a/source/hal/platform/mps3/CMakeLists.txt
+++ b/source/hal/platform/mps3/CMakeLists.txt
@@ -70,27 +70,38 @@
     include
     ${SOURCE_GEN_DIR})
 
+## Include directories - private
+target_include_directories(${PLATFORM_DRIVERS_TARGET}
+    PRIVATE
+    source/include)
+
 ## Platform sources
 target_sources(${PLATFORM_DRIVERS_TARGET}
     PRIVATE
     source/device_mps3.c
-    source/timer_mps3.c)
+    source/timer_mps3.c
+    source/platform_drivers.c)
+
+## Directory for additional compnents required by MPS3:
+if (NOT DEFINED COMPONENTS_DIR)
+    set(COMPONENTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../components)
+endif()
 
 ## Platform component: uart
 target_sources(${PLATFORM_DRIVERS_TARGET}
         PRIVATE
-        ${CMAKE_CURRENT_SOURCE_DIR}/../../components/uart_cmsdk/uart_cmsdk.c)
+        ${COMPONENTS_DIR}/uart_cmsdk/uart_cmsdk.c)
 target_include_directories(${PLATFORM_DRIVERS_TARGET}
         PUBLIC
-        ${CMAKE_CURRENT_SOURCE_DIR}/../../components/uart_cmsdk/include)
+        ${COMPONENTS_DIR}/uart_cmsdk/include)
 
 ## Platform component: LCD
 target_sources(${PLATFORM_DRIVERS_TARGET}
         PRIVATE
-        ${CMAKE_CURRENT_SOURCE_DIR}/../../components/lcd_mps3/glcd_mps3.c)
+        ${COMPONENTS_DIR}/lcd_mps3/glcd_mps3.c)
 target_include_directories(${PLATFORM_DRIVERS_TARGET}
         PUBLIC
-        ${CMAKE_CURRENT_SOURCE_DIR}/../../components/lcd_mps3/include)
+        ${COMPONENTS_DIR}/lcd_mps3/include)
 
 ## This target provides the following definitions for MPS3 specific behaviour
 ## TODO: We should aim to remove this now with platform refactoring..
@@ -100,13 +111,11 @@
     ACTIVATION_BUF_SRAM_SZ=${ACTIVATION_BUF_SRAM_SZ}
     $<$<BOOL:TA_CONFIG_FILE>:TIMING_ADAPTER_AVAILABLE>)
 
-# 5. Add dependencies:
-
+# Add dependencies:
 target_link_libraries(${PLATFORM_DRIVERS_TARGET} PUBLIC
-        cmsis_device
-        log)
+    log cmsis_device)
 
-# 6 Display status:
+# Display status:
 message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
 message(STATUS "*******************************************************")
 message(STATUS "Library                                : " ${PLATFORM_DRIVERS_TARGET})
diff --git a/source/hal/platform/mps3/include/platform_drivers.h b/source/hal/platform/mps3/include/platform_drivers.h
index c5ed561..156b136 100644
--- a/source/hal/platform/mps3/include/platform_drivers.h
+++ b/source/hal/platform/mps3/include/platform_drivers.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,15 +15,36 @@
  * limitations under the License.
  */
 
-#ifndef PLATFORM_DRIVER_H
-#define PLATFORM_DRIVER_H
+#ifndef PLATFORM_DRIVERS_H
+#define PLATFORM_DRIVERS_H
 
-#include "log_macros.h"   /* Logging related helpers. */
-#include "uart_stdout.h"    /* stdout over UART. */
-#include "smm_mps3.h"       /* Mem map for MPS3 peripherals. */
-#include "glcd_mps3.h"      /* LCD functions. */
+#include "log_macros.h"     /* Logging related helpers. */
+
+/* Platform components */
 #include "timer_mps3.h"     /* Timer functions. */
-#include "device_mps3.h"    /* FPGA level definitions and functions. */
-#include "peripheral_irqs.h"/* IRQ numbers for this platform */
+#include "cmsis.h"          /* For CPU related defintiions */
+#include "glcd_mps3.h"      /* LCD functions. */
 
-#endif /* PLATFORM_DRIVER_H */
+/** Platform definitions. TODO: These should be removed. */
+#include "peripheral_memmap.h"  /* Peripheral memory map definitions. */
+#include "peripheral_irqs.h"    /* IRQ numbers for this platform. */
+
+/**
+ * @brief   Initialises the platform components.
+ * @return  0 if successful, error code otherwise.
+ */
+int platform_init(void);
+
+/**
+ * @brief   Teardown for platform components.
+ */
+void platform_release(void);
+
+/**
+ * @brief   Sets the platform name.
+ * @param[out] name     Name of the platform to be set
+ * @param[in]  size     Size of the input buffer
+ */
+void platform_name(char* name, size_t size);
+
+#endif /* PLATFORM_DRIVERS_H */
diff --git a/source/hal/platform/mps3/include/timer_mps3.h b/source/hal/platform/mps3/include/timer_mps3.h
index 70d059c..b5db722 100644
--- a/source/hal/platform/mps3/include/timer_mps3.h
+++ b/source/hal/platform/mps3/include/timer_mps3.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,7 +18,6 @@
 #define TIMER_MPS3_H
 
 #include <stdint.h>
-#include <time.h>
 
 /* Container for timestamp up-counters. */
 typedef struct _mps3_time_counter {
@@ -47,7 +46,7 @@
  * @brief       Gets the duration elapsed between two counters in milliseconds.
  * @param[in]   start   Pointer to base_time_counter value at start time.
  * @param[in]   end     Pointer to base_time_counter value at end.
- * @returns     Difference in milliseconds between the two give counters 
+ * @returns     Difference in milliseconds between the two give counters
  *              expressed as an unsigned integer.
  **/
 uint32_t get_duration_milliseconds(base_time_counter *start,
@@ -57,7 +56,7 @@
  * @brief       Gets the duration elapsed between two counters in microseconds.
  * @param[in]   start   Pointer to base_time_counter value at start time.
  * @param[in]   end     Pointer to base_time_counter value at end.
- * @returns     Difference in microseconds between the two give counters 
+ * @returns     Difference in microseconds between the two give counters
  *              expressed as an unsigned integer.
  **/
 uint32_t get_duration_microseconds(base_time_counter *start,
@@ -83,4 +82,9 @@
  **/
 void stop_cycle_counter(void);
 
+/**
+ * @brief   System tick interrupt handler.
+ **/
+void SysTick_Handler(void);
+
 #endif /* TIMER_MPS3_H */
diff --git a/source/hal/platform/mps3/source/device_mps3.c b/source/hal/platform/mps3/source/device_mps3.c
index fa57c2e..de715fb 100644
--- a/source/hal/platform/mps3/source/device_mps3.c
+++ b/source/hal/platform/mps3/source/device_mps3.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,11 +21,9 @@
 
 #include <inttypes.h>
 
-extern uint32_t GetSystemCoreClock(void);
-
 uint32_t GetMPS3CoreClock(void)
 {
-    const uint32_t default_clock = GetSystemCoreClock();
+    const uint32_t default_clock = 32000000 /* 32 MHz clock */;
     static int warned_once = 0;
     if (0 != MPS3_SCC->CFG_ACLK) {
         if (default_clock != MPS3_SCC->CFG_ACLK) {
diff --git a/source/hal/platform/mps3/include/device_mps3.h b/source/hal/platform/mps3/source/include/device_mps3.h
similarity index 98%
rename from source/hal/platform/mps3/include/device_mps3.h
rename to source/hal/platform/mps3/source/include/device_mps3.h
index e0dea1b..445965d 100644
--- a/source/hal/platform/mps3/include/device_mps3.h
+++ b/source/hal/platform/mps3/source/include/device_mps3.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,7 +21,6 @@
 extern "C" {
 #endif
 
-#include "cmsis.h"      /* CMSIS device header. */
 #include "smm_mps3.h"   /* Memory map for MPS3. */
 
 #include <stdio.h>
diff --git a/source/hal/platform/mps3/include/smm_mps3.h b/source/hal/platform/mps3/source/include/smm_mps3.h
similarity index 99%
rename from source/hal/platform/mps3/include/smm_mps3.h
rename to source/hal/platform/mps3/source/include/smm_mps3.h
index 1c0e0f2..5a2bcc5 100644
--- a/source/hal/platform/mps3/include/smm_mps3.h
+++ b/source/hal/platform/mps3/source/include/smm_mps3.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,9 +17,10 @@
 #ifndef SMM_MPS3_H
 #define SMM_MPS3_H
 
-#include "cmsis.h"                  /* Device specific header file. */
+#include "cmsis.h"                  /* For CPU related defintiions */
 #include "peripheral_memmap.h"      /* Peripheral memory map definitions. */
 
+
 #if defined ( __CC_ARM   )
 #pragma anon_unions
 #endif
diff --git a/source/hal/platform/mps3/source/platform_drivers.c b/source/hal/platform/mps3/source/platform_drivers.c
new file mode 100644
index 0000000..da2b39c
--- /dev/null
+++ b/source/hal/platform/mps3/source/platform_drivers.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2022 Arm Limited. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "platform_drivers.h"
+
+#include "uart_stdout.h"    /* stdout over UART. */
+#include "log_macros.h"     /* Logging functions */
+#include "device_mps3.h"    /* FPGA level definitions and functions. */
+
+#include <string.h>         /* For strncpy */
+
+/**
+ * @brief   Checks if the platform is valid by checking
+ *          the CPU ID for the FPGA implementation against
+ *          the register from the CPU core.
+ * @return  0 if successful, 1 otherwise
+ */
+static int verify_platform(void);
+
+int platform_init(void)
+{
+    int err = 0;
+
+    SystemCoreClockUpdate();    /* From start up code */
+
+    /* UART init - will enable valid use of printf (stdout
+     * re-directed at this UART (UART0) */
+    UartStdOutInit();
+
+    if (0 != (err = verify_platform())) {
+        return err;
+    }
+
+    /** TODO: Add ARM NPU and TA init here */
+    return 0;
+}
+
+void platform_release(void)
+{
+    __disable_irq();
+}
+
+void platform_name(char* name, size_t size)
+{
+    strncpy(name, DESIGN_NAME, size);
+}
+
+#define CREATE_MASK(msb, lsb)           (int)(((1U << ((msb) - (lsb) + 1)) - 1) << (lsb))
+#define MASK_BITS(arg, msb, lsb)        (int)((arg) & CREATE_MASK(msb, lsb))
+#define EXTRACT_BITS(arg, msb, lsb)     (int)(MASK_BITS(arg, msb, lsb) >> (lsb))
+
+static int verify_platform(void)
+{
+    uint32_t id = 0;
+    uint32_t fpgaid = 0;
+    uint32_t apnote = 0;
+    uint32_t rev = 0;
+    uint32_t aid = 0;
+    uint32_t fpga_clk = 0;
+    const uint32_t ascii_A = (uint32_t)('A');
+
+    /* Initialise the LEDs as the switches are */
+    MPS3_FPGAIO->LED = MPS3_FPGAIO->SWITCHES & 0xFF;
+
+    info("Processor internal clock: %" PRIu32 "Hz\n", GetMPS3CoreClock());
+
+    /* Get revision information from various registers */
+    rev = MPS3_SCC->CFG_REG4;
+    fpgaid = MPS3_SCC->SCC_ID;
+    aid = MPS3_SCC->SCC_AID;
+    apnote = EXTRACT_BITS(fpgaid, 15, 4);
+    fpga_clk = GetMPS3CoreClock();
+
+    info("V2M-MPS3 revision %c\n\n", (char)(rev + ascii_A));
+    info("Application Note AN%" PRIx32 ", Revision %c\n", apnote,
+        (char)(EXTRACT_BITS(aid, 23, 20) + ascii_A));
+    info("MPS3 build %d\n", EXTRACT_BITS(aid, 31, 24));
+    info("MPS3 core clock has been set to: %" PRIu32 "Hz\n", fpga_clk);
+
+    /* Display CPU ID */
+    id = SCB->CPUID;
+    info("CPU ID: 0x%08" PRIx32 "\n", id);
+
+    if(EXTRACT_BITS(id, 15, 8) == 0xD2) {
+        if (EXTRACT_BITS(id, 7, 4) == 2) {
+            info ("CPU: Cortex-M55 r%dp%d\n\n",
+                EXTRACT_BITS(id, 23, 20),EXTRACT_BITS(id, 3, 0));
+#if defined (CPU_CORTEX_M55)
+            /* CPU ID should be "0x_41_0f_d2_20" for Cortex-M55 */
+            return 0;
+#endif /* CPU_CORTEX_M55 */
+        } else if (EXTRACT_BITS(id, 7, 4) == 1) {
+            info ("CPU: Cortex-M33 r%dp%d\n\n",
+                EXTRACT_BITS(id, 23, 20),EXTRACT_BITS(id, 3, 0));
+#if defined (CPU_CORTEX_M33)
+            return 0;
+#endif /* CPU_CORTEX_M33 */
+        } else if (EXTRACT_BITS(id, 7, 4) == 0) {
+            info ("CPU: Cortex-M23 r%dp%d\n\n",
+                EXTRACT_BITS(id, 23, 20),EXTRACT_BITS(id, 3, 0));
+        } else {
+            info ("CPU: Cortex-M processor family");
+        }
+    } else if (EXTRACT_BITS(id, 15, 8) == 0xC6) {
+        info ("CPU: Cortex-M%d+ r%dp%d\n\n",
+            EXTRACT_BITS(id, 7, 4), EXTRACT_BITS(id, 23, 20),
+            EXTRACT_BITS(id, 3, 0));
+    } else {
+        info ("CPU: Cortex-M%d r%dp%d\n\n",
+            EXTRACT_BITS(id, 7, 4), EXTRACT_BITS(id, 23, 20),
+            EXTRACT_BITS(id, 3, 0));
+    }
+
+    /* If the CPU is anything other than M33 or M55, we return 1 */
+    printf_err("CPU mismatch!\n");
+    return 1;
+}
diff --git a/source/hal/platform/mps3/source/timer_mps3.c b/source/hal/platform/mps3/source/timer_mps3.c
index 9b8914c..16ff4cd 100644
--- a/source/hal/platform/mps3/source/timer_mps3.c
+++ b/source/hal/platform/mps3/source/timer_mps3.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,7 +19,18 @@
 #include "log_macros.h"
 #include "device_mps3.h"
 
-#include <inttypes.h>
+static uint64_t cpu_cycle_count = 0;    /* 64-bit cpu cycle counter */
+
+/**
+ * @brief   Gets the system tick triggered cycle counter for the CPU.
+ * @return  64-bit counter value.
+ **/
+static uint64_t Get_SysTick_Cycle_Count(void);
+
+/**
+ * SysTick initialisation
+ */
+static int Init_SysTick(void);
 
 void timer_reset(void)
 {
@@ -111,3 +122,52 @@
 {
     /* Nothing to do for FPGA */
 }
+
+void SysTick_Handler(void)
+{
+    /* Increment the cycle counter based on load value. */
+    cpu_cycle_count += SysTick->LOAD + 1;
+}
+
+/**
+ * Gets the current SysTick derived counter value
+ */
+static uint64_t Get_SysTick_Cycle_Count(void)
+{
+    uint32_t systick_val;
+
+    NVIC_DisableIRQ(SysTick_IRQn);
+    systick_val = SysTick->VAL & SysTick_VAL_CURRENT_Msk;
+    NVIC_EnableIRQ(SysTick_IRQn);
+
+    return cpu_cycle_count + (SysTick->LOAD - systick_val);
+}
+
+/**
+ * SysTick initialisation
+ */
+static int Init_SysTick(void)
+{
+    const uint32_t ticks_10ms = GetMPS3CoreClock()/100 + 1;
+    int err = 0;
+
+    /* Reset CPU cycle count value. */
+    cpu_cycle_count = 0;
+
+    /* Changing configuration for sys tick => guard from being
+     * interrupted. */
+    NVIC_DisableIRQ(SysTick_IRQn);
+
+    /* SysTick init - this will enable interrupt too. */
+    err = SysTick_Config(ticks_10ms);
+
+    /* Enable interrupt again. */
+    NVIC_EnableIRQ(SysTick_IRQn);
+
+    /* Wait for SysTick to kick off */
+    while (!err && !SysTick->VAL) {
+        __NOP();
+    }
+
+    return err;
+}
diff --git a/source/hal/platform/native/CMakeLists.txt b/source/hal/platform/native/CMakeLists.txt
new file mode 100644
index 0000000..0435cf1
--- /dev/null
+++ b/source/hal/platform/native/CMakeLists.txt
@@ -0,0 +1,56 @@
+#----------------------------------------------------------------------------
+#  Copyright (c) 2022 Arm Limited. All rights reserved.
+#  SPDX-License-Identifier: Apache-2.0
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#----------------------------------------------------------------------------
+
+#########################################################
+#    Native target platform support library             #
+#########################################################
+
+cmake_minimum_required(VERSION 3.15.6)
+
+set(PLATFORM_DRIVERS_TARGET platform-drivers)
+
+project(${PLATFORM_DRIVERS_TARGET}
+    DESCRIPTION     "Platform drivers library for native target"
+    LANGUAGES       C CXX)
+
+# We should not be cross-compiling
+if (${CMAKE_CROSSCOMPILING})
+    message(FATAL_ERROR "Native drivers not available when cross-compiling.")
+endif()
+
+
+# Create static library
+add_library(${PLATFORM_DRIVERS_TARGET} STATIC)
+
+## Include directories - public
+target_include_directories(${PLATFORM_DRIVERS_TARGET}
+    PUBLIC
+    include)
+
+## Platform sources
+target_sources(${PLATFORM_DRIVERS_TARGET}
+    PRIVATE
+    source/platform_drivers.c)
+
+# Add dependencies:
+target_link_libraries(${PLATFORM_DRIVERS_TARGET} PUBLIC log)
+
+# Display status:
+message(STATUS "*******************************************************")
+message(STATUS "Library                                : " ${PLATFORM_DRIVERS_TARGET})
+message(STATUS "CMAKE_SYSTEM_PROCESSOR                 : " ${CMAKE_SYSTEM_PROCESSOR})
+message(STATUS "*******************************************************")
diff --git a/source/hal/platform/native/include/platform_drivers.h b/source/hal/platform/native/include/platform_drivers.h
new file mode 100644
index 0000000..ca6b6e0
--- /dev/null
+++ b/source/hal/platform/native/include/platform_drivers.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2022 Arm Limited. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PLATFORM_DRIVERS_H
+#define PLATFORM_DRIVERS_H
+
+#include "log_macros.h"     /* Logging related helpers. */
+
+/**
+ * @brief   Initialises the platform components.
+ * @return  0 if successful, error code otherwise.
+ */
+int platform_init(void);
+
+/**
+ * @brief   Teardown for platform components.
+ */
+void platform_release(void);
+
+/**
+ * @brief   Sets the platform name.
+ * @param[out] name     Name of the platform to be set
+ * @param[in]  size     Size of the input buffer
+ */
+void platform_name(char* name, size_t size);
+
+#endif /* PLATFORM_DRIVERS_H */
diff --git a/source/hal/platform/native/source/platform_drivers.c b/source/hal/platform/native/source/platform_drivers.c
new file mode 100644
index 0000000..10db99a
--- /dev/null
+++ b/source/hal/platform/native/source/platform_drivers.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2022 Arm Limited. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "platform_drivers.h"
+
+#include <string.h>
+
+int platform_init(void)
+{
+    return 0;
+}
+
+void platform_release(void)
+{}
+
+void platform_name(char* name, size_t size)
+{
+    strncpy(name, "native", size);
+}
\ No newline at end of file
diff --git a/source/hal/platform/simple/CMakeLists.txt b/source/hal/platform/simple/CMakeLists.txt
index cd3a2bc..44c4089 100644
--- a/source/hal/platform/simple/CMakeLists.txt
+++ b/source/hal/platform/simple/CMakeLists.txt
@@ -72,7 +72,8 @@
 target_sources(${PLATFORM_DRIVERS_TARGET}
     PRIVATE
     source/stubs_glcd.c
-    source/timer_simple_platform.c)
+    source/timer_simple_platform.c
+    source/platform_drivers.c)
 
 ## Platform component: uart
 target_sources(${PLATFORM_DRIVERS_TARGET}
diff --git a/source/hal/platform/simple/include/platform_drivers.h b/source/hal/platform/simple/include/platform_drivers.h
index 0fb092e..c9928c0 100644
--- a/source/hal/platform/simple/include/platform_drivers.h
+++ b/source/hal/platform/simple/include/platform_drivers.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,18 +15,36 @@
  * limitations under the License.
  */
 
-#ifndef PLATFORM_DRIVER_H
-#define PLATFORM_DRIVER_H
+#ifndef PLATFORM_DRIVERS_H
+#define PLATFORM_DRIVERS_H
 
 #include "log_macros.h"   /* Logging related helpers. */
 
 /* Platform components */
-#include "uart_stdout.h"    /* stdout over UART. */
-#include "stubs/glcd.h"     /* LCD stubs to support use cases that use LCD */
+#include "stubs/glcd.h"             /* LCD stubs to support use cases that use LCD */
 #include "timer_simple_platform.h"  /* timer implementation */
+#include "cmsis.h"                  /* For CPU related defintiions */
 
-#include "cmsis.h"                  /* CPU device specific header file    */
-#include "peripheral_memmap.h"      /* peripheral memory map definitions */
-#include "peripheral_irqs.h"        /* IRQ numbers for the platform */
+/** Platform definitions. TODO: These should be removed. */
+#include "peripheral_memmap.h"  /* Peripheral memory map definitions. */
+#include "peripheral_irqs.h"    /* IRQ numbers for this platform. */
 
-#endif /* PLATFORM_DRIVER_H */
+/**
+ * @brief   Initialises the platform components.
+ * @return  0 if successful, error code otherwise.
+ */
+int platform_init(void);
+
+/**
+ * @brief   Teardown for platform components.
+ */
+void platform_release(void);
+
+/**
+ * @brief   Sets the platform name.
+ * @param[out] name     Name of the platform to be set
+ * @param[in]  size     Size of the input buffer
+ */
+void platform_name(char* name, size_t size);
+
+#endif /* PLATFORM_DRIVERS_H */
diff --git a/source/hal/platform/simple/include/stubs/glcd.h b/source/hal/platform/simple/include/stubs/glcd.h
index 5915f7d..b31938f 100644
--- a/source/hal/platform/simple/include/stubs/glcd.h
+++ b/source/hal/platform/simple/include/stubs/glcd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,6 +17,8 @@
 #ifndef STUBS_SIMPLE_PLATFORM_H
 #define STUBS_SIMPLE_PLATFORM_H
 
+#include <stdint.h>
+
 /****************************************************************************/
 /*              Definitions and stub functions for modules currently        */
 /*              unavailable on this target platform                         */
@@ -58,10 +60,10 @@
  * @param[in] downsample_factor   factor by which the image
  *                                is downsampled by.
  */
-void GLCD_Image(void *data, const unsigned int width,
-                const unsigned int height, const unsigned int channels,
-                const unsigned int pos_x, const unsigned int pos_y,
-                const unsigned int downsample_factor);
+void GLCD_Image(const void *data, const uint32_t width,
+                const uint32_t height, const uint32_t channels,
+                const uint32_t pos_x, const uint32_t pos_y,
+                const uint32_t downsample_factor);
 
 /**
  * @brief      Clear display
diff --git a/source/hal/platform/simple/include/timer_simple_platform.h b/source/hal/platform/simple/include/timer_simple_platform.h
index 03d8245..4df22da 100644
--- a/source/hal/platform/simple/include/timer_simple_platform.h
+++ b/source/hal/platform/simple/include/timer_simple_platform.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -51,4 +51,9 @@
  */
 void stop_cycle_counter(void);
 
+/**
+ * @brief   System tick interrupt handler.
+ **/
+void SysTick_Handler(void);
+
 #endif /* TIMER_SIMPLE_PLATFORM_H */
diff --git a/source/hal/platform/simple/source/platform_drivers.c b/source/hal/platform/simple/source/platform_drivers.c
new file mode 100644
index 0000000..c92a964
--- /dev/null
+++ b/source/hal/platform/simple/source/platform_drivers.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022 Arm Limited. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "platform_drivers.h"
+
+#include "uart_stdout.h"
+#include <string.h>
+
+int platform_init(void)
+{
+    SystemCoreClockUpdate();    /* From start up code */
+
+    /* UART init - will enable valid use of printf (stdout
+     * re-directed at this UART (UART0) */
+    UartStdOutInit();
+
+    info("%s: complete\n", __FUNCTION__);
+
+    /** TODO: Add ARM NPU and TA init here */
+    return 0;
+}
+
+void platform_release(void)
+{
+    __disable_irq();
+}
+
+void platform_name(char* name, size_t size)
+{
+    strncpy(name, DESIGN_NAME, size);
+}
diff --git a/source/hal/platform/simple/source/stubs_glcd.c b/source/hal/platform/simple/source/stubs_glcd.c
index 6b60dcd..d843cf4 100644
--- a/source/hal/platform/simple/source/stubs_glcd.c
+++ b/source/hal/platform/simple/source/stubs_glcd.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,9 +31,10 @@
     UNUSED(bitmap);
 }
 
-void GLCD_Image(void *data, const unsigned int width, const unsigned int height,
-    const unsigned int channels, const unsigned int pos_x,
-    const unsigned int pos_y, const unsigned int downsample_factor)
+void GLCD_Image(const void *data, const uint32_t width,
+               const uint32_t height, const uint32_t channels,
+               const uint32_t pos_x, const uint32_t pos_y,
+               const uint32_t downsample_factor)
 {
     UNUSED(data);
     UNUSED(pos_x);
diff --git a/source/hal/platform/simple/source/timer_simple_platform.c b/source/hal/platform/simple/source/timer_simple_platform.c
index 4bcd07b..3d28261 100644
--- a/source/hal/platform/simple/source/timer_simple_platform.c
+++ b/source/hal/platform/simple/source/timer_simple_platform.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,11 +16,26 @@
  */
 #include "timer_simple_platform.h"
 
-#include "irqs.h"
-#include "log_macros.h"
+#include "log_macros.h"     /* Logging macros */
+#include "cmsis.h"          /* For CPU related defintiions */
 
 #include <inttypes.h>
 
+static uint64_t cpu_cycle_count = 0;    /* 64-bit cpu cycle counter */
+extern uint32_t SystemCoreClock;        /* Expected to come from the cmsis-device lib */
+
+/**
+ * @brief   Gets the system tick triggered cycle counter for the CPU.
+ * @return  64-bit counter value.
+ **/
+static uint64_t Get_SysTick_Cycle_Count(void);
+
+/**
+ * SysTick initialisation
+ */
+static int Init_SysTick(void);
+
+
 base_time_counter get_time_counter(void)
 {
     base_time_counter t = {
@@ -56,3 +71,53 @@
 {
     /* Add any custom requirement for this platform here */
 }
+
+
+void SysTick_Handler(void)
+{
+    /* Increment the cycle counter based on load value. */
+    cpu_cycle_count += SysTick->LOAD + 1;
+}
+
+/**
+ * Gets the current SysTick derived counter value
+ */
+static uint64_t Get_SysTick_Cycle_Count(void)
+{
+    uint32_t systick_val;
+
+    NVIC_DisableIRQ(SysTick_IRQn);
+    systick_val = SysTick->VAL & SysTick_VAL_CURRENT_Msk;
+    NVIC_EnableIRQ(SysTick_IRQn);
+
+    return cpu_cycle_count + (SysTick->LOAD - systick_val);
+}
+
+/**
+ * SysTick initialisation
+ */
+static int Init_SysTick(void)
+{
+    const uint32_t ticks_10ms = SystemCoreClock/100 + 1;
+    int err = 0;
+
+    /* Reset CPU cycle count value. */
+    cpu_cycle_count = 0;
+
+    /* Changing configuration for sys tick => guard from being
+     * interrupted. */
+    NVIC_DisableIRQ(SysTick_IRQn);
+
+    /* SysTick init - this will enable interrupt too. */
+    err = SysTick_Config(ticks_10ms);
+
+    /* Enable interrupt again. */
+    NVIC_EnableIRQ(SysTick_IRQn);
+
+    /* Wait for SysTick to kick off */
+    while (!err && !SysTick->VAL) {
+        __NOP();
+    }
+
+    return err;
+}
\ No newline at end of file