![]() |
RZ Flexible Software Package Documentation
Release v4.1.0
|
|
Middleware to support Ethos-U NPU driver. This module implements the Ethos-U NPU (rm_ethosu).
RM_ETHOSU module is a wrapper of the Ethos-U core driver.
| Configuration | Options | Default | Description |
|---|---|---|---|
| Parameter Checking |
| Default (BSP) | Selects if code for parameter checking is to be included in the build. |
| Debug log level |
| RM_ETHOSU_LOG_LEVEL_OFF | Defines ethosu log level. |
| Configuration | Options | Default | Description |
|---|---|---|---|
| Name | Name must be a valid C symbol | g_rm_ethosu0 | Module name. |
| Callback | Name must be a valid C symbol | NULL | A user callback function that will be called from the interrupt service routine (ISR). |
| NPU Interrupt Priority | Value must be an integer between 0 and 255 | 24 | Select the NPU interrupt priority. |
| Enable Secure Mode |
| Enabled | Set Ethos-U NPU secure mode. |
| Enable Privilege Mode |
| Enabled | Set Ethos-U NPU privilege mode. |
Here are the steps to create an AI application in e2studio. Please refer to the example code for details.
Start by creating a new C++ project in e² studio. On the Stacks tab, add New Stack > AI > Arm Ethos-U Core Lib. CMSIS DSP can be removed if not needed. On the BSP tab, stack and heap need to be configured. Generate the project content. Please note an Ethos-U core driver instance will be automatically created. It will be used by RM_ETHOSU API to initialize/deinitialize Ethos-U driver. Application also must use the same instance to call other Ethos-U core driver API if needed.
To build Google TFLM Core Lib, C++17 is recommended. Lower versions may not be supported. Also Run-Time Type Information and exceptions need to be disabled.
| Toolchain | C++ Settings |
|---|---|
| GCC | -fno-rtti, -fno-exceptions |
ticks_per_second and GetCurrentTimeTicks need to be defined for MCU profiling. Here is an exmaple
There are weak functions need to be overriden if needed
| Module | Function | Description |
|---|---|---|
| NPU Driver | ethosu_flush_dcache | Flush/clean the data cache by address and size. Passing NULL as p argument expects the whole cache to be flushed. |
| NPU Driver | ethosu_invalidate_dcache | Invalidate the data cache by address and size. Passing NULL as p argument expects the whole cache to be invalidated. |
| NPU Driver | ethosu_mutex_create | define mutex API based on RTOS |
| NPU Driver | ethosu_mutex_destroy | define mutex API based on RTOS |
| NPU Driver | ethosu_mutex_lock | define mutex API based on RTOS |
| NPU Driver | ethosu_mutex_unlock | define mutex API based on RTOS |
| NPU Driver | ethosu_semaphore_create | define semaphore API based on RTOS |
| NPU Driver | ethosu_semaphore_destroy | define semaphore API based on RTOS |
| NPU Driver | ethosu_semaphore_take | define semaphore API based on RTOS |
| NPU Driver | ethosu_semaphore_give | define semaphore API based on RTOS |
| NPU Core | ethosu_inference_begin | Callback invoked just before the inference is started. |
| NPU Core | ethosu_inference_end | Callback invoked just after the inference has completed. |
Create inference job and run, e.g
Users have to implement weak functions if needed. Please refer to https://git.mlplatform.org/ml/ethos-u/ethos-u-core-driver.git/tree/README.md for further information.
Users have to update linker script if they want to save AI model and data to external memories.
This is a basic example of Ethos-U NPU application.