1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 10:58:21 +00:00

feat(core): measure systick with systemview

This commit is contained in:
Ondrej Mikle 2020-11-27 14:25:24 +01:00 committed by Pavol Rusnak
parent c5e986b1ba
commit 60e4e06aa5
2 changed files with 9 additions and 0 deletions

View File

@ -4,8 +4,13 @@
#ifdef SYSTEM_VIEW #ifdef SYSTEM_VIEW
#include "SEGGER_SYSVIEW.h"
void enable_systemview(); void enable_systemview();
#else
#define SEGGER_SYSVIEW_RecordEnterISR() do {} while(0)
#define SEGGER_SYSVIEW_RecordExitISR() do {} while(0)
#endif #endif
#endif //CORE_SYSTEMVIEW_H #endif //CORE_SYSTEMVIEW_H

View File

@ -52,11 +52,14 @@
#include "rdi.h" #include "rdi.h"
#endif #endif
#include "systemview.h"
extern __IO uint32_t uwTick; extern __IO uint32_t uwTick;
systick_dispatch_t systick_dispatch_table[SYSTICK_DISPATCH_NUM_SLOTS]; systick_dispatch_t systick_dispatch_table[SYSTICK_DISPATCH_NUM_SLOTS];
void SysTick_Handler(void) { void SysTick_Handler(void) {
SEGGER_SYSVIEW_RecordEnterISR();
// this is a millisecond tick counter that wraps after approximately // this is a millisecond tick counter that wraps after approximately
// 49.71 days = (0xffffffff / (24 * 60 * 60 * 1000)) // 49.71 days = (0xffffffff / (24 * 60 * 60 * 1000))
uint32_t uw_tick = uwTick + 1; uint32_t uw_tick = uwTick + 1;
@ -68,4 +71,5 @@ void SysTick_Handler(void) {
if (f != NULL) { if (f != NULL) {
f(uw_tick); f(uw_tick);
} }
SEGGER_SYSVIEW_RecordExitISR();
} }