Skip to content

Commit

Permalink
[microNPU] Upgrade to 21.11 version of Arm(R) Ethos(TM)-U55 NPU driver (
Browse files Browse the repository at this point in the history
#9777)

Change-Id: Ide4d2a33a215b4f1367667ad0fa4a66913cf9ad4
  • Loading branch information
grant-arm authored Dec 21, 2021
1 parent 5aea9bc commit 124813f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 28 deletions.
11 changes: 2 additions & 9 deletions apps/microtvm/ethosu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,19 @@ ${BUILD_DIR}/libcmsis_startup.a: $(CMSIS_STARTUP_SRCS)
$(QUIET)$(AR) -cr $(abspath $(BUILD_DIR)/libcmsis_startup.a) $(abspath $(BUILD_DIR))/libcmsis_startup/*.o
$(QUIET)$(RANLIB) $(abspath $(BUILD_DIR)/libcmsis_startup.a)

# Build UART code
${BUILD_DIR}/libuart.a: $(UART_SRCS)
$(QUIET)mkdir -p $(abspath $(BUILD_DIR)/libuart)
$(QUIET)cd $(abspath $(BUILD_DIR)/libuart) && $(CC) -c $(PKG_CFLAGS) $^
$(QUIET)$(AR) -cr $(abspath $(BUILD_DIR)/libuart.a) $(abspath $(BUILD_DIR))/libuart/*.o
$(QUIET)$(RANLIB) $(abspath $(BUILD_DIR)/libuart.a)

# Build Arm(R) Ethos(TM)-U core driver
${BUILD_DIR}/ethosu_core_driver/libethosu_core_driver.a:
$(QUIET)mkdir -p $(@D)
$(QUIET)cd $(ETHOSU_DRIVER_PATH) && $(CMAKE) -B $(abspath $(BUILD_DIR)/ethosu_core_driver) $(DRIVER_CMAKE_FLAGS)
$(QUIET)cd $(abspath $(BUILD_DIR)/ethosu_core_driver) && $(MAKE)

# Build demo application
$(BUILD_DIR)/demo: src/demo.c src/tvm_ethosu_runtime.c $(BUILD_DIR)/stack_allocator.o $(BUILD_DIR)/crt_backend_api.o ${BUILD_DIR}/libcodegen.a ${BUILD_DIR}/libcmsis_startup.a ${BUILD_DIR}/ethosu_core_driver/libethosu_core_driver.a ${BUILD_DIR}/libuart.a
$(BUILD_DIR)/demo: src/demo.c src/tvm_ethosu_runtime.c $(UART_SRCS) $(BUILD_DIR)/stack_allocator.o $(BUILD_DIR)/crt_backend_api.o ${BUILD_DIR}/libcodegen.a ${BUILD_DIR}/libcmsis_startup.a ${BUILD_DIR}/ethosu_core_driver/libethosu_core_driver.a
$(QUIET)mkdir -p $(@D)
$(QUIET)$(CC) $(PKG_CFLAGS) -o $@ $^ $(PKG_LDFLAGS)

clean:
$(QUIET)rm -rf $(BUILD_DIR)/crt
$(QUIET)rm -rf $(BUILD_DIR)/codegen

cleanall:
$(QUIET)rm -rf $(BUILD_DIR)
Expand Down
6 changes: 3 additions & 3 deletions apps/microtvm/ethosu/include/ethosu_mod.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

#include "ethosu_55.h"

struct ethosu_driver* ethosu0_driver = &ethosu_drv;
struct ethosu_driver ethosu0_driver;

void ethosuIrqHandler0() { ethosu_irq_handler(ethosu0_driver); }
void ethosuIrqHandler0() { ethosu_irq_handler(&ethosu0_driver); }

// Initialize Arm(R) Ethos(TM)-U NPU driver
int EthosuInit() {
if (ethosu_init(ethosu0_driver, (void*)ETHOSU_BASE_ADDRESS, NULL, 0, 1, 1)) {
if (ethosu_init(&ethosu0_driver, (void*)ETHOSU_BASE_ADDRESS, NULL, 0, 1, 1)) {
printf("Failed to initialize NPU.\n");
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion docker/install/ubuntu_install_ethosu_driver_stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set -o pipefail
fvp_dir="/opt/arm/FVP_Corstone_SSE-300"
cmake_dir="/opt/arm/cmake"
ethosu_dir="/opt/arm/ethosu"
ethosu_driver_ver="21.05"
ethosu_driver_ver="21.11"
cmsis_ver="5.8.0"

mkdir -p /opt/arm
Expand Down
18 changes: 3 additions & 15 deletions tests/python/contrib/test_ethosu/reference_system/ethosu_mod.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,17 @@

#include "ethosu_55.h"

struct ethosu_driver* ethosu0_driver = &ethosu_drv;
struct ethosu_driver ethosu0_driver;

void ethosuIrqHandler0() { ethosu_irq_handler(ethosu0_driver); }
void ethosuIrqHandler0() { ethosu_irq_handler(&ethosu0_driver); }

// Initialize Arm(R) Ethos(TM)-U NPU driver
int EthosuInit() {
if (ethosu_init(ethosu0_driver, (void*)ETHOSU_BASE_ADDRESS, NULL, 0, 1, 1)) {
if (ethosu_init(&ethosu0_driver, (void*)ETHOSU_BASE_ADDRESS, NULL, 0, 1, 1)) {
printf("Failed to initialize NPU.\n");
return -1;
}

// Display Arm(R) Ethos(TM)-U version information useful for debugging issues
struct ethosu_version version;
ethosu_get_version(ethosu0_driver, &version);
printf(
"version={major=%u, minor=%u, status=%u}, product={major=%u}, arch={major=%u, minor=%u, "
"patch=%u}\n",
version.id.version_major, version.id.version_minor, version.id.version_status,
version.id.product_major, version.id.arch_major_rev, version.id.arch_minor_rev,
version.id.arch_patch_rev);
printf("macs_per_cc=%u, cmd_stream_version=%u, shram_size=%u\n", version.cfg.macs_per_cc,
version.cfg.cmd_stream_version, version.cfg.shram_size);

// Assumes SCB->VTOR points to RW memory
NVIC_SetVector(ETHOSU_IRQ, (uint32_t)&ethosuIrqHandler0);
NVIC_EnableIRQ(ETHOSU_IRQ);
Expand Down

0 comments on commit 124813f

Please sign in to comment.