MLECO-2919: Restructuring to standardise HAL APIs

* LCD module component created (removed from individual
  platform packs).

* retarget.c moved out into its own component that wraps
  the uart module. It also have the native stub for
  GetLine => paved the way for removing data_acq module
  from profiles.

* shortened names for components' dir for npu and ta

* remove peripheral_memmap and peripheral_irqs headers
  from platform_drivers.h. There should be no need for
  these to be included in the top level now. These should
  be private headers.

* cmsis_device moved in as a component.

* Pyenv created by set_up_default_resource.py will also
  install packages that CMake's source generator needs.

TODO's:

* Remove timer from profiles (MLECO-3096)

Change-Id: I9d6ea2f4f291788f40a16ed507019563c8d7f205
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ed64e3..5a80554 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,10 +42,11 @@
 set(CMAKE_TOOLCHAIN_DIR ${CMAKE_SCRIPTS_DIR}/toolchains)
 set(DOWNLOAD_DEP_DIR    ${CMAKE_BINARY_DIR}/dependencies)
 set(DEPENDENCY_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies)
+set(CORE_PLATFORM_DIR   ${DEPENDENCY_ROOT_DIR}/core-platform)
 
 set(RESOURCES_DIR       ${CMAKE_CURRENT_SOURCE_DIR}/resources_downloaded
                         CACHE PATH "Resources directory")
-set(HAL_PLATFORM_DIR    ${CMAKE_CURRENT_SOURCE_DIR}/source/hal/platform)
+set(HAL_PLATFORM_DIR    ${CMAKE_CURRENT_SOURCE_DIR}/source/hal/source/platform)
 
 include(${CMAKE_SCRIPTS_DIR}/source_gen_utils.cmake)
 
diff --git a/docs/documentation.md b/docs/documentation.md
index 9a00cc4..4bc572a 100644
--- a/docs/documentation.md
+++ b/docs/documentation.md
@@ -145,7 +145,7 @@
     - `tensorflow-lite-micro`: Contains abstraction around TensorFlow Lite Micro API. This abstraction implements common
       functions to initialize a neural network model, run an inference, and access inference results.
 
-  - `hal`: Contains Hardware Abstraction Layer (HAL) sources, providing a platform agnostic API to access hardware
+  - `hal`: Contains Hardware Abstraction Layer (HAL) sources, providing a platform-agnostic API to access hardware
     platform-specific functions.
 
   - `log`: Common to all code logging macros managing log levels.
@@ -166,69 +166,73 @@
 
 ```tree
 hal
-├── cmsis_device
-│   └── ...
-├── components
-│   └── ...
-├── include
-│   └── ...
-├── platform
-│   ├── mps3
-│   └── simple
-├── profiles
-│   ├── bare-metal
-│   │   ├── bsp
-│   │   ├── data_acquisition
-│   │   ├── data_presentation
-│   │   ├── timer
-│   │   └── utils
-│   └── native
 ├── CMakeLists.txt
-└── hal.c
+├── include
+│   ├── data_acq.h
+│   ├── data_psn.h
+│   ├── hal.h
+│   └── timer.h
+└── source
+    ├── components
+    │   ├── cmsis_device
+    │   ├── lcd
+    │   ├── npu
+    │   ├── npu_ta
+    │   └── stdout
+    ├── platform
+    │   ├── mps3
+    │   ├── native
+    │   └── simple
+    ├── profiles
+    │   ├── bare-metal
+    │   └── native
+    ├── data_acq.c
+    ├── data_psn.c
+    └── hal.c
 ```
 
 HAL is built as a separate project into a static library `libhal.a`. It is linked with use-case executable.
 
 What these folders contain:
 
-- The folders `include` and `hal.c` contain the HAL top-level platform API and data acquisition, data presentation, and
+- The folders `include` and `source/hal.c` contain the HAL top-level platform API and data acquisition, data presentation, and
   timer interfaces.
     > **Note:** the files here and lower in the hierarchy have been written in C and this layer is a clean C/ + boundary
     > in the sources.
 
-- `cmsis_device` has a common startup code for Cortex-M based systems. The package defines interrupt vector table and
-  handlers. Reset handler - starting point of our application - is also defined here. This entry point is responsible
-  for the set-up before calling the user defined "main" function in the higher-level `application` logic.
-  It is a separate CMake project that is built into a static library `libcmsis_device.a`. It depends on a CMSIS repo
-  through `CMSIS_SRC_PATH` variable.
-  The static library is used by platform code.
-
-- `components` directory contains drivers for different modules that can be reused for different platforms.
-  These contain common functions for Arm Ethos-U NPU initialization, timing adapter block helpers and others.
+- `source/components` directory contains API and implementations for different modules that can be reused for different
+  platforms. These contain common functions for Arm Ethos-U NPU initialization, timing adapter block helpers and others.
   Each component produces a static library that could potentially be linked into the platform library to enable
   usage of corresponding modules from the platform sources. For example, most of the use-cases use NPU and
-  timing adapter initialization. If you want to run default ML use-cases on a custom platform, you could re-use
-  existing code from this directory provided it is compatible with your platform.
+  timing adapter initialization. Similarly, the LCD component provides a standard LCD API used by HAL and propagated
+  up the hierarchy. Two static library targets are provided for the LCD module - one with stubbed implementation and the
+  other which can drive the LCD on an Arm MPS3 target. If you want to run default ML use-cases on a custom platform, you
+  could re-use existing code from this directory provided it is compatible with your platform.
 
-- `platform/mps3`\
-  `platform/simple`:
+- `source/components/cmsis_device` has a common startup code for Cortex-M based systems. The package defines interrupt vector table and
+    handlers. Reset handler - starting point of our application - is also defined here. This entry point is responsible
+    for the set-up before calling the user defined "main" function in the higher-level `application` logic.
+    It is a separate CMake project that is built into a static library `libcmsis_device.a`. It depends on a CMSIS repo
+    through `CMSIS_SRC_PATH` variable.
+    The static library is used by platform code. 
+
+- `source/platform/mps3`\
+  `source/platform/simple`:
   These folders contain platform specific declaration and defines, such as, platform initialisation code, peripheral
   memory map, system registers, system specific timer implementation and other.
   Platform is built from selected components and configured cmsis device. The platform could be used with different
   profiles. Profile is included into the platform build based on `PLATFORM_PROFILE` build parameter.
-  Platform code is a separate CMake project and it is built into a static library `libplatform-drivers.a`. It is linked
+  Platform code is a separate CMake project, and it is built into a static library `libplatform-drivers.a`. It is linked
   into HAL library.
 
-- `profiles/bare-metal`\
-  `profiles/native`:
-  As mentioned before, profiles are added into platform build. Currently we support bare-metal and native profiles.
+- `source/profiles/bare-metal`\
+  `source/profiles/native`:
+  As mentioned before, profiles are added into platform build. Currently, we support bare-metal and native profiles.
   bare-metal contains the HAL support layer and platform initialization helpers. Function calls are routed
-  to platform-specific logic at this level. For example, for data presentation, an `lcd` module has been used. This
-  `lcd` module wraps the LCD driver calls for the actual hardware (for example, MPS3). Also "re-targets" the standard
-  output and error streams to the UART block.
+  to platform-specific logic at this level.
 
-  Native profile allows to build application to be executed on a build machine, i.e. x86. It bypasses and stubs platform
-  devices replacing them with standard C or C++ library calls.
+  Native profile allows the built application to be executed on the build (native) machine, i.e. x86. It bypasses and
+  stubs platform devices replacing them with standard C or C++ library calls.
 
 ## Models and resources
 
diff --git a/scripts/cmake/source_gen_utils.cmake b/scripts/cmake/source_gen_utils.cmake
index ccce7e7..cd2698c 100644
--- a/scripts/cmake/source_gen_utils.cmake
+++ b/scripts/cmake/source_gen_utils.cmake
@@ -258,13 +258,23 @@
 # outlined above.
 ##############################################################################
 function(setup_source_generator)
+
+    # If a virtual env has been created in the resources_downloaded directory,
+    # use it for source generator. Else, fall back to creating a virtual env
+    # in the current build directory.
+    if (EXISTS ${RESOURCES_DIR}/env)
+        set(DEFAULT_VENV_DIR ${RESOURCES_DIR}/env)
+    else()
+        set(DEFAULT_VENV_DIR ${CMAKE_BINARY_DIR}/venv)
+    endif()
+
     if (${CMAKE_HOST_WIN32})
-#        windows python3 has python.exe
+        # Windows Python3 is python.exe
         set(PY_EXEC python)
-        set(PYTHON ${CMAKE_BINARY_DIR}/pyenv/Scripts/${PY_EXEC})
+        set(PYTHON ${DEFAULT_VENV_DIR}/Scripts/${PY_EXEC})
     else()
         set(PY_EXEC python3)
-        set(PYTHON ${CMAKE_BINARY_DIR}/pyenv/bin/${PY_EXEC})
+        set(PYTHON ${DEFAULT_VENV_DIR}/bin/${PY_EXEC})
     endif()
     set(PYTHON ${PYTHON} PARENT_SCOPE)
 
@@ -276,7 +286,7 @@
     message(STATUS "Configuring python environment at ${PYTHON}")
 
     execute_process(
-        COMMAND ${PY_EXEC} -m venv ${CMAKE_BINARY_DIR}/pyenv
+        COMMAND ${PY_EXEC} -m venv ${DEFAULT_VENV_DIR}
         RESULT_VARIABLE return_code
     )
     if (NOT return_code STREQUAL "0")
diff --git a/set_up_default_resources.py b/set_up_default_resources.py
index 3138844..56363a1 100755
--- a/set_up_default_resources.py
+++ b/set_up_default_resources.py
@@ -345,6 +345,7 @@
     additional_npu_config_names: list = (),
     arena_cache_size: int = 0,
     check_clean_folder: bool = False,
+    additional_requirements_file: str = ''
 ):
     """
     Helpers function that retrieve the output from a command.
@@ -359,6 +360,9 @@
                             the NPU config requirements, are used.
     check_clean_folder (bool): Indicates whether the resources folder needs to
                                be checked for updates and cleaned.
+    additional_requirements_file (str): Path to a requirements.txt file if
+                                        additional packages need to be
+                                        installed.
     """
     # Paths
     current_file_dir = os.path.dirname(os.path.abspath(__file__))
