From 639557d9751ecc699c4eca99ae2925197a5e2432 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 17 Jan 2017 22:58:11 +0800 Subject: [PATCH] trace: add Kconfig options for app level trace CONFIG_MEMMAP_TRACEMEM is now a hidden underlying option, which can be enabled using either CONFIG_ESP32_TRAX or CONFIG_ESP32_APP_TRACE --- components/esp32/Kconfig | 33 +++++++++++++++++++-------- components/esp32/cpu_start.c | 6 ++--- components/xtensa-debug-module/trax.c | 8 +++---- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 0db76f3d59..b5497aa8b1 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -28,24 +28,39 @@ config MEMMAP_SMP to save some memory. (ToDo: Make this automatically depend on unicore support) config MEMMAP_TRACEMEM - bool "Use TRAX tracing feature" - default "n" - help - The ESP32 contains a feature which allows you to trace the execution path the processor - has taken through the program. This is stored in a chunk of 32K (16K for single-processor) - of memory that can't be used for general purposes anymore. Disable this if you do not know - what this is. + bool + default "n" config MEMMAP_TRACEMEM_TWOBANKS - bool "Reserve memory for tracing both pro as well as app cpu execution" + bool default "n" - depends on MEMMAP_TRACEMEM && MEMMAP_SMP + +config ESP32_TRAX + bool "Use TRAX tracing feature" + default "n" + select MEMMAP_TRACEMEM help The ESP32 contains a feature which allows you to trace the execution path the processor has taken through the program. This is stored in a chunk of 32K (16K for single-processor) of memory that can't be used for general purposes anymore. Disable this if you do not know what this is. +config ESP32_TRAX_TWOBANKS + bool "Reserve memory for tracing both pro as well as app cpu execution" + default "n" + depends on ESP32_TRAX && MEMMAP_SMP + select MEMMAP_TRACEMEM_TWOBANKS + help + The ESP32 contains a feature which allows you to trace the execution path the processor + has taken through the program. This is stored in a chunk of 32K (16K for single-processor) + of memory that can't be used for general purposes anymore. Disable this if you do not know + what this is. + +config ESP32_APP_TRACE + bool "Use two trace memory banks for application level trace" + default "n" + select MEMMAP_TRACEMEM + select MEMMAP_TRACEMEM_TWOBANKS # Memory to reverse for trace, used in linker script config TRACEMEM_RESERVE_DRAM diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index c3ef142c6b..e9ec77bfe0 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -193,8 +193,8 @@ void start_cpu0_default(void) { esp_setup_syscall_table(); //Enable trace memory and immediately start trace. -#if CONFIG_MEMMAP_TRACEMEM -#if CONFIG_MEMMAP_TRACEMEM_TWOBANKS +#if CONFIG_ESP32_TRAX +#if CONFIG_ESP32_TRAX_TWOBANKS trax_enable(TRAX_ENA_PRO_APP); #else trax_enable(TRAX_ENA_PRO); @@ -250,7 +250,7 @@ void start_cpu0_default(void) #if !CONFIG_FREERTOS_UNICORE void start_cpu1_default(void) { -#if CONFIG_MEMMAP_TRACEMEM_TWOBANKS +#if CONFIG_ESP32_TRAX_TWOBANKS trax_start_trace(TRAX_DOWNCOUNT_WORDS); #endif // Wait for FreeRTOS initialization to finish on PRO CPU diff --git a/components/xtensa-debug-module/trax.c b/components/xtensa-debug-module/trax.c index 5174e44776..15a125584e 100644 --- a/components/xtensa-debug-module/trax.c +++ b/components/xtensa-debug-module/trax.c @@ -30,11 +30,11 @@ static const char* TAG = "trax"; int trax_enable(trax_ena_select_t which) { -#if !CONFIG_MEMMAP_TRACEMEM +#if !CONFIG_ESP32_TRAX ESP_LOGE(TAG, "Trax_enable called, but trax is disabled in menuconfig!"); return ESP_ERR_NO_MEM; #endif -#if !CONFIG_MEMMAP_TRACEMEM_TWOBANKS +#if !CONFIG_ESP32_TRAX_TWOBANKS if (which == TRAX_ENA_PRO_APP || which == TRAX_ENA_PRO_APP_SWAP) return ESP_ERR_NO_MEM; #endif if (which == TRAX_ENA_PRO_APP || which == TRAX_ENA_PRO_APP_SWAP) { @@ -50,7 +50,7 @@ int trax_enable(trax_ena_select_t which) int trax_start_trace(trax_downcount_unit_t units_until_stop) { -#if !CONFIG_MEMMAP_TRACEMEM +#if !CONFIG_ESP32_TRAX ESP_LOGE(TAG, "Trax_start_trace called, but trax is disabled in menuconfig!"); return ESP_ERR_NO_MEM; #endif @@ -74,7 +74,7 @@ int trax_start_trace(trax_downcount_unit_t units_until_stop) int trax_trigger_traceend_after_delay(int delay) { -#if !CONFIG_MEMMAP_TRACEMEM +#if !CONFIG_ESP32_TRAX ESP_LOGE(TAG, "Trax_trigger_traceend_after_delay called, but trax is disabled in menuconfig!"); return ESP_ERR_NO_MEM; #endif