From 60e4e06aa59ac7be6adf51748ba73bdfd305c075 Mon Sep 17 00:00:00 2001 From: Ondrej Mikle Date: Fri, 27 Nov 2020 14:25:24 +0100 Subject: [PATCH] feat(core): measure systick with systemview --- core/embed/firmware/systemview.h | 5 +++++ core/embed/trezorhal/systick.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/core/embed/firmware/systemview.h b/core/embed/firmware/systemview.h index a260d3b82..6169ee551 100644 --- a/core/embed/firmware/systemview.h +++ b/core/embed/firmware/systemview.h @@ -4,8 +4,13 @@ #ifdef SYSTEM_VIEW +#include "SEGGER_SYSVIEW.h" + void enable_systemview(); +#else +#define SEGGER_SYSVIEW_RecordEnterISR() do {} while(0) +#define SEGGER_SYSVIEW_RecordExitISR() do {} while(0) #endif #endif //CORE_SYSTEMVIEW_H diff --git a/core/embed/trezorhal/systick.c b/core/embed/trezorhal/systick.c index 7320a653f..7b46aebc6 100644 --- a/core/embed/trezorhal/systick.c +++ b/core/embed/trezorhal/systick.c @@ -52,11 +52,14 @@ #include "rdi.h" #endif +#include "systemview.h" + extern __IO uint32_t uwTick; systick_dispatch_t systick_dispatch_table[SYSTICK_DISPATCH_NUM_SLOTS]; void SysTick_Handler(void) { + SEGGER_SYSVIEW_RecordEnterISR(); // this is a millisecond tick counter that wraps after approximately // 49.71 days = (0xffffffff / (24 * 60 * 60 * 1000)) uint32_t uw_tick = uwTick + 1; @@ -68,4 +71,5 @@ void SysTick_Handler(void) { if (f != NULL) { f(uw_tick); } + SEGGER_SYSVIEW_RecordExitISR(); }