@@ -419,7 +423,7 @@
             call_command(command)
         os.chdir(current_file_dir)
 
-    # 1.3 Make sure to have all the requirement
+    # 1.3 Make sure to have all the requirements
     requirements = [f"ethos-u-vela=={vela_version}"]
     command = f"{env_python} -m pip freeze"
     packages = call_command(command)
@@ -428,6 +432,11 @@
             command = f"{env_python} -m pip install {req}"
             call_command(command)
 
+    # 1.4 Install additional requirements, if a valid file has been provided
+    if additional_requirements_file and os.path.isfile(additional_requirements_file):
+        command = f"{env_python} -m pip install -r {additional_requirements_file}"
+        call_command(command)
+
     # 2. Download models
     logging.info("Downloading resources.")
     for uc in json_uc_res:
@@ -615,11 +624,22 @@
         help="Clean the disctory and optimize the downloaded resources",
         action="store_true",
     )
+    parser.add_argument(
+        "--requirements-file",
+        help="Path to requirements.txt file to install additional packages",
+        type=str,
+        default=os.path.join(os.path.dirname(os.path.abspath(__file__)),
+                             'scripts', 'py', 'requirements.txt')
+    )
+
     args = parser.parse_args()
 
     if args.arena_cache_size < 0:
         raise ArgumentTypeError("Arena cache size cannot not be less than 0")
 
+    if not os.path.isfile(args.requirements_file):
+        raise ArgumentTypeError(f"Invalid requirements file: {args.requirements_file}")
+
     logging.basicConfig(filename="log_build_default.log", level=logging.DEBUG)
     logging.getLogger().addHandler(logging.StreamHandler(sys.stdout))
 
@@ -628,4 +648,5 @@
         args.additional_ethos_u_config_name,
         args.arena_cache_size,
         args.clean,
+        args.requirements_file
     )
diff --git a/source/hal/CMakeLists.txt b/source/hal/CMakeLists.txt
index f720cdf..19f152c 100644
--- a/source/hal/CMakeLists.txt
+++ b/source/hal/CMakeLists.txt
@@ -37,7 +37,7 @@
     set(PLATFORM_PROFILE native)
 endif()
 
-set(PLATFORM_PROFILE_DIR    profiles/${PLATFORM_PROFILE})
+set(PLATFORM_PROFILE_DIR    source/profiles/${PLATFORM_PROFILE})
 
 ## Common include directories - public
 target_include_directories(${HAL_TARGET}
@@ -48,9 +48,9 @@
 ## Common sources for all profiles
 target_sources(${HAL_TARGET}
     PRIVATE
-    hal.c
-    ${PLATFORM_PROFILE_DIR}/data_presentation/data_psn.c
-    ${PLATFORM_PROFILE_DIR}/data_acquisition/data_acq.c
+    source/hal.c
+    source/data_psn.c
+    source/data_acq.c
     ${PLATFORM_PROFILE_DIR}/timer/platform_timer.c)
 
 if (DEFINED VERIFY_TEST_OUTPUT)
@@ -60,56 +60,7 @@
 endif ()
 
 if (NOT DEFINED PLATFORM_DRIVERS_DIR)
-    message(FATAL_ERROR "PLATFORM_DRIVERS_DIR need to be defined for this target")
-endif()
-
-
-############################ bare-metal profile #############################
-if (PLATFORM_PROFILE STREQUAL bare-metal)
-
-    ## Additional include directories - private
-    target_include_directories(${HAL_TARGET}
-        PRIVATE
-        ${PLATFORM_PROFILE_DIR}/data_presentation/lcd/include)
-
-    ## Additional sources - public
-    target_sources(${HAL_TARGET}
-        PUBLIC
-        ${PLATFORM_PROFILE_DIR}/bsp/retarget.c)
-
-    ## Additional sources - private
-    target_sources(${HAL_TARGET}
-        PRIVATE
-        ${PLATFORM_PROFILE_DIR}/data_presentation/lcd/lcd_img.c)
-
-    ## Compile definition:
-    target_compile_definitions(${HAL_TARGET}
-        PUBLIC
-        PLATFORM_HAL=PLATFORM_CORTEX_M_BAREMETAL)
-
-    # Add dependencies for platform_driver first, in case they are needed by it.
-    add_subdirectory(cmsis_device ${CMAKE_BINARY_DIR}/cmsis_device)
-
-############################   native profile   #############################
-elseif (PLATFORM_PROFILE STREQUAL native)
-
-    ## Additional include directories - private
-    target_include_directories(${HAL_TARGET}
-        PRIVATE
-        ${PLATFORM_PROFILE_DIR}/data_presentation/log/include)
-
-    ## Additional sources - private
-    target_sources(${HAL_TARGET}
-        PRIVATE
-        ${PLATFORM_PROFILE_DIR}/data_presentation/log/log.c)
-
-    ## Compile definition:
-    target_compile_definitions(${HAL_TARGET}
-        PUBLIC
-        PLATFORM_HAL=PLATFORM_UNKNOWN_LINUX_OS
-        ACTIVATION_BUF_SRAM_SZ=0)
-else()
-    message(FATAL_ERROR "PLATFORM_PROFILE ${PLATFORM_PROFILE} not supported")
+    message(FATAL_ERROR "PLATFORM_DRIVERS_DIR undefined")
 endif()
 
 # Add platform_drivers target
@@ -118,8 +69,11 @@
 # Link time library targets:
 target_link_libraries(${HAL_TARGET}
     PUBLIC
-    log
-    platform_drivers)
+    log                 # Logging functions
+    lcd_iface           # LCD interface
+    stdout_iface        # Standard output (and error) interface
+    platform_drivers    # Platform drivers implementing the required interfaces
+)
 
 # Display status:
 message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/source/hal/platform/mps3/source/device_mps3.c b/source/hal/platform/mps3/source/device_mps3.c
