aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristofer Jonsson <kristofer.jonsson@arm.com>2022-12-05 14:41:13 +0100
committerKristofer Jonsson <kristofer.jonsson@arm.com>2022-12-05 14:47:56 +0100
commit4646ed102788fa8aacd5c0ee500640199d9e7a4a (patch)
tree101d9ff456c53f451cd22f280e99625f92ec5b00
parenta847621e6c12eb0e36daeece578320a0bfc1e366 (diff)
downloadethos-u-core-platform-4646ed102788fa8aacd5c0ee500640199d9e7a4a.tar.gz
Use delta delays for baremetal application
Baremetal application uses systick to poll the Ethos-U PMU block for profiling data. Instead of using a periodical timer, the timer is now reset at the end of every poll. This will reduce the risk of "systick deadlock" where the timing for handling the systick is longer than the time of the periodic tick. Change-Id: Ie812fab151b33d10bdf1cb4c5fb3e4fcbd5f1b05
-rw-r--r--applications/baremetal/main.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/applications/baremetal/main.cpp b/applications/baremetal/main.cpp
index 6ed7cbe..d27e4a4 100644
--- a/applications/baremetal/main.cpp
+++ b/applications/baremetal/main.cpp
@@ -78,7 +78,7 @@ std::vector<ethosu_pmu_event_type> pmuEventConfig{ethosu_pmu_event_type(ETHOSU_P
ethosu_pmu_event_type(ETHOSU_PMU_EVENT_2),
ethosu_pmu_event_type(ETHOSU_PMU_EVENT_3)};
-const uint32_t delayMs = SystemCoreClock / 1000ul;
+const uint32_t delay = 250ul;
struct ethosu_driver *ethosuDrv;
EthosUMonitor ethosuMonitor(EthosUMonitor::Backend::EVENT_RECORDER);
} // namespace
@@ -86,15 +86,19 @@ EthosUMonitor ethosuMonitor(EthosUMonitor::Backend::EVENT_RECORDER);
extern "C" {
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);
+
+ // Restart the systick timer
+ SysTick_Config(delay);
}
void ethosu_inference_begin(struct ethosu_driver *drv, void *) {
ethosuDrv = drv;
ethosuMonitor.configure(drv, pmuEventConfig);
-
- // Enable polling
- SysTick_Config(delayMs);
+ SysTick_Config(delay);
}
void ethosu_inference_end(struct ethosu_driver *drv, void *) {
@@ -121,6 +125,7 @@ int runInference() {
bool failed = inferenceProcess.runJob(job);
printf("Status of executed job: ");
printf(failed ? "Failed\n" : "Success\n");
+ printf("Performance monitor merge count %zu\n", ethosuMonitor.getMergeCount());
return failed;
}