modules: add an Arm Ethos-U HAL module

Adding module files for building the Arm Ethos-U Core driver.
Updating TFLU module file to build Ethos-U operator.

Adding hal_ethos_u to west manifest.

Signed-off-by: Kristofer Jonsson <kristofer.jonsson@arm.com>
Signed-off-by: Fredrik Knutsson <fredrik.knutsson@arm.com>
This commit is contained in:
Kristofer Jonsson 2022-05-30 16:17:20 +02:00 committed by Carles Cufí
parent 911d50d4d5
commit 02d4714aff
4 changed files with 80 additions and 1 deletions

View file

@ -0,0 +1,25 @@
# Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
#
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_ARM_ETHOS_U AND CONFIG_MULTITHREADING)
set(ETHOSU_TARGET_NPU_CONFIG ${CONFIG_ARM_ETHOS_U_NPU_NAME})
# Mapping log level from Zephyr (none=0, err=1, wrn=2, inf=3, dbg=4) to
# Ethos-U driver (err=0, warn=1, info=2, debug=3)
set(ETHOSU_LOG_SEVERITY_MAP err err warning info debug)
list(LENGTH ETHOSU_LOG_SEVERITY_MAP ETHOSU_LOG_SEVERITY_MAP_LENGTH)
if ("${CONFIG_ARM_ETHOS_U_LOG_LEVEL}" LESS_EQUAL "${ETHOSU_LOG_SEVERITY_MAP_LENGTH}")
list(GET ETHOSU_LOG_SEVERITY_MAP ${CONFIG_ARM_ETHOS_U_LOG_LEVEL} ETHOSU_LOG_SEVERITY)
else()
set(ETHOSU_LOG_SEVERITY debug)
endif()
add_subdirectory(${ZEPHYR_CURRENT_MODULE_DIR} ethos-u-core-driver)
target_link_libraries(ethosu_core_driver PUBLIC
zephyr_interface)
zephyr_link_libraries(ethosu_core_driver)
endif()

View file

@ -0,0 +1,45 @@
# Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
#
# SPDX-License-Identifier: Apache-2.0
config ARM_ETHOS_U
bool "Ethos-U core driver"
default n
depends on MULTITHREADING
help
This option enables the Arm Ethos-U core driver.
menu "Arm Ethos-U NPU configuration"
choice ARM_ETHOS_U_NPU_CONFIG
prompt "Arm Ethos-U NPU configuration"
depends on ARM_ETHOS_U
default ARM_ETHOS_U55_128
config ARM_ETHOS_U55_64
bool "using Ethos-U55 with 64 macs"
config ARM_ETHOS_U55_128
bool "using Ethos-U55 with 128 macs"
config ARM_ETHOS_U55_256
bool "using Ethos-U55 with 256 macs"
config ARM_ETHOS_U65_128
bool "using Ethos-U65 with 128 macs"
config ARM_ETHOS_U65_256
bool "using Ethos-U65 with 256 macs"
config ARM_ETHOS_U65_512
bool "using Ethos-U65 with 512 macs"
endchoice
endmenu
config ARM_ETHOS_U_NPU_NAME
string
default "ethos-u55-64" if ARM_ETHOS_U55_64
default "ethos-u55-128" if ARM_ETHOS_U55_128
default "ethos-u55-256" if ARM_ETHOS_U55_256
default "ethos-u65-128" if ARM_ETHOS_U65_128
default "ethos-u65-256" if ARM_ETHOS_U65_256
default "ethos-u65-512" if ARM_ETHOS_U65_512
help
Name of the used Arm NPU
module = ARM_ETHOS_U
module-str = arm_ethos_u
source "subsys/logging/Kconfig.template.log_config"

View file

@ -23,6 +23,10 @@ if(CONFIG_TENSORFLOW_LITE_MICRO)
zephyr_library_compile_definitions(CMSIS_NN)
endif()
if (CONFIG_ARM_ETHOS_U)
set(ETHOSU_CO_PROCESSOR ethos_u)
endif()
zephyr_library_sources(
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/simple_memory_allocator.cc
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/debug_log.cc
@ -73,7 +77,7 @@ if(CONFIG_TENSORFLOW_LITE_MICRO)
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/kernels/detection_postprocess.cc
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/kernels/elementwise.cc
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/kernels/elu.cc
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/kernels/ethosu.cc
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/kernels/${ETHOSU_CO_PROCESSOR}/ethosu.cc
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/kernels/exp.cc
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/kernels/expand_dims.cc
${TENSORFLOW_LITE_MICRO_DIR}/tensorflow/lite/micro/kernels/fill.cc

View file

@ -62,6 +62,11 @@ manifest:
west-commands: west/west-commands.yml
groups:
- hal
- name: hal_ethos_u
revision: 90ada2ea5681b2a2722a10d2898eac34c2510791
path: modules/hal/ethos_u
groups:
- hal
- name: hal_gigadevice
revision: dd0e0322474462b58059e6fedaf1d67d2a0864d0
path: modules/hal/gigadevice