deleted file mode 100644
index de715fb..0000000
--- a/source/hal/platform/mps3/source/device_mps3.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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");
- * 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 "device_mps3.h"
-
-#include "log_macros.h"
-#include "smm_mps3.h"
-
-#include <inttypes.h>
-
-uint32_t GetMPS3CoreClock(void)
-{
-    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) {
-            warn("System clock is different to the MPS3 config set clock.\n");
-        }
-        return MPS3_SCC->CFG_ACLK;
-    }
-
-    if (!warned_once) {
-        warn("MPS3_SCC->CFG_ACLK reads 0. Assuming default clock of %" PRIu32 "\n",
-            default_clock);
-        warned_once = 1;
-    }
-    return default_clock;
-}
diff --git a/source/hal/platform/simple/include/stubs/glcd.h b/source/hal/platform/simple/include/stubs/glcd.h
deleted file mode 100644
index b31938f..0000000
--- a/source/hal/platform/simple/include/stubs/glcd.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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");
- * 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 STUBS_SIMPLE_PLATFORM_H
-#define STUBS_SIMPLE_PLATFORM_H
-
-#include <stdint.h>
-
-/****************************************************************************/
-/*              Definitions and stub functions for modules currently        */
-/*              unavailable on this target platform                         */
-/****************************************************************************/
-#define GLCD_WIDTH      320
-#define GLCD_HEIGHT     240
-#define Black           0x0000      /*   0,   0,   0 */
-#define White           0xFFFF      /* 255, 255, 255 */
-
-/************************  GLCD related functions ****************************/
-/**
- * @brief      Initialize the Himax LCD with HX8347-D LCD Controller
- */
-void GLCD_Initialize(void);
-
-/**
- * @brief      Display graphical bitmap image at position x horizontally and y
- *             vertically. This function is optimized for 16 bits per pixel
- *             format, it has to be adapted for any other format.
- * @param[in]  x        horizontal position.
- * @param[in]  y        vertical position.
- * @param[in]  w        width of bitmap.
- * @param[in]  h        height of bitmap.
- * @param[in]  bitmap   address at which the bitmap data resides.
- */
-void GLCD_Bitmap(unsigned int x,  unsigned int y,
-                unsigned int w, unsigned int h,
-                unsigned short *bitmap);
-
-/**
- * @brief Displays an 8 bit image, conversion to the LCD's
- *        16 bit codec is done on the fly.
- * @param[in] data      pointer to the full sized image data.
- * @param[in] width     image width.
- * @param[in] height    image height.
- * @param[in] channels  number of channels in the image.
- * @param[in] pos_x     start x position for the LCD.
- * @param[in] pos_y     start y position for the LCD.
- * @param[in] downsample_factor   factor by which the image
- *                                is downsampled by.
- */
-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
- * @param[in]  color    display clearing color
- */
-void GLCD_Clear(unsigned short color);
-
-/**
- * @brief      Set foreground color
- * @param[in]  color    foreground color
- */
-void GLCD_SetTextColor(unsigned short color);
-
-/**
- * @brief      Display character on given line
- * @param[in]  ln    line number
- * @param[in]  col   column number
- * @param[in]  fi    font index (0 = 9x15)
- * @param[in]  c     ASCII character
- */
-void GLCD_DisplayChar(unsigned int ln, unsigned int col,
-                    unsigned char fi, unsigned char  c);
-
-/**
- * @brief      Display string on given line
- * @param[in]  ln    line number
- * @param[in]  col   column number
- * @param[in]  fi    font index (0 = 9x15)
- * @param[in]  s     pointer to string
- */
-void GLCD_DisplayString(unsigned int ln, unsigned int col,
-                        unsigned char fi, char *s);
-
-/**
- * @brief      Draw box filled with color
- * @param[in]  x        horizontal position
- * @param[in]  y:       vertical position
- * @param[in]  w:       window width in pixels
- * @param[in]  h:       window height in pixels
- * @param[in]  color    box color
- */
-void GLCD_Box(unsigned int x, unsigned int y,
-            unsigned int w, unsigned int h,
-            unsigned short color);
-
-#endif /* STUBS_SIMPLE_PLATFORM_H */
diff --git a/source/hal/profiles/native/data_acquisition/data_acq.c b/source/hal/profiles/native/data_acquisition/data_acq.c
deleted file mode 100644
index 9b6815b..0000000
--- a/source/hal/profiles/native/data_acquisition/data_acq.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2021 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 "data_acq.h"
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-/**
- * @brief   Initialize the acuisition.
- * @return  0 if successful, error code otherwise.
- **/
-static int acquisition_init(void)
-{
-    return 0;
-}
-
-/**
- * @brief           Get the user input from stdin.
- * @param[out]      user_input  String read from the stdin.
- * @param[in,out]   size        String read length.
- * @return          0 if successful, error code otherwise.
- **/
-static int get_user_input(char* user_input, int size)
-{
-    if (NULL == fgets(user_input, size, stdin)) {
-        return 1;
-    }
-    return 0;
-}
-
-int data_acq_channel_init(data_acq_module *module)
-{
-    assert(module);
-
-    module->system_init = acquisition_init;
-    module->get_input = get_user_input;
-    strncpy(module->system_name, "native",
-            sizeof(module->system_name));
-    module->inited = !module->system_init();
-    return !module->inited;
-}
-
-int data_acq_channel_release(data_acq_module *module)
-{
-    assert(module);
-    module->inited = 0;
-    return 0;
-}
diff --git a/source/hal/profiles/native/data_presentation/data_psn.c b/source/hal/profiles/native/data_presentation/data_psn.c
deleted file mode 100644
index fe4bcfa..0000000
--- a/source/hal/profiles/native/data_presentation/data_psn.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2021 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 "data_psn.h"
-
-#include "log.h"
-
-#include <assert.h>
-#include <string.h>
-
-int data_psn_system_init(data_psn_module *module)
-{
-    assert(module);
-
-    module->system_init = log_psn_init;
-    module->present_data_image = log_display_image;
-    module->present_data_text = log_display_text;
-    module->present_box = log_display_box_icon;
-    module->set_text_color = log_set_text_color;
-    module->clear = log_clear;
-    strncpy(module->system_name, "log_psn", sizeof(module->system_name));
-    module->inited =  !module->system_init();
-    return !module->inited;
-}
-
-int data_psn_system_release(data_psn_module *module)
-{
-    /* Nothing to do here! */
-    assert(module);
-    module->inited = 0;
-    return 0;
-}
diff --git a/source/hal/profiles/native/data_presentation/log/include/log.h b/source/hal/profiles/native/data_presentation/log/include/log.h
deleted file mode 100644
index 796d0ef..0000000
--- a/source/hal/profiles/native/data_presentation/log/include/log.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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");
- * 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 NATIVE_LOG_H
-#define NATIVE_LOG_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-/**
- * @brief  Data presentation initialiser
- **/
-int log_psn_init(void);
-
-/**
- * @brief       Log parameters for the image to be displayed.
- * @param[in]   data        Image pointer.
- * @param[in]   width       Image width.
- * @param[in]   height      Image height.
- * @param[in]   channels    Number of channels.
- * @param[in]   pos_x       Screen position x co-ordinate.
- * @param[in]   pos_y       Screen position y co-ordinate.
- * @param[in]   downsample_factor   Factor by which the image needs to be
- *                                  down-sampled.
- * @return      0 if successful, non-zero otherwise.
- **/
-
-int log_display_image(const uint8_t* 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       Log the parameters for text to be displayed.
- * @param[in]   str         Pointer to a null terminated string.
- * @param[in]   str_sz      Length of the string.
- * @param[in]   pos_x       Screen position x co-ordinate.
- * @param[in]   pos_y       Screen position y co-ordinate.
- * @param[in]   allow_multiple_lines  Specifies if multiple lines are allowed.
- * @return      0 if successful, non-zero otherwise.
- **/
-int log_display_text(const char* str, const size_t str_sz,
-                     const uint32_t pos_x, const uint32_t pos_y,
-                     const bool allow_multiple_lines);
-
-/**
- * @brief       Log parameters for the box to be displayed.
- * @param[in]   pos_x       Screen position x co-ordinate.
- * @param[in]   pos_y       Screen position y co-ordinate.
- * @param[in]   width       Width.
- * @param[in]   height      Height.
- * @param[in]   color       Fill color.
- * @return      0 if successful, non-zero otherwise.
- **/
-int log_display_box_icon(const uint32_t pos_x, const uint32_t pos_y,
-                         const uint32_t width, const uint32_t height, const uint16_t color);
-
-/**
- * @brief       Logs the colour with which the display
- *              needs to be cleared with.
- * @param[in]   color       Fill color.
- * @return      0 if successful, non-zero otherwise.
- **/
-int log_clear(const uint16_t color);
-
-/**
- * @brief       Logs the text color to be set.
- * @param[in]   color       Fill color.
- * @return 0 if successful, non-zero otherwise.
- **/
-int log_set_text_color (const uint16_t color);
-
-#endif /* NATIVE_LOG_H */
\ No newline at end of file
diff --git a/source/hal/profiles/native/data_presentation/log/log.c b/source/hal/profiles/native/data_presentation/log/log.c
deleted file mode 100644
index e37b4ca..0000000
--- a/source/hal/profiles/native/data_presentation/log/log.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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");
- * 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 "log.h"
-#include "log_macros.h"
-
-#include <stdint.h>
-
-#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
-    #pragma clang diagnostic push
-    #pragma clang diagnostic ignored "-Wunused-parameter"
-#elif defined(__GNUC__)
-    #pragma GCC diagnostic push
-    #pragma GCC diagnostic ignored "-Wunused-parameter"
-#endif
-
-int log_psn_init(void)
-{
-    return 0;
-}
-
-int log_display_image(const uint8_t* 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)
-{
-    debug("Image details\n");
-    debug("Data:                 %p\n", data);
-    debug("WxHxC:                %dx%dx%d\n", width, height, channels);
-    debug("Pos (x,y):            (%d,%d)\n", pos_x, pos_y);
-    debug("Downsampling factor:  %u\n", downsample_factor);
-    return 0;
-}
-
-int log_display_text(const char* str, const size_t str_sz,
-                     const uint32_t pos_x, const uint32_t pos_y,
-                     const bool allow_multiple_lines)
-{
-    UNUSED(allow_multiple_lines);
-    debug("%s\n", str);
-    debug("Text size: %lu, x: %d, y: %d\n", str_sz, pos_x, pos_y);
-    return 0;
-}
-
-
-int log_display_box_icon(const uint32_t pos_x, const uint32_t pos_y,
-                         const uint32_t width, const uint32_t height,
-                         const uint16_t color)
-{
-    debug("Showing rectangular, width: %d, height: %d, color: %d, x: %d, y: %d\n",
-            width, height, color, pos_x, pos_y);
-    return 0;
-}
-
-int log_clear(const uint16_t color)
-{
-    debug("Clearing with color: %d\n", color);
-    return 0;
-}
-
-int log_set_text_color (const uint16_t color)
-{
-    debug("Setting text color: %d\n", color);
-    return 0;
-}
-
-#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
-    #pragma clang diagnostic pop
-#elif defined(__GNUC__)
-    #pragma GCC diagnostic pop
-#endif
diff --git a/source/hal/cmsis_device/CMakeLists.txt b/source/hal/source/components/cmsis_device/CMakeLists.txt
similarity index 87%
rename from source/hal/cmsis_device/CMakeLists.txt
rename to source/hal/source/components/cmsis_device/CMakeLists.txt
index 05c6005..dcaeff5 100644
--- a/source/hal/cmsis_device/CMakeLists.txt
+++ b/source/hal/source/components/cmsis_device/CMakeLists.txt
@@ -21,6 +21,7 @@
 cmake_minimum_required(VERSION 3.15.6)
 
 set(CMSIS_DEVICE_TARGET cmsis_device)
+set(CPU_HEADER_TARGET cmsis_device_cpu_header)
 
 project(${CMSIS_DEVICE_TARGET}
     DESCRIPTION     "Generic CMSIS start up file for Cortex-M targets"
@@ -36,22 +37,26 @@
     message(FATAL_ERROR "CMSIS_SRC_PATH path should be defined for ${CMSIS_DEVICE_TARGET}.")
 endif()
 
-# 3. Create static library
-add_library(${CMSIS_DEVICE_TARGET} STATIC)
+# 3.1 Create an interface library for CPU header only
+add_library(${CPU_HEADER_TARGET} INTERFACE)
 
-## Include directories - public
-target_include_directories(${CMSIS_DEVICE_TARGET}
-    PUBLIC
+## Interface include directories:
+target_include_directories(${CPU_HEADER_TARGET}
+    INTERFACE
     include
     ${CMSIS_SRC_PATH}/CMSIS/Core/Include
     ${CMSIS_SRC_PATH}/Device/ARM/${ARM_CPU}/Include
     ${CMSIS_SRC_PATH}/Device/ARM/${ARM_CPU}/Include/Template)
 
-## Sources
+# 3.2 Create static library
+add_library(${CMSIS_DEVICE_TARGET} STATIC)
+
+## Sources - public
 target_sources(${CMSIS_DEVICE_TARGET}
         PUBLIC
         source/handlers.c)
 
+## Sources - private
 target_sources(${CMSIS_DEVICE_TARGET}
     PRIVATE
     ${CMSIS_SRC_PATH}/Device/ARM/${ARM_CPU}/Source/system_${ARM_CPU}.c
@@ -66,6 +71,11 @@
     INTERFACE
     --entry Reset_Handler)
 
+# Link libraries
+target_link_libraries(${CMSIS_DEVICE_TARGET}
+    PUBLIC
+    ${CPU_HEADER_TARGET})
+
 # Check if semihosting configuration is available
 if (COMMAND configure_semihosting)
     configure_semihosting(${CMSIS_DEVICE_TARGET} OFF)
diff --git a/source/hal/cmsis_device/include/RTE_Components.h b/source/hal/source/components/cmsis_device/include/RTE_Components.h
similarity index 100%
rename from source/hal/cmsis_device/include/RTE_Components.h
rename to source/hal/source/components/cmsis_device/include/RTE_Components.h
diff --git a/source/hal/cmsis_device/source/handlers.c b/source/hal/source/components/cmsis_device/source/handlers.c
similarity index 100%
rename from source/hal/cmsis_device/source/handlers.c
rename to source/hal/source/components/cmsis_device/source/handlers.c
diff --git a/source/hal/source/components/lcd/CMakeLists.txt b/source/hal/source/components/lcd/CMakeLists.txt
new file mode 100644
index 0000000..7378713
--- /dev/null
+++ b/source/hal/source/components/lcd/CMakeLists.txt
@@ -0,0 +1,90 @@
+#----------------------------------------------------------------------------
+#  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.
+#----------------------------------------------------------------------------
+
+#########################################################
+# LCD library                                           #
+#########################################################
+
+cmake_minimum_required(VERSION 3.15.6)
+
+project(lcd_component
+    DESCRIPTION     "LCD support library"
+    LANGUAGES       C CXX ASM)
+
+# Add top level interface library
+set(LCD_IFACE_TARGET lcd_iface)
+add_library(${LCD_IFACE_TARGET} INTERFACE)
+target_include_directories(${LCD_IFACE_TARGET} INTERFACE include)
+
+# Create static library for MPS3 LCD
+set(LCD_MPS3_COMPONENT_TARGET lcd_mps3)
+add_library(${LCD_MPS3_COMPONENT_TARGET} STATIC)
+
+set(CLCD_CONFIG_BASE "0x4930A000" CACHE STRING "LCD configuration base address")
+
+## Include directories - private
+target_include_directories(${LCD_MPS3_COMPONENT_TARGET}
+    PRIVATE
+    source)
+
+## Component sources
+target_sources(${LCD_MPS3_COMPONENT_TARGET}
+    PRIVATE
+    source/glcd_mps3/glcd_mps3.c
+    source/lcd_img.c)
+
+# Compile definitions
+target_compile_definitions(${LCD_MPS3_COMPONENT_TARGET}
+    PRIVATE
+    CLCD_CONFIG_BASE=${CLCD_CONFIG_BASE})
+
+## Add dependencies
+target_link_libraries(${LCD_MPS3_COMPONENT_TARGET} PUBLIC
+    ${LCD_IFACE_TARGET}
+    log)
+
+# Display status
+message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
+message(STATUS "*******************************************************")
+message(STATUS "Library                                : " ${LCD_MPS3_COMPONENT_TARGET})
+message(STATUS "*******************************************************")
+
+# Create static library for LCD Stubs
+set(LCD_STUBS_COMPONENT_TARGET lcd_stubs)
+add_library(${LCD_STUBS_COMPONENT_TARGET} STATIC)
+
+## Include directories - private
+target_include_directories(${LCD_STUBS_COMPONENT_TARGET}
+    PRIVATE
+    source)
+
+## Component sources
+target_sources(${LCD_STUBS_COMPONENT_TARGET}
+    PRIVATE
+    source/glcd_stubs/glcd_stubs.c
+    source/lcd_img.c)
+
+## Add dependencies
+target_link_libraries(${LCD_STUBS_COMPONENT_TARGET} PUBLIC
+    ${LCD_IFACE_TARGET}
+    log)
+
+# Display status
+message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
+message(STATUS "*******************************************************")
+message(STATUS "Library                                : " ${LCD_STUBS_COMPONENT_TARGET})
+message(STATUS "*******************************************************")
\ No newline at end of file
diff --git a/source/hal/profiles/bare-metal/data_presentation/lcd/include/lcd_img.h b/source/hal/source/components/lcd/include/lcd_img.h
similarity index 100%
rename from source/hal/profiles/bare-metal/data_presentation/lcd/include/lcd_img.h
rename to source/hal/source/components/lcd/include/lcd_img.h
diff --git a/source/hal/platform/mps3/include/glcd_mps3.h b/source/hal/source/components/lcd/source/glcd.h
similarity index 98%
rename from source/hal/platform/mps3/include/glcd_mps3.h
rename to source/hal/source/components/lcd/source/glcd.h
index 5cb5a54..a54c6d0 100644
--- a/source/hal/platform/mps3/include/glcd_mps3.h
+++ b/source/hal/source/components/lcd/source/glcd.h
@@ -14,8 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef GLCD_MPS3_H
-#define GLCD_MPS3_H
+#ifndef GLCD_H
+#define GLCD_H
 
 #include <stdint.h>
 
@@ -199,4 +199,4 @@
             unsigned int w, unsigned int h,
             unsigned short color);
 
-#endif /* GLCD_MPS3_H */
+#endif /* GLCD_H */
diff --git a/source/hal/platform/mps3/source/font_9x15_h.h b/source/hal/source/components/lcd/source/glcd_mps3/font_9x15_h.h
similarity index 100%
rename from source/hal/platform/mps3/source/font_9x15_h.h
rename to source/hal/source/components/lcd/source/glcd_mps3/font_9x15_h.h
diff --git a/source/hal/platform/mps3/source/glcd_mps3.c b/source/hal/source/components/lcd/source/glcd_mps3/glcd_mps3.c
similarity index 95%
rename from source/hal/platform/mps3/source/glcd_mps3.c
rename to source/hal/source/components/lcd/source/glcd_mps3/glcd_mps3.c
index 9a375f2..c67483e 100644
--- a/source/hal/platform/mps3/source/glcd_mps3.c
+++ b/source/hal/source/components/lcd/source/glcd_mps3/glcd_mps3.c
@@ -14,13 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "glcd_mps3.h"
+#include "glcd.h"
 
 #include "log_macros.h"
 #include "font_9x15_h.h"
-#include "smm_mps3.h"
 
-#include "peripheral_memmap.h"      /* Peripheral memory map definitions. */
+#define CLCD_CS_Pos        0
+#define CLCD_CS_Msk        (1UL<<CLCD_CS_Pos)
+#define SHIELD_0_nCS_Pos   1
+#define SHIELD_0_nCS_Msk   (1UL<<SHIELD_0_nCS_Pos)
+#define SHIELD_1_nCS_Pos   2
+#define SHIELD_1_nCS_Msk   (1UL<<SHIELD_1_nCS_Pos)
+#define CLCD_RESET_Pos     3
+#define CLCD_RESET_Msk     (1UL<<CLCD_RESET_Pos)
+#define CLCD_RS_Pos        4
+#define CLCD_RS_Msk        (1UL<<CLCD_RS_Pos)
+#define CLCD_RD_Pos        5
+#define CLCD_RD_Msk        (1UL<<CLCD_RD_Pos)
+#define CLCD_BL_Pos        6
+#define CLCD_BL_Msk        (1UL<<CLCD_BL_Pos)
 
 /*-------------- CLCD Controller Internal Register addresses ----------------*/
 #define CHAR_COM        ((volatile unsigned int *)(CLCD_CONFIG_BASE + 0x000))
diff --git a/source/hal/platform/simple/source/stubs_glcd.c b/source/hal/source/components/lcd/source/glcd_stubs/glcd_stubs.c
similarity index 98%
rename from source/hal/platform/simple/source/stubs_glcd.c
rename to source/hal/source/components/lcd/source/glcd_stubs/glcd_stubs.c
index d843cf4..5df1522 100644
--- a/source/hal/platform/simple/source/stubs_glcd.c
+++ b/source/hal/source/components/lcd/source/glcd_stubs/glcd_stubs.c
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "stubs/glcd.h"
+#include "glcd.h"
 #include "log_macros.h"
 
 #include <inttypes.h>
diff --git a/source/hal/profiles/bare-metal/data_presentation/lcd/lcd_img.c b/source/hal/source/components/lcd/source/lcd_img.c
similarity index 98%
rename from source/hal/profiles/bare-metal/data_presentation/lcd/lcd_img.c
rename to source/hal/source/components/lcd/source/lcd_img.c
index 6e05f29..e3921a9 100644
--- a/source/hal/profiles/bare-metal/data_presentation/lcd/lcd_img.c
+++ b/source/hal/source/components/lcd/source/lcd_img.c
@@ -17,7 +17,7 @@
 #include "lcd_img.h"
 
 #include "log_macros.h"
-#include "platform_drivers.h"
+#include "glcd.h"
 
 #include <string.h>
 #include <assert.h>
diff --git a/source/hal/components/ethosu_npu_init/CMakeLists.txt b/source/hal/source/components/npu/CMakeLists.txt
similarity index 96%
rename from source/hal/components/ethosu_npu_init/CMakeLists.txt
rename to source/hal/source/components/npu/CMakeLists.txt
index 59f32bd..804fb45 100644
--- a/source/hal/components/ethosu_npu_init/CMakeLists.txt
+++ b/source/hal/source/components/npu/CMakeLists.txt
@@ -20,7 +20,7 @@
 #########################################################
 
 cmake_minimum_required(VERSION 3.15.6)
-set(ETHOS_U_NPU_INIT_COMPONENT ethosu_npu_init_component)
+set(ETHOS_U_NPU_INIT_COMPONENT ethos_u_npu)
 project(${ETHOS_U_NPU_INIT_COMPONENT}
     DESCRIPTION     "Ethos-U NPU initialization library"
     LANGUAGES       C CXX ASM)
@@ -85,16 +85,18 @@
 ## Component sources
 target_sources(${ETHOS_U_NPU_INIT_COMPONENT}
     PRIVATE
-    ethosu_npu_init.c)
+    ethosu_npu_init.c
+    ethosu_cpu_cache.c)
 
 ## Add dependencies:
 target_link_libraries(${ETHOS_U_NPU_INIT_COMPONENT} PUBLIC
-    cmsis_device
+    cmsis_device_cpu_header
     ethosu_core_driver
     log)
 
 target_compile_definitions(${ETHOS_U_NPU_INIT_COMPONENT}
     PUBLIC
+    ARM_NPU
     ${ETHOS_U_NPU_MEMORY_MODE_FLAG})
 
 # Display status
diff --git a/source/hal/source/components/npu/ethosu_cpu_cache.c b/source/hal/source/components/npu/ethosu_cpu_cache.c
new file mode 100644
index 0000000..13f6f0a
--- /dev/null
+++ b/source/hal/source/components/npu/ethosu_cpu_cache.c
@@ -0,0 +1,54 @@
+/*
+ * 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 "ethosu_cpu_cache.h"
+
+#include "RTE_Components.h"         /* For CPU related defintiions */
+#include "ethosu_driver.h"          /* Arm Ethos-U driver header */
+#include "log_macros.h"             /* Logging macros */
+
+void ethosu_flush_dcache(uint32_t *p, size_t bytes)
+{
+#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+    if (SCB->CCR & SCB_CCR_DC_Msk) {
+        if (p) {
+            SCB_CleanDCache_by_Addr((void *) p, (int32_t) bytes);
+        } else {
+            SCB_CleanDCache();
+        }
+    }
+#else
+    UNUSED(p);
+    UNUSED(bytes);
+#endif /* defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) */
+}
+
+void ethosu_invalidate_dcache(uint32_t *p, size_t bytes)
+{
+#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
+    if (SCB->CCR & SCB_CCR_DC_Msk) {
+        if (p) {
+            SCB_InvalidateDCache_by_Addr((void *) p, (int32_t) bytes);
+        } else {
+            SCB_InvalidateDCache();
+        }
+    }
+#else
+    UNUSED(p);
+    UNUSED(bytes);
+#endif /* defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) */
+}
diff --git a/source/hal/components/ethosu_npu_init/ethosu_npu_init.c b/source/hal/source/components/npu/ethosu_npu_init.c
similarity index 95%
rename from source/hal/components/ethosu_npu_init/ethosu_npu_init.c
rename to source/hal/source/components/npu/ethosu_npu_init.c
index 161d613..9ccd887 100644
--- a/source/hal/components/ethosu_npu_init/ethosu_npu_init.c
+++ b/source/hal/source/components/npu/ethosu_npu_init.c
@@ -33,12 +33,12 @@
 static uint8_t *cache_arena = NULL;
 #endif /* defined (ETHOS_U_CACHE_BUF_SZ) && (ETHOS_U_CACHE_BUF_SZ > 0) */
 
