]> granicus.if.org Git - esp-idf/commitdiff
sysview: always use TG as timestamp source
authorIvan Grokhotkov <ivan@espressif.com>
Tue, 29 Aug 2017 10:34:43 +0000 (18:34 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Wed, 18 Oct 2017 06:19:20 +0000 (14:19 +0800)
components/app_trace/Kconfig
components/app_trace/sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c
components/app_trace/sys_view/esp32/SEGGER_RTT_esp32.c

index 101fa978658a0559e22cd7f7186a690fe885f0cc..6883db57efda003585891fa6f2ded364e8fdb8e3 100644 (file)
@@ -63,13 +63,13 @@ config SYSVIEW_ENABLE
     help
         Enables supporrt for SEGGER SystemView tracing functionality.
 
-if !FREERTOS_UNICORE
 choice SYSVIEW_TS_SOURCE
     prompt "ESP32 timer to use as SystemView timestamp source"
     depends on SYSVIEW_ENABLE
     default SYSVIEW_TS_SOURCE_TIMER_00
     help
-        SystemView needs one source for timestamps when tracing events from both cores.
+        SystemView needs to use a hardware timer as the source of timestamps
+        when tracing 
         This option selects HW timer for it.
 
 config SYSVIEW_TS_SOURCE_TIMER_00
@@ -93,7 +93,6 @@ config SYSVIEW_TS_SOURCE_TIMER_11
         Select this to use timer 1 of group 1
 
 endchoice
-endif #FREERTOS_UNICORE
 
 config SYSVIEW_EVT_OVERFLOW_ENABLE
     bool "Trace Buffer Overflow Event"
index 87d76f32ab443e51b8a4e17ad9a815c92184fe62..728879b6a27a329830f0b0b0090525f0d13a5102 100644 (file)
@@ -70,6 +70,7 @@ Revision: $Rev: 3734 $
 #include "esp_app_trace.h"
 #include "esp_app_trace_util.h"
 #include "esp_intr_alloc.h"
+#include "esp_clk.h"
 
 extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
 
@@ -85,14 +86,12 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
 // The target device name
 #define SYSVIEW_DEVICE_NAME     "ESP32"
 
+// Timer group timer divisor
+#define SYSVIEW_TIMER_DIV       2
 // Frequency of the timestamp.
-#if CONFIG_FREERTOS_UNICORE == 0
-#define SYSVIEW_TIMESTAMP_FREQ  (TIMER_BASE_CLK/2)
-#else
-#define SYSVIEW_TIMESTAMP_FREQ  (XT_CLOCK_FREQ)
-#endif
+#define SYSVIEW_TIMESTAMP_FREQ  (esp_clk_apb_freq() / SYSVIEW_TIMER_DIV)
 // System Frequency.
-#define SYSVIEW_CPU_FREQ        (XT_CLOCK_FREQ)
+#define SYSVIEW_CPU_FREQ        (esp_clk_cpu_freq())
 
 // The lowest RAM address used for IDs (pointers)
 #define SYSVIEW_RAM_BASE        (0x3F400000)
@@ -104,10 +103,8 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
     #define SYSTICK_INTR_ID (ETS_INTERNAL_TIMER1_INTR_SOURCE+ETS_INTERNAL_INTR_SOURCE_OFF)
 #endif
 
-#if CONFIG_FREERTOS_UNICORE == 0
 static timer_idx_t s_ts_timer_idx;
 static timer_group_t s_ts_timer_group;
-#endif
 
 // SystemView is single core specific: it implies that SEGGER_SYSVIEW_LOCK()
 // disables IRQs (disables rescheduling globaly). So we can not use finite timeouts for locks and return error
@@ -214,7 +211,6 @@ static void _cbSendSystemDesc(void) {
 *
 **********************************************************************
 */
-#if CONFIG_FREERTOS_UNICORE == 0
 static void SEGGER_SYSVIEW_TS_Init()
 {
     timer_config_t config;
@@ -238,7 +234,7 @@ static void SEGGER_SYSVIEW_TS_Init()
     config.alarm_en = 0;
     config.auto_reload = 0;
     config.counter_dir = TIMER_COUNT_UP;
-    config.divider = 2;
+    config.divider = SYSVIEW_TIMER_DIV;
     config.counter_en = 0;
     /*Configure timer*/
     timer_init(s_ts_timer_group, s_ts_timer_idx, &config);
@@ -247,14 +243,11 @@ static void SEGGER_SYSVIEW_TS_Init()
     /*Enable timer interrupt*/
     timer_start(s_ts_timer_group, s_ts_timer_idx);
 }
-#endif
 
 void SEGGER_SYSVIEW_Conf(void) {
     U32 disable_evts = 0;
 
-#if CONFIG_FREERTOS_UNICORE == 0
     SEGGER_SYSVIEW_TS_Init();
-#endif
     SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
                         &SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
     SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
index fd674bbb6cfbdca0153c77f7bac8def50c57f251..c8b199540e355a545d31db66cecf732a672d9e43 100644 (file)
@@ -26,16 +26,6 @@ const static char *TAG = "segger_rtt";
 
 #define SYSVIEW_EVENTS_BUF_SZ         255U
 
-#if SYSVIEW_RTT_MAX_DATA_RATE > 0
-#include "SEGGER_SYSVIEW_Conf.h"
-#if CONFIG_FREERTOS_UNICORE == 0
-#include "driver/timer.h"
-#define SYSVIEW_TIMESTAMP_FREQ  (TIMER_BASE_CLK/2)
-#else
-#define SYSVIEW_TIMESTAMP_FREQ  (XT_CLOCK_FREQ)
-#endif
-#endif
-
 // size of down channel data buf
 #define SYSVIEW_DOWN_BUF_SIZE   32
 #define SEGGER_HOST_WAIT_TMO    500 //us