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
This commit is contained in:
Ivan Grokhotkov 2017-01-17 22:58:11 +08:00 committed by Alexey Gerenkov
parent 3ac080fc80
commit 639557d975
3 changed files with 31 additions and 16 deletions

View File

@ -28,24 +28,39 @@ config MEMMAP_SMP
to save some memory. (ToDo: Make this automatically depend on unicore support) to save some memory. (ToDo: Make this automatically depend on unicore support)
config MEMMAP_TRACEMEM config MEMMAP_TRACEMEM
bool "Use TRAX tracing feature" bool
default "n" 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.
config MEMMAP_TRACEMEM_TWOBANKS config MEMMAP_TRACEMEM_TWOBANKS
bool "Reserve memory for tracing both pro as well as app cpu execution" bool
default "n" default "n"
depends on MEMMAP_TRACEMEM && MEMMAP_SMP
config ESP32_TRAX
bool "Use TRAX tracing feature"
default "n"
select MEMMAP_TRACEMEM
help help
The ESP32 contains a feature which allows you to trace the execution path the processor 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) 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 of memory that can't be used for general purposes anymore. Disable this if you do not know
what this is. 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 # Memory to reverse for trace, used in linker script
config TRACEMEM_RESERVE_DRAM config TRACEMEM_RESERVE_DRAM

View File

@ -193,8 +193,8 @@ void start_cpu0_default(void)
{ {
esp_setup_syscall_table(); esp_setup_syscall_table();
//Enable trace memory and immediately start trace. //Enable trace memory and immediately start trace.
#if CONFIG_MEMMAP_TRACEMEM #if CONFIG_ESP32_TRAX
#if CONFIG_MEMMAP_TRACEMEM_TWOBANKS #if CONFIG_ESP32_TRAX_TWOBANKS
trax_enable(TRAX_ENA_PRO_APP); trax_enable(TRAX_ENA_PRO_APP);
#else #else
trax_enable(TRAX_ENA_PRO); trax_enable(TRAX_ENA_PRO);
@ -250,7 +250,7 @@ void start_cpu0_default(void)
#if !CONFIG_FREERTOS_UNICORE #if !CONFIG_FREERTOS_UNICORE
void start_cpu1_default(void) void start_cpu1_default(void)
{ {
#if CONFIG_MEMMAP_TRACEMEM_TWOBANKS #if CONFIG_ESP32_TRAX_TWOBANKS
trax_start_trace(TRAX_DOWNCOUNT_WORDS); trax_start_trace(TRAX_DOWNCOUNT_WORDS);
#endif #endif
// Wait for FreeRTOS initialization to finish on PRO CPU // Wait for FreeRTOS initialization to finish on PRO CPU

View File

@ -30,11 +30,11 @@ static const char* TAG = "trax";
int trax_enable(trax_ena_select_t which) 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!"); ESP_LOGE(TAG, "Trax_enable called, but trax is disabled in menuconfig!");
return ESP_ERR_NO_MEM; return ESP_ERR_NO_MEM;
#endif #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; if (which == TRAX_ENA_PRO_APP || which == TRAX_ENA_PRO_APP_SWAP) return ESP_ERR_NO_MEM;
#endif #endif
if (which == TRAX_ENA_PRO_APP || which == TRAX_ENA_PRO_APP_SWAP) { 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) 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!"); ESP_LOGE(TAG, "Trax_start_trace called, but trax is disabled in menuconfig!");
return ESP_ERR_NO_MEM; return ESP_ERR_NO_MEM;
#endif #endif
@ -74,7 +74,7 @@ int trax_start_trace(trax_downcount_unit_t units_until_stop)
int trax_trigger_traceend_after_delay(int delay) 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!"); ESP_LOGE(TAG, "Trax_trigger_traceend_after_delay called, but trax is disabled in menuconfig!");
return ESP_ERR_NO_MEM; return ESP_ERR_NO_MEM;
#endif #endif