-uint8_t *get_cache_arena()
+static uint8_t *get_cache_arena()
 {
     return cache_arena;
 }
 
-size_t get_cache_arena_size()
+static size_t get_cache_arena_size()
 {
 #if defined(ETHOS_U_CACHE_BUF_SZ) && (ETHOS_U_CACHE_BUF_SZ > 0)
     return sizeof(cache_arena);
@@ -51,7 +51,7 @@
  * @brief   Defines the Ethos-U interrupt handler: just a wrapper around the default
  *          implementation.
  **/
-void arm_ethosu_npu_irq_handler(void)
+static void arm_ethosu_npu_irq_handler(void)
 {
     /* Call the default interrupt handler from the NPU driver */
     ethosu_irq_handler(&ethosu_drv);
@@ -60,7 +60,7 @@
 /**
  * @brief  Initialises the NPU IRQ
  **/
-void arm_ethosu_npu_irq_init(void)
+static void arm_ethosu_npu_irq_init(void)
 {
     const IRQn_Type ethosu_irqnum = (IRQn_Type)EthosU_IRQn;
 
diff --git a/source/hal/source/components/npu/include/ethosu_cpu_cache.h b/source/hal/source/components/npu/include/ethosu_cpu_cache.h
new file mode 100644
index 0000000..9f21acf
--- /dev/null
+++ b/source/hal/source/components/npu/include/ethosu_cpu_cache.h
@@ -0,0 +1,39 @@
+/*
+ * 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 ETHOSU_CPU_CACHE
+#define ETHOSU_CPU_CACHE
+
+#include <stdint.h>
+#include <stddef.h>
+
+/**
+ * @brief   Flush/clean the data cache by address and size. Passing NULL as p argument
+ *          expects the whole cache to be flushed.
+ * @param[in]   p       Pointer to the start address.
+ * @param[in]   bytes   Number of bytes to flush beginning at start address.
+ */
+void ethosu_flush_dcache(uint32_t *p, size_t bytes);
+
+/**
+ * @brief   Invalidate the data cache by address and size. Passing NULL as p argument
+ *          expects the whole cache to be invalidated.
+ * @param[in]   p       Pointer to the start address.
+ * @param[in]   bytes   Number of bytes to flush beginning at start address.
+ */
+void ethosu_invalidate_dcache(uint32_t *p, size_t bytes);
+
+#endif /* ETHOSU_CPU_CACHE */
diff --git a/source/hal/components/ethosu_npu_init/include/ethosu_mem_config.h b/source/hal/source/components/npu/include/ethosu_mem_config.h
similarity index 100%
rename from source/hal/components/ethosu_npu_init/include/ethosu_mem_config.h
rename to source/hal/source/components/npu/include/ethosu_mem_config.h
diff --git a/source/hal/components/ethosu_npu_init/include/ethosu_npu_init.h b/source/hal/source/components/npu/include/ethosu_npu_init.h
similarity index 100%
rename from source/hal/components/ethosu_npu_init/include/ethosu_npu_init.h
rename to source/hal/source/components/npu/include/ethosu_npu_init.h
diff --git a/source/hal/components/ethosu_ta_init/CMakeLists.txt b/source/hal/source/components/npu_ta/CMakeLists.txt
similarity index 84%
rename from source/hal/components/ethosu_ta_init/CMakeLists.txt
rename to source/hal/source/components/npu_ta/CMakeLists.txt
index b5f94c1..fdda723 100644
--- a/source/hal/components/ethosu_ta_init/CMakeLists.txt
+++ b/source/hal/source/components/npu_ta/CMakeLists.txt
@@ -19,8 +19,13 @@
 #  Ethos-U NPU timing adapter initialization library    #
 #########################################################
 
+# Timing adapter component is only available on certain implementations
+# on FPGA and FVP where it is necessary to run bandwidth and latency
+# sweeps on the Arm Ethos-U NPUs. The wrapper library here provides an
+# easy way to add initialisation of the timing adapter block.
+
 cmake_minimum_required(VERSION 3.15.6)
-set(ETHOS_U_NPU_TA_COMPONENT ethosu_ta_init_component)
+set(ETHOS_U_NPU_TA_COMPONENT ethos_u_ta)
 project(${ETHOS_U_NPU_TA_COMPONENT}
     DESCRIPTION     "Ethos-U NPU timing adapter initialization library"
     LANGUAGES       C CXX ASM)
@@ -55,6 +60,11 @@
     PRIVATE
     ethosu_ta_init.c)
 
+## Compile definitions
+target_compile_definitions(${ETHOS_U_NPU_TA_COMPONENT}
+    PUBLIC
+    ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
+
 ## Add dependencies
 target_link_libraries(${ETHOS_U_NPU_TA_COMPONENT} PUBLIC
     timing_adapter
diff --git a/source/hal/components/ethosu_ta_init/cmake/templates/timing_adapter_settings.template b/source/hal/source/components/npu_ta/cmake/templates/timing_adapter_settings.template
similarity index 100%
rename from source/hal/components/ethosu_ta_init/cmake/templates/timing_adapter_settings.template
rename to source/hal/source/components/npu_ta/cmake/templates/timing_adapter_settings.template
diff --git a/source/hal/components/ethosu_ta_init/ethosu_ta_init.c b/source/hal/source/components/npu_ta/ethosu_ta_init.c
similarity index 100%
rename from source/hal/components/ethosu_ta_init/ethosu_ta_init.c
rename to source/hal/source/components/npu_ta/ethosu_ta_init.c
diff --git a/source/hal/components/ethosu_ta_init/include/ethosu_ta_init.h b/source/hal/source/components/npu_ta/include/ethosu_ta_init.h
similarity index 100%
rename from source/hal/components/ethosu_ta_init/include/ethosu_ta_init.h
rename to source/hal/source/components/npu_ta/include/ethosu_ta_init.h
diff --git a/source/hal/source/components/stdout/CMakeLists.txt b/source/hal/source/components/stdout/CMakeLists.txt
new file mode 100644
index 0000000..f1e26ff
--- /dev/null
+++ b/source/hal/source/components/stdout/CMakeLists.txt
@@ -0,0 +1,110 @@
+#----------------------------------------------------------------------------
+#  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.
+#----------------------------------------------------------------------------
+
+#########################################################
+#  Wrapper for enabling stdout and stderr facility      #
+#########################################################
+# This is a wrapper around the UART module for CMSDK    #
+# and PL011 UART drivers with retarget functions.       #
+#########################################################
+
+cmake_minimum_required(VERSION 3.15.6)
+
+project(stdout
+    DESCRIPTION     "Standard output and err redirection over UART"
+    LANGUAGES       C CXX)
+
+
+set(STDOUT_RETARGET     OFF CACHE BOOL "Retarget stdout/err to UART")
+
+# Interface library for standard output:
+set(STDOUT_IFACE_TARGET stdout_iface)
+add_library(${STDOUT_IFACE_TARGET} INTERFACE)
+target_include_directories(${STDOUT_IFACE_TARGET} INTERFACE include)
+
+if (STDOUT_RETARGET)
+
+    set(STDOUT_COMPONENT_CMSDK stdout_retarget_cmsdk)
+    set(STDOUT_COMPONENT_PL011 stdout_retarget_pl011)
+
+    add_library(${STDOUT_COMPONENT_CMSDK} STATIC)
+    add_library(${STDOUT_COMPONENT_PL011} STATIC)
+
+    # Check prerequisites
+    ## Core platform directory is required to add the UART library project.
+    if (NOT DEFINED CORE_PLATFORM_DIR)
+        message(FATAL_ERROR "CORE_PLATFORM_DIR undefined")
+    endif()
+
+    ## UART0_BASE is the base address for UART configuration. The platform
+    ## should define it prior to including this library.
+    if (NOT DEFINED UART0_BASE)
+        message(WARNING "UART0_BASE undefined, default will be used.")
+    endif()
+
+    ## Platform component: UART
+    add_subdirectory(${CORE_PLATFORM_DIR}/drivers/uart ${CMAKE_BINARY_DIR}/uart)
+
+    ## Component sources - public
+    target_sources(${STDOUT_COMPONENT_CMSDK}
+        PUBLIC
+        source/retarget.c)
+
+    ## Component sources - public
+    target_sources(${STDOUT_COMPONENT_PL011}
+        PUBLIC
+        source/retarget.c)
+
+    # Link
+    target_link_libraries(${STDOUT_COMPONENT_CMSDK}
+        PUBLIC
+        ${STDOUT_IFACE_TARGET}
+        ethosu_uart_cmsdk_apb)
+
+    target_link_libraries(${STDOUT_COMPONENT_PL011}
+        PUBLIC
+        ${STDOUT_IFACE_TARGET}
+        ethosu_uart_pl011)
+
+    # Display status
+    message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
+    message(STATUS "*******************************************************")
+    message(STATUS "Library:                  " ${STDOUT_COMPONENT_CMSDK})
+    message(STATUS "Library:                  " ${STDOUT_COMPONENT_PL011})
+    message(STATUS "*******************************************************")
+
+else()
+
+    # Create static library for retarget (stdout/err over UART)
+    set(STDOUT_COMPONENT stdout)
+    add_library(${STDOUT_COMPONENT} STATIC)
+
+    ## Component sources - public
+    target_sources(${STDOUT_COMPONENT}
+        PUBLIC
+        source/user_input.c)
+
+    target_link_libraries(${STDOUT_COMPONENT}
+        PUBLIC
+        ${STDOUT_IFACE_TARGET})
+
+    # Display status
+    message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR})
+    message(STATUS "*******************************************************")
+    message(STATUS "Library:                  " ${STDOUT_COMPONENT})
+    message(STATUS "*******************************************************")
+endif()
diff --git a/source/hal/source/components/stdout/include/user_input.h b/source/hal/source/components/stdout/include/user_input.h
new file mode 100644
index 0000000..e76b418
--- /dev/null
+++ b/source/hal/source/components/stdout/include/user_input.h
@@ -0,0 +1,30 @@
+/*
+ * 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 STDOUT_USER_INPUT_H
+#define STDOUT_USER_INPUT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+unsigned int GetLine(char *user_input, unsigned int size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* STDOUT_USER_INPUT_H */
diff --git a/source/hal/profiles/bare-metal/bsp/retarget.c b/source/hal/source/components/stdout/source/retarget.c
similarity index 100%
rename from source/hal/profiles/bare-metal/bsp/retarget.c
rename to source/hal/source/components/stdout/source/retarget.c
diff --git a/source/hal/source/components/stdout/source/user_input.c b/source/hal/source/components/stdout/source/user_input.c
new file mode 100644
index 0000000..e5fe1b9
--- /dev/null
+++ b/source/hal/source/components/stdout/source/user_input.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.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+
+unsigned int GetLine(char *user_input, unsigned int size)
+{
+    if (NULL != fgets(user_input, size, stdin)) {
+        return 1;
+    }
+    return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/source/hal/profiles/bare-metal/data_acquisition/data_acq.c b/source/hal/source/data_acq.c
similarity index 98%
rename from source/hal/profiles/bare-metal/data_acquisition/data_acq.c
rename to source/hal/source/data_acq.c
index 84d80a6..ec6c725 100644
--- a/source/hal/profiles/bare-metal/data_acquisition/data_acq.c
+++ b/source/hal/source/data_acq.c
@@ -18,7 +18,6 @@
 
 #include "log_macros.h"
 #include "platform_drivers.h"
-#include "uart_stdout.h"
 
 #include <assert.h>
 #include <stdlib.h>
diff --git a/source/hal/profiles/bare-metal/data_presentation/data_psn.c b/source/hal/source/data_psn.c
similarity index 100%
rename from source/hal/profiles/bare-metal/data_presentation/data_psn.c
rename to source/hal/source/data_psn.c
diff --git a/source/hal/hal.c b/source/hal/source/hal.c
similarity index 100%
rename from source/hal/hal.c
rename to source/hal/source/hal.c
diff --git a/source/hal/platform/mps3/CMakeLists.txt b/source/hal/source/platform/mps3/CMakeLists.txt
similarity index 76%
rename from source/hal/platform/mps3/CMakeLists.txt
rename to source/hal/source/platform/mps3/CMakeLists.txt
index 7ef4ed4..8bd51dc 100644
--- a/source/hal/platform/mps3/CMakeLists.txt
+++ b/source/hal/source/platform/mps3/CMakeLists.txt
@@ -41,6 +41,14 @@
 ## Include the platform cmake descriptor file
 include(${PLATFORM_CMAKE_DESCRIPTOR_FILE})
 
+# Define target specific base addresses here (before adding the components)
+if (TARGET_SUBSYSTEM STREQUAL sse-300)
+    set(UART0_BASE          "0x49303000"    CACHE STRING "UART base address")
+    set(UART0_BAUDRATE      "115200"        CACHE STRING "UART baudrate")
+    set(SYSTEM_CORE_CLOCK   "25000000"      CACHE STRING "System peripheral clock (Hz)")
+    set(CLCD_CONFIG_BASE    "0x4930A000"    CACHE STRING "LCD configuration base address")
+endif()
+
 # 3. Generate sources:
 if (NOT DEFINED SOURCE_GEN_DIR)
     set(SOURCE_GEN_DIR ${CMAKE_BINARY_DIR}/generated/bsp)
@@ -54,7 +62,7 @@
 configure_file("${IRQ_PROFILE_TEMPLATE}" "${SOURCE_GEN_DIR}/peripheral_irqs.h")
 configure_file("${MEM_REGIONS_TEMPLATE}" "${SOURCE_GEN_DIR}/mem_regions.h")
 
-# 4. Create static library
+# Create static library
 add_library(${PLATFORM_DRIVERS_TARGET} STATIC)
 
 ## Include directories - private
@@ -71,56 +79,53 @@
 ## Platform sources
 target_sources(${PLATFORM_DRIVERS_TARGET}
     PRIVATE
-    source/device_mps3.c
     source/timer_mps3.c
-    source/platform_drivers.c
-    source/glcd_mps3.c)
+    source/platform_drivers.c)
+
+## Compile definitions
+target_compile_definitions(${PLATFORM_DRIVERS_TARGET}
+    PUBLIC
+    ACTIVATION_BUF_SRAM_SZ=${ACTIVATION_BUF_SRAM_SZ})
 
 ## Directory for additional components required by MPS3:
 if (NOT DEFINED COMPONENTS_DIR)
     set(COMPONENTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../components)
 endif()
 
-## This target provides the following definitions for MPS3 specific behaviour
-## TODO: We should aim to remove this now with platform refactoring..
-target_compile_definitions(${PLATFORM_DRIVERS_TARGET}
-    PUBLIC
-    MPS3_PLATFORM
-    ACTIVATION_BUF_SRAM_SZ=${ACTIVATION_BUF_SRAM_SZ})
+## Platform component: cmsis_device (provides generic Cortex-M start up library)
+add_subdirectory(${COMPONENTS_DIR}/cmsis_device ${CMAKE_BINARY_DIR}/cmsis_device)
 
-## Platform component: uart
-add_subdirectory(${DEPENDENCY_ROOT_DIR}/core-platform/drivers/uart ${CMAKE_BINARY_DIR}/uart)
+## Platform component: stdout
+set(STDOUT_RETARGET ON CACHE BOOL "Retarget stdout/err to UART")
+add_subdirectory(${COMPONENTS_DIR}/stdout ${CMAKE_BINARY_DIR}/stdout)
+
+## Platform component: lcd
+add_subdirectory(${COMPONENTS_DIR}/lcd ${CMAKE_BINARY_DIR}/lcd)
 
 # Add dependencies:
 target_link_libraries(${PLATFORM_DRIVERS_TARGET} PUBLIC
     log
     cmsis_device
-    ethosu_uart_cmsdk_apb)
+    lcd_mps3
+    $<IF:$<BOOL:STDOUT_RETARGET>,stdout_retarget_cmsdk,stdout>)
 
 # If Ethos-U is enabled, we need the driver library too
 if (ETHOS_U_NPU_ENABLED)
 
-    target_compile_definitions(${PLATFORM_DRIVERS_TARGET}
-        PUBLIC
-        ARM_NPU)
-
     ## Platform component: Ethos-U initialization
-    add_subdirectory(${COMPONENTS_DIR}/ethosu_npu_init ${CMAKE_BINARY_DIR}/ethosu_npu_init)
+    add_subdirectory(${COMPONENTS_DIR}/npu ${CMAKE_BINARY_DIR}/npu)
 
     target_link_libraries(${PLATFORM_DRIVERS_TARGET}
         PUBLIC
-        ethosu_npu_init_component)
+        ethos_u_npu)
 
     if (ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
         ## Platform component: Ethos-U timing adapter initialization
-        add_subdirectory(${COMPONENTS_DIR}/ethosu_ta_init ${CMAKE_BINARY_DIR}/ethosu_ta_init)
+        add_subdirectory(${COMPONENTS_DIR}/npu_ta ${CMAKE_BINARY_DIR}/npu_ta)
 
         target_link_libraries(${PLATFORM_DRIVERS_TARGET}
             PUBLIC
-            ethosu_ta_init_component)
-        target_compile_definitions(${PLATFORM_DRIVERS_TARGET}
-            PUBLIC
-            ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
+            ethos_u_ta)
     endif()
 
 endif()
diff --git a/source/hal/platform/mps3/cmake/subsystem-profiles/sse-300.cmake b/source/hal/source/platform/mps3/cmake/subsystem-profiles/sse-300.cmake
similarity index 100%
rename from source/hal/platform/mps3/cmake/subsystem-profiles/sse-300.cmake
rename to source/hal/source/platform/mps3/cmake/subsystem-profiles/sse-300.cmake
diff --git a/source/hal/platform/mps3/cmake/templates/mem_regions.h.template b/source/hal/source/platform/mps3/cmake/templates/mem_regions.h.template
similarity index 100%
rename from source/hal/platform/mps3/cmake/templates/mem_regions.h.template
rename to source/hal/source/platform/mps3/cmake/templates/mem_regions.h.template
diff --git a/source/hal/platform/mps3/cmake/templates/peripheral_irqs.h.template b/source/hal/source/platform/mps3/cmake/templates/peripheral_irqs.h.template
similarity index 100%
rename from source/hal/platform/mps3/cmake/templates/peripheral_irqs.h.template
rename to source/hal/source/platform/mps3/cmake/templates/peripheral_irqs.h.template
diff --git a/source/hal/platform/mps3/cmake/templates/peripheral_memmap.h.template b/source/hal/source/platform/mps3/cmake/templates/peripheral_memmap.h.template
similarity index 100%
rename from source/hal/platform/mps3/cmake/templates/peripheral_memmap.h.template
rename to source/hal/source/platform/mps3/cmake/templates/peripheral_memmap.h.template
diff --git a/source/hal/platform/mps3/cmake/templates/timing_adapter_settings.template b/source/hal/source/platform/mps3/cmake/templates/timing_adapter_settings.template
similarity index 100%
rename from source/hal/platform/mps3/cmake/templates/timing_adapter_settings.template
rename to source/hal/source/platform/mps3/cmake/templates/timing_adapter_settings.template
diff --git a/source/hal/platform/mps3/include/platform_drivers.h b/source/hal/source/platform/mps3/include/platform_drivers.h
similarity index 84%
rename from source/hal/platform/mps3/include/platform_drivers.h
rename to source/hal/source/platform/mps3/include/platform_drivers.h
index a706ed4..8b699d5 100644
--- a/source/hal/platform/mps3/include/platform_drivers.h
+++ b/source/hal/source/platform/mps3/include/platform_drivers.h
@@ -21,13 +21,10 @@
 #include "log_macros.h"     /* Logging related helpers. */
 
 /* Platform components */
-#include "timer_mps3.h"     /* Timer functions. */
 #include "RTE_Components.h" /* For CPU related defintiions */
-#include "glcd_mps3.h"      /* LCD functions. */
-
-/** Platform definitions. TODO: These should be removed. */
-#include "peripheral_memmap.h"  /* Peripheral memory map definitions. */
-#include "peripheral_irqs.h"    /* IRQ numbers for this platform. */
+#include "timer_mps3.h"     /* Timer functions. */
+#include "user_input.h"     /* User input function */
+#include "lcd_img.h"        /* LCD functions. */
 
 /**
  * @brief   Initialises the platform components.
diff --git a/source/hal/platform/mps3/include/timer_mps3.h b/source/hal/source/platform/mps3/include/timer_mps3.h
similarity index 93%
rename from source/hal/platform/mps3/include/timer_mps3.h
rename to source/hal/source/platform/mps3/include/timer_mps3.h
index b5db722..e1faf69 100644
--- a/source/hal/platform/mps3/include/timer_mps3.h
+++ b/source/hal/source/platform/mps3/include/timer_mps3.h
@@ -24,13 +24,20 @@
     uint32_t    counter_1Hz;
     uint32_t    counter_100Hz;
 
-    /* Running at FPGA clock rate. See GetMPS3CoreClock(). */
+    /* Running at FPGA clock rate. See get_mps3_core_clock(). */
     uint32_t    counter_fpga;
 
     /* Running at processor core's internal clock rate, triggered by SysTick. */
     uint64_t    counter_systick;
 } base_time_counter;
 
