From e1c0fb0c62f8ea1cd58139434ed037286db0e580 Mon Sep 17 00:00:00 2001 From: Shubham Kulkarni Date: Wed, 5 Feb 2020 18:39:14 +0530 Subject: [PATCH] log: Check for ISR context and use proper API to get Tick Count --- components/log/log_freertos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/log/log_freertos.c b/components/log/log_freertos.c index 74d2fc540..e619944df 100644 --- a/components/log/log_freertos.c +++ b/components/log/log_freertos.c @@ -99,7 +99,8 @@ uint32_t esp_log_timestamp(void) if (base == 0 && xPortGetCoreID() == 0) { base = esp_log_early_timestamp(); } - return base + xTaskGetTickCount() * (1000 / configTICK_RATE_HZ); + TickType_t tick_count = xPortInIsrContext() ? xTaskGetTickCountFromISR() : xTaskGetTickCount(); + return base + tick_count * (1000 / configTICK_RATE_HZ); } /* FIXME: define an API for getting the timestamp in soc/hal */