summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2022-04-06 13:03:20 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2022-04-06 16:03:23 +0100
commit68fdd119f38c37ab28066474086b0e352d991baf (patch)
treecedb897ff9128f7d07e54c5c53ff8eb6be6b2bb1 /docs
parentda2ec067da418d3d80b2829b111df25bd901eb5c (diff)
downloadml-embedded-evaluation-kit-68fdd119f38c37ab28066474086b0e352d991baf.tar.gz
MLECO-3096: Removing data_acq and data_psn
Further to the HAL refactoring done in previous commits, this CR simpifies HAL by removing data_acq and data_psn "modules". The associated function pointers have been removed. Change-Id: I04c194c08dfe0aff98ce4e0f0f056bac254c137d Signed-off-by: Kshitij Sisodia <kshitij.sisodia@arm.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/documentation.md49
-rw-r--r--docs/sections/customizing.md61
2 files changed, 34 insertions, 76 deletions
diff --git a/docs/documentation.md b/docs/documentation.md
index 9fe2b46..3e7a5c4 100644
--- a/docs/documentation.md
+++ b/docs/documentation.md
@@ -168,27 +168,23 @@ The HAL has the following structure:
hal
├── CMakeLists.txt
├── include
-│ ├── data_acq.h
-│ ├── data_psn.h
-│ ├── hal.h
-│ └── timer.h
+│ ├── hal.h
+│ ├── hal_lcd.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
+ │ ├── cmsis_device
+ │ ├── lcd
+ │ ├── npu
+ │ ├── npu_ta
+ │ ├── platform_pmu
+ │ └── stdout
+ ├── hal.c
+ ├── hal_timer.c
+ └── platform
+ ├── mps3
+ ├── native
+ └── simple
```
HAL is built as a separate project into a static library `libhal.a`. It is linked with use-case executable.
@@ -220,19 +216,8 @@ What these folders contain:
`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
- into HAL library.
-
-- `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.
-
- 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.
+ Platform is built from selected components and configured cmsis device. It is a separate CMake project, and is
+ built into a static library `libplatform-drivers.a`. It is linked into HAL library.
## Models and resources
diff --git a/docs/sections/customizing.md b/docs/sections/customizing.md
index 982479e..604e708 100644
--- a/docs/sections/customizing.md
+++ b/docs/sections/customizing.md
@@ -28,8 +28,7 @@ conventions.
The following sign indicates the important conventions to apply:
-> **Convention:** The code is developed using `C++11` and `C99` standards. This is then governed by TensorFlow Lite for
-> Microcontrollers framework.
+> **Convention:** The code is developed using `C++14` and `C99` standards.
## Software project description
@@ -98,20 +97,16 @@ The HAL is represented by the following interfaces. To access them, include the
|--------------------|----------------------------------------------------------------------------------------------|
| `inited` | Initialization flag. Is set after the `platform_init()` function is called. |
| `plat_name` | Platform name. it is set to `mps3-bare` for MPS3 build and `FVP` for Fast Model build. |
- | `data_acq` | Pointer to data acquisition module responsible for user interaction and other data collection for the application logic. |
- | `data_psn` | Pointer to data presentation module responsible for data output through components available in the selected platform: `LCD --` for MPS3, `console --` for Fast Model. |
| `timer` | Pointer to platform timer implementation (see `platform_timer`) |
| `platform_init` | Pointer to platform initialization function. |
| `platform_release` | Pointer to platform release function |
-- `hal_init` function: Initializes the HAL structure based on the compile time configuration. This must be called before
+- `hal_init` function: Initializes the HAL structure based on the compile-time configuration. This must be called before
any other function in this API.
| Parameter name | Description|
|------------------|-----------------------------------------------------|
| `platform` | Pointer to a pre-allocated `hal_platform` struct. |
- | `data_acq` | Pointer to a pre-allocated data acquisition module |
- | `data_psn` | Pointer to a pre-allocated data presentation module |
| `timer` | Pointer to a pre-allocated timer module |
| `return` | Zero returned if successful, an error code is returned if unsuccessful. |
@@ -129,28 +124,6 @@ The HAL is represented by the following interfaces. To access them, include the
| ----------------| ------------------------------------------------------------------- |
| `platform` | Pointer to a pre-allocated and initialized `hal_platform` struct. |
-- `data_acq_module` structure: Structure to encompass the data acquisition module and linked methods.
-
- | Attribute name | Description |
- |----------------|----------------------------------------------------|
- | `inited` | Initialization flag. Is set after the `system_init ()` function is called. |
- | `system_name` | Channel name. It is set to `UART` for MPS3 build and Fast Model builds. |
- | `system_init` | Pointer to data acquisition module initialization function. The pointer is set according to the platform selected during the build. This function is called by the platform initialization routines. |
- | `get_input` | Pointer to a function reading user input. The pointer is set according to the selected platform during the build. For MPS3 and Fast Model environments, the function reads data from UART. |
-
-- `data_psn_module` structure: Structure to encompass the data presentation module and associated methods.
-
- | Attribute name | Description |
- |--------------------|------------------------------------------------|
- | `inited` | Initialization flag. It is set after the `system_init ()` function is called. |
- | `system_name` | System component name used to present data. It is set to `lcd` for the MPS3 build and to `log_psn` for the Fast Model build. For Fast Model, the console output of the data summary replaces all pixel drawing functions. |
- | `system_init` | Pointer to data presentation module initialization function. The pointer is set according to the platform selected during the build. This function is called by the platform initialization routines. |
- | `present_data_image` | Pointer to a function to draw an image. The pointer is set according to the selected platform during the build. For MPS3, the image is drawn on the LCD. For Fast Model, the image summary is printed in the UART (coordinates, channel info, downsample factor). |
- | `present_data_text` | Pointer to a function to print a text. The pointer is set according to the selected platform during the build. For MPS3, the text is drawn on the LCD. For Fast Model, the text is printed in the UART. |
- | `present_box` | Pointer to a function to draw a rectangle. The pointer is set according to the selected platform during the build. For MPS3, the image is drawn on the LCD. For Fast Model, the image summary is printed in the UART. |
- | `clear` | Pointer to a function to clear the output. The pointer is set according to the selected platform during the build. For MPS3, the function clears the LCD. For Fast Model, nothing happens. |
- | `set_text_color` | Pointer to a function to set text color for the next call of `present_data_text()` function. The pointer is set according to the selected platform during the build. For MPS3, the function sets the color for the text printed on the LCD. For Fast Model, nothing happens. |
-
- `platform_timer` structure: The structure to hold a platform-specific timer implementation.
| Attribute name | Description |
@@ -175,12 +148,10 @@ int main ()
{
hal_platform platform;
- data_acq_module dataAcq;
- data_psn_module dataPsn;
platform_timer timer;
/* Initialise the HAL and platform */
- hal_init(&platform, &dataAcq, &dataPsn, &timer);
+ hal_init(&platform, &timer);
hal_platform_init(&platform);
...
@@ -608,22 +579,23 @@ However, for clarity, here is the full list of available functions:
## Reading user input from console
-The platform data acquisition module uses the `get_input` function to read the keyboard input from the UART. It can be
-used as follows:
+The platform package under HAL must provide an implementation for a function `GetLine`. This is then wrapped by HAL to
+expose a function called `hal_get_user_input`.
```C++
char ch_input[128];
-platform.data_acq->get_input(ch_input, sizeof(ch_input));
+hal_get_user_input(ch_input, sizeof(ch_input));
```
-The function is blocked until a user provides an input.
+The function intends to block until a line has been provided. For embedded targets, this call might be redirected to get
+input from a UART block. For the host targets, this will just be a call to the C standard library instead.
## Output to MPS3 LCD
-The platform presentation module has functions to print text or an image to the board LCD. For example:
+The HAL exposes LCD functions to print text or an image to the board LCD. For example:
-- `present_data_text`
-- `present_data_image`
+- `hal_lcd_display_text`
+- `hal_lcd_display_image`
Text presentation function has the following signature:
@@ -640,7 +612,7 @@ Here is an example that prints "Hello world" on the LCD screen:
```C++
std::string hello("Hello world");
-platform.data_psn->present_data_text(hello.c_str(), hello.size(), 10, 35, 0);
+hal_lcd_display_text(hello.c_str(), hello.size(), 10, 35, 0);
```
The image presentation function has the following signature:
@@ -653,14 +625,15 @@ The image presentation function has the following signature:
- `const uint32_t pos_y`: The y coordinate of the first pixel.
- `const uint32_t downsample_factor`: The factor by which the image is to be downsampled.
-For example, the following code snippet visualizes an input tensor data for `MobileNet v2 224`, by downsampling it
-twice:
+For example, the following code snippet visualizes an input tensor data for `MobileNet v2 224`, by down-sampling it
+by a factor of two:
```C++
-platform.data_psn->present_data_image((uint8_t *) inputTensor->data.data, 224, 224, 3, 10, 35, 2);
+hal_lcd_display_image((uint8_t *) inputTensor->data.data, 224, 224, 3, 10, 35, 2);
```
-Please refer to the [Hardware Abstraction Layer API](./customizing.md#hardware-abstraction-layer-api) section for more data presentation functions.
+Please refer to the [Hardware Abstraction Layer API](./customizing.md#hardware-abstraction-layer-api) section for more
+LCD related functions.
## Building custom use-case