+
+/**
+ * @brief  Gets the MPS3 core clock
+ * @return Clock rate in Hz expressed as 32 bit unsigned integer.
+ */
+uint32_t get_mps3_core_clock(void);
+
 /**
  * @brief   Resets the counters.
  */
diff --git a/source/hal/platform/mps3/source/device_mps3.h b/source/hal/source/platform/mps3/source/device_mps3.h
similarity index 100%
rename from source/hal/platform/mps3/source/device_mps3.h
rename to source/hal/source/platform/mps3/source/device_mps3.h
diff --git a/source/hal/platform/mps3/source/platform_drivers.c b/source/hal/source/platform/mps3/source/platform_drivers.c
similarity index 92%
rename from source/hal/platform/mps3/source/platform_drivers.c
rename to source/hal/source/platform/mps3/source/platform_drivers.c
index 00afb78..5de41c2 100644
--- a/source/hal/platform/mps3/source/platform_drivers.c
+++ b/source/hal/source/platform/mps3/source/platform_drivers.c
@@ -18,10 +18,8 @@
 #include "platform_drivers.h"
 
 #include "log_macros.h"     /* Logging functions */
-#include "device_mps3.h"    /* FPGA level definitions and functions. */
 #include "uart_stdout.h"    /* stdout over UART. */
