From 00b8e7beb4fef59c5bef3bc963dfff5bd11718b6 Mon Sep 17 00:00:00 2001 From: Kristofer Jonsson Date: Thu, 16 Feb 2023 11:34:52 +0100 Subject: Update baremetal systick timer handling Use the ethosuDrv pointer to signal if the systick handler should be restarted. Change-Id: Id47b37ab773970317ab324b95706ea54d7dcc74a --- applications/baremetal/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/applications/baremetal/main.cpp b/applications/baremetal/main.cpp index d27e4a4..20bc756 100644 --- a/applications/baremetal/main.cpp +++ b/applications/baremetal/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Arm Limited. All rights reserved. + * SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates * * SPDX-License-Identifier: Apache-2.0 * @@ -89,10 +89,12 @@ void SysTick_Handler(void) { // Disable systick, preventing new systick interrupt to fire while we call the Ethos-U monitor SysTick->CTRL = 0; - ethosuMonitor.monitorSample(ethosuDrv); + if (ethosuDrv != nullptr) { + ethosuMonitor.monitorSample(ethosuDrv); - // Restart the systick timer - SysTick_Config(delay); + // Restart the systick timer + SysTick_Config(delay); + } } void ethosu_inference_begin(struct ethosu_driver *drv, void *) { @@ -105,7 +107,7 @@ void ethosu_inference_end(struct ethosu_driver *drv, void *) { // Disable polling SysTick->CTRL = 0; - ethosuDrv = 0; + ethosuDrv = nullptr; ethosuMonitor.monitorSample(drv); ethosuMonitor.release(drv); } -- cgit v1.2.1