-
-#include "smm_mps3.h"   /* Memory map for MPS3. */
+#include "smm_mps3.h"       /* Memory map for MPS3. */
 
 #include <string.h>         /* For strncpy */
 
@@ -61,8 +59,7 @@
 #if defined(ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
     /* If the platform has timing adapter blocks along with Ethos-U core
      * block, initialise them here. */
-    if (0 != (err = arm_ethosu_timing_adapter_init()))
-    {
+    if (0 != (err = arm_ethosu_timing_adapter_init())) {
         return err;
     }
 #endif /* ETHOS_U_NPU_TIMING_ADAPTER_ENABLED */
@@ -70,8 +67,7 @@
     int state;
 
     /* If Arm Ethos-U NPU is to be used, we initialise it here */
-    if (0 != (state = arm_ethosu_npu_init()))
-    {
+    if (0 != (state = arm_ethosu_npu_init())) {
         return state;
     }
 
@@ -110,14 +106,14 @@
     /* Initialise the LEDs as the switches are */
     MPS3_FPGAIO->LED = MPS3_FPGAIO->SWITCHES & 0xFF;
 
-    info("Processor internal clock: %" PRIu32 "Hz\n", GetMPS3CoreClock());
+    info("Processor internal clock: %" PRIu32 "Hz\n", get_mps3_core_clock());
 
     /* 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();
+    fpga_clk = get_mps3_core_clock();
 
     info("V2M-MPS3 revision %c\n\n", (char)(rev + ascii_A));
     info("Application Note AN%" PRIx32 ", Revision %c\n", apnote,
diff --git a/source/hal/platform/mps3/source/smm_mps3.h b/source/hal/source/platform/mps3/source/smm_mps3.h
similarity index 100%
rename from source/hal/platform/mps3/source/smm_mps3.h
rename to source/hal/source/platform/mps3/source/smm_mps3.h
diff --git a/source/hal/platform/mps3/source/timer_mps3.c b/source/hal/source/platform/mps3/source/timer_mps3.c
similarity index 87%
rename from source/hal/platform/mps3/source/timer_mps3.c
rename to source/hal/source/platform/mps3/source/timer_mps3.c
index 6da026f..3511883 100644
--- a/source/hal/platform/mps3/source/timer_mps3.c
+++ b/source/hal/source/platform/mps3/source/timer_mps3.c
@@ -17,7 +17,6 @@
 #include "timer_mps3.h"
 
 #include "log_macros.h"
-#include "device_mps3.h"
 #include "smm_mps3.h"   /* Memory map for MPS3. */
 
 static uint64_t cpu_cycle_count = 0;    /* 64-bit cpu cycle counter */
@@ -94,7 +93,7 @@
 uint32_t get_duration_microseconds(base_time_counter *start,
                                    base_time_counter *end)
 {
-    const int divisor = GetMPS3CoreClock()/1000000;
+    const int divisor = get_mps3_core_clock()/1000000;
     uint32_t time_elapsed = 0;
     if (end->counter_fpga > start->counter_fpga) {
         time_elapsed = (end->counter_fpga - start->counter_fpga)/divisor;
@@ -144,12 +143,13 @@
     return cpu_cycle_count + (SysTick->LOAD - systick_val);
 }
 
+
 /**
  * SysTick initialisation
  */
 static int Init_SysTick(void)
 {
-    const uint32_t ticks_10ms = GetMPS3CoreClock()/100 + 1;
+    const uint32_t ticks_10ms = get_mps3_core_clock()/100 + 1;
     int err = 0;
 
     /* Reset CPU cycle count value. */
@@ -172,3 +172,22 @@
 
     return err;
 }
+
+uint32_t get_mps3_core_clock(void)
+{
+    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) {
+            warn("System clock is different to the MPS3 config set clock.\n");
+        }
+        return MPS3_SCC->CFG_ACLK;
+    }
+
+    if (!warned_once) {
+        warn("MPS3_SCC->CFG_ACLK reads 0. Assuming default clock of %" PRIu32 "\n",
+            default_clock);
+        warned_once = 1;
+    }
+    return default_clock;
+}
\ No newline at end of file
diff --git a/source/hal/platform/native/CMakeLists.txt b/source/hal/source/platform/native/CMakeLists.txt
similarity index 76%
rename from source/hal/platform/native/CMakeLists.txt
rename to source/hal/source/platform/native/CMakeLists.txt
index 0b9fee1..fef5d5e 100644
--- a/source/hal/platform/native/CMakeLists.txt
+++ b/source/hal/source/platform/native/CMakeLists.txt
@@ -32,7 +32,6 @@
     message(FATAL_ERROR "Native drivers not available when cross-compiling.")
 endif()
 
-
 # Create static library
 add_library(${PLATFORM_DRIVERS_TARGET} STATIC)
 
@@ -46,8 +45,29 @@
     PRIVATE
     source/platform_drivers.c)
 
+## Platform definitions:
+target_compile_definitions(${PLATFORM_DRIVERS_TARGET}
+    PUBLIC
+    ACTIVATION_BUF_SRAM_SZ=0)
+
+## Platform component directory
+if (NOT DEFINED COMPONENTS_DIR)
+    set(COMPONENTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../components)
+endif()
+
+## Platform component: stdout
+set(STDOUT_RETARGET OFF CACHE BOOL "Retarget stdout/err to UART")
+add_subdirectory(${COMPONENTS_DIR}/stdout ${CMAKE_BINARY_DIR}/stdout)
+
+## Platform component: lcd
+add_subdirectory(${COMPONENTS_DIR}/lcd ${CMAKE_BINARY_DIR}/lcd)
+
 # Add dependencies:
-target_link_libraries(${PLATFORM_DRIVERS_TARGET} PUBLIC log)
+target_link_libraries(${PLATFORM_DRIVERS_TARGET}
+    PUBLIC
+    log
+    stdout
+    lcd_stubs)
 
 # Display status:
 message(STATUS "*******************************************************")
diff --git a/source/hal/platform/native/include/platform_drivers.h b/source/hal/source/platform/native/include/platform_drivers.h
similarity index 92%
rename from source/hal/platform/native/include/platform_drivers.h
rename to source/hal/source/platform/native/include/platform_drivers.h
index ca6b6e0..d93e31c 100644
--- a/source/hal/platform/native/include/platform_drivers.h
+++ b/source/hal/source/platform/native/include/platform_drivers.h
@@ -19,6 +19,8 @@
 #define PLATFORM_DRIVERS_H
 
 #include "log_macros.h"     /* Logging related helpers. */
+#include "lcd_img.h"        /* LCD functions */
+#include "user_input.h"     /* User input function */
 
 /**
  * @brief   Initialises the platform components.
diff --git a/source/hal/platform/native/source/platform_drivers.c b/source/hal/source/platform/native/source/platform_drivers.c
similarity index 100%
rename from source/hal/platform/native/source/platform_drivers.c
rename to source/hal/source/platform/native/source/platform_drivers.c
diff --git a/source/hal/platform/simple/CMakeLists.txt b/source/hal/source/platform/simple/CMakeLists.txt
similarity index 78%
rename from source/hal/platform/simple/CMakeLists.txt
rename to source/hal/source/platform/simple/CMakeLists.txt
index df4df00..c8d4953 100644
--- a/source/hal/platform/simple/CMakeLists.txt
+++ b/source/hal/source/platform/simple/CMakeLists.txt
@@ -39,6 +39,12 @@
 ## Include the platform cmake descriptor file
 include(${PLATFORM_CMAKE_DESCRIPTOR_FILE})
 
+# Define target specific values here (before adding the components)
+set(UART0_BASE          "0x49303000"    CACHE STRING "UART base address")
+set(UART0_BAUDRATE      "115200"        CACHE STRING "UART baudrate")
+set(SYSTEM_CORE_CLOCK   "25000000"      CACHE STRING "System peripheral clock (Hz)")
+set(ACTIVATION_BUF_SRAM_SZ  "0x200000"  CACHE STRING "Maximum SRAM size for activation buffers")
+
 # 3. Generate sources:
 if (NOT DEFINED SOURCE_GEN_DIR)
     set(SOURCE_GEN_DIR ${CMAKE_BINARY_DIR}/generated/bsp)
@@ -64,7 +70,6 @@
 ## Platform sources
 target_sources(${PLATFORM_DRIVERS_TARGET}
     PRIVATE
-    source/stubs_glcd.c
     source/timer_simple_platform.c
     source/platform_drivers.c)
 
@@ -73,8 +78,16 @@
     set(COMPONENTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../components)
 endif()
 
-## Platform component: uart
-add_subdirectory(${DEPENDENCY_ROOT_DIR}/core-platform/drivers/uart ${CMAKE_BINARY_DIR}/uart)
+
+## Platform component: cmsis_device (provides generic Cortex-M start up library)
+add_subdirectory(${COMPONENTS_DIR}/cmsis_device ${CMAKE_BINARY_DIR}/cmsis_device)
+
+## Platform component: stdout
+set(STDOUT_RETARGET ON CACHE BOOL "Retarget stdout/err to UART")
+add_subdirectory(${COMPONENTS_DIR}/stdout ${CMAKE_BINARY_DIR}/stdout)
+
+## Platform component: lcd
+add_subdirectory(${COMPONENTS_DIR}/lcd ${CMAKE_BINARY_DIR}/lcd)
 
 ## Compile defs
 target_compile_definitions(${PLATFORM_DRIVERS_TARGET}
@@ -85,32 +98,26 @@
 target_link_libraries(${PLATFORM_DRIVERS_TARGET}  PUBLIC
         cmsis_device
         log
-        ethosu_uart_pl011)
+        lcd_stubs
+        $<IF:$<BOOL:STDOUT_RETARGET>,stdout_retarget_pl011,stdout>)
 
 # If Ethos-U is enabled, we need the driver library too
 if (ETHOS_U_NPU_ENABLED)
 
-    target_compile_definitions(${PLATFORM_DRIVERS_TARGET}
-        PUBLIC
-        ARM_NPU)
-
     ## Platform component: Ethos-U initialization
-    add_subdirectory(${COMPONENTS_DIR}/ethosu_npu_init ${CMAKE_BINARY_DIR}/ethosu_npu_init)
+    add_subdirectory(${COMPONENTS_DIR}/npu ${CMAKE_BINARY_DIR}/npu)
 
     target_link_libraries(${PLATFORM_DRIVERS_TARGET}
         PUBLIC
-        ethosu_npu_init_component)
+        ethos_u_npu)
 
     if (ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
         ## Platform component: Ethos-U timing apadpter initialization
-        add_subdirectory(${COMPONENTS_DIR}/ethosu_ta_init ${CMAKE_BINARY_DIR}/ethosu_ta_init)
+        add_subdirectory(${COMPONENTS_DIR}/npu_ta ${CMAKE_BINARY_DIR}/npu_ta)
 
         target_link_libraries(${PLATFORM_DRIVERS_TARGET}
             PUBLIC
-            ethosu_ta_init_component)
-        target_compile_definitions(${PLATFORM_DRIVERS_TARGET}
-                PUBLIC
-                ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
+            ethos_u_ta)
     endif()
 
 endif()
diff --git a/source/hal/platform/simple/cmake/subsystem-profiles/simple_platform.cmake b/source/hal/source/platform/simple/cmake/subsystem-profiles/simple_platform.cmake
similarity index 100%
rename from source/hal/platform/simple/cmake/subsystem-profiles/simple_platform.cmake
rename to source/hal/source/platform/simple/cmake/subsystem-profiles/simple_platform.cmake
diff --git a/source/hal/platform/simple/cmake/templates/mem_regions.h.template b/source/hal/source/platform/simple/cmake/templates/mem_regions.h.template
similarity index 100%
rename from source/hal/platform/simple/cmake/templates/mem_regions.h.template
rename to source/hal/source/platform/simple/cmake/templates/mem_regions.h.template
diff --git a/source/hal/platform/simple/cmake/templates/peripheral_irqs.h.template b/source/hal/source/platform/simple/cmake/templates/peripheral_irqs.h.template
similarity index 100%
rename from source/hal/platform/simple/cmake/templates/peripheral_irqs.h.template
rename to source/hal/source/platform/simple/cmake/templates/peripheral_irqs.h.template
diff --git a/source/hal/platform/simple/cmake/templates/peripheral_memmap.h.template b/source/hal/source/platform/simple/cmake/templates/peripheral_memmap.h.template
similarity index 100%
rename from source/hal/platform/simple/cmake/templates/peripheral_memmap.h.template
rename to source/hal/source/platform/simple/cmake/templates/peripheral_memmap.h.template
diff --git a/source/hal/platform/simple/cmake/templates/timing_adapter_settings.template b/source/hal/source/platform/simple/cmake/templates/timing_adapter_settings.template
similarity index 100%
rename from source/hal/platform/simple/cmake/templates/timing_adapter_settings.template
rename to source/hal/source/platform/simple/cmake/templates/timing_adapter_settings.template
diff --git a/source/hal/platform/simple/include/platform_drivers.h b/source/hal/source/platform/simple/include/platform_drivers.h
similarity index 82%
rename from source/hal/platform/simple/include/platform_drivers.h
rename to source/hal/source/platform/simple/include/platform_drivers.h
index c1a6c6a..5f2ed33 100644
--- a/source/hal/platform/simple/include/platform_drivers.h
+++ b/source/hal/source/platform/simple/include/platform_drivers.h
@@ -21,13 +21,10 @@
 #include "log_macros.h"   /* Logging related helpers. */
 
 /* Platform components */
-#include "stubs/glcd.h"             /* LCD stubs to support use cases that use LCD */
-#include "timer_simple_platform.h"  /* timer implementation */
 #include "RTE_Components.h"         /* For CPU related defintiions */
-
-/** Platform definitions. TODO: These should be removed. */
-#include "peripheral_memmap.h"  /* Peripheral memory map definitions. */
-#include "peripheral_irqs.h"    /* IRQ numbers for this platform. */
+#include "timer_simple_platform.h"  /* timer implementation */
+#include "user_input.h"             /* User input function */
+#include "lcd_img.h"                /* LCD functions */
 
 /**
  * @brief   Initialises the platform components.
diff --git a/source/hal/platform/simple/include/timer_simple_platform.h b/source/hal/source/platform/simple/include/timer_simple_platform.h
similarity index 100%
rename from source/hal/platform/simple/include/timer_simple_platform.h
rename to source/hal/source/platform/simple/include/timer_simple_platform.h
diff --git a/source/hal/platform/simple/source/platform_drivers.c b/source/hal/source/platform/simple/source/platform_drivers.c
similarity index 98%
rename from source/hal/platform/simple/source/platform_drivers.c
rename to source/hal/source/platform/simple/source/platform_drivers.c
index aae867c..19c0057 100644
--- a/source/hal/platform/simple/source/platform_drivers.c
+++ b/source/hal/source/platform/simple/source/platform_drivers.c
@@ -18,6 +18,9 @@
 #include "platform_drivers.h"
 
 #include "uart_stdout.h"
+#include "peripheral_memmap.h"
+
+
 #include <string.h>
 
 #if defined(ARM_NPU)
diff --git a/source/hal/platform/simple/source/timer_simple_platform.c b/source/hal/source/platform/simple/source/timer_simple_platform.c
similarity index 100%
rename from source/hal/platform/simple/source/timer_simple_platform.c
rename to source/hal/source/platform/simple/source/timer_simple_platform.c
diff --git a/source/hal/profiles/bare-metal/timer/include/platform_timer.h b/source/hal/source/profiles/bare-metal/timer/include/platform_timer.h
similarity index 100%
rename from source/hal/profiles/bare-metal/timer/include/platform_timer.h
rename to source/hal/source/profiles/bare-metal/timer/include/platform_timer.h
diff --git a/source/hal/profiles/bare-metal/timer/platform_timer.c b/source/hal/source/profiles/bare-metal/timer/platform_timer.c
similarity index 100%
rename from source/hal/profiles/bare-metal/timer/platform_timer.c
rename to source/hal/source/profiles/bare-metal/timer/platform_timer.c
diff --git a/source/hal/profiles/native/timer/include/platform_timer.h b/source/hal/source/profiles/native/timer/include/platform_timer.h
similarity index 100%
rename from source/hal/profiles/native/timer/include/platform_timer.h
rename to source/hal/source/profiles/native/timer/include/platform_timer.h
diff --git a/source/hal/profiles/native/timer/platform_timer.c b/source/hal/source/profiles/native/timer/platform_timer.c
similarity index 100%
rename from source/hal/profiles/native/timer/platform_timer.c
rename to source/hal/source/profiles/native/timer/platform_timer.c