espcoredump: Add support for esp32c2

This commit puts some code under SOC_RTC_MEM_SUPPORTED. This enables use of coredump in targets with no RTC memory support.
This commit is contained in:
Harshit Malpani 2022-09-21 11:57:00 +05:30 committed by Mahavir Jain
parent 45fb699542
commit 8fba04638b
No known key found for this signature in database
GPG Key ID: 99324EF4A00734E0
2 changed files with 10 additions and 0 deletions

View File

@ -22,8 +22,10 @@ extern "C" {
typedef enum {
COREDUMP_MEMORY_DRAM,
COREDUMP_MEMORY_IRAM,
#if SOC_RTC_MEM_SUPPORTED
COREDUMP_MEMORY_RTC,
COREDUMP_MEMORY_RTC_FAST,
#endif
COREDUMP_MEMORY_MAX,
COREDUMP_MEMORY_START = COREDUMP_MEMORY_DRAM
} coredump_region_t;

View File

@ -28,10 +28,12 @@ extern int _coredump_dram_start;
extern int _coredump_dram_end;
extern int _coredump_iram_start;
extern int _coredump_iram_end;
#if SOC_RTC_MEM_SUPPORTED
extern int _coredump_rtc_start;
extern int _coredump_rtc_end;
extern int _coredump_rtc_fast_start;
extern int _coredump_rtc_fast_end;
#endif
/**
* @brief In the menconfig, it is possible to specify a specific stack size for
@ -226,8 +228,10 @@ uint32_t esp_core_dump_get_user_ram_segments(void)
// count number of memory segments to insert into ELF structure
total_sz += COREDUMP_GET_MEMORY_SIZE(&_coredump_dram_end, &_coredump_dram_start) > 0 ? 1 : 0;
#if SOC_RTC_MEM_SUPPORTED
total_sz += COREDUMP_GET_MEMORY_SIZE(&_coredump_rtc_end, &_coredump_rtc_start) > 0 ? 1 : 0;
total_sz += COREDUMP_GET_MEMORY_SIZE(&_coredump_rtc_fast_end, &_coredump_rtc_fast_start) > 0 ? 1 : 0;
#endif
total_sz += COREDUMP_GET_MEMORY_SIZE(&_coredump_iram_end, &_coredump_iram_start) > 0 ? 1 : 0;
return total_sz;
@ -238,8 +242,10 @@ uint32_t esp_core_dump_get_user_ram_size(void)
uint32_t total_sz = 0;
total_sz += COREDUMP_GET_MEMORY_SIZE(&_coredump_dram_end, &_coredump_dram_start);
#if SOC_RTC_MEM_SUPPORTED
total_sz += COREDUMP_GET_MEMORY_SIZE(&_coredump_rtc_end, &_coredump_rtc_start);
total_sz += COREDUMP_GET_MEMORY_SIZE(&_coredump_rtc_fast_end, &_coredump_rtc_fast_start);
#endif
total_sz += COREDUMP_GET_MEMORY_SIZE(&_coredump_iram_end, &_coredump_iram_start);
return total_sz;
@ -262,6 +268,7 @@ int esp_core_dump_get_user_ram_info(coredump_region_t region, uint32_t *start)
total_sz = (uint8_t *)&_coredump_iram_end - (uint8_t *)&_coredump_iram_start;
break;
#if SOC_RTC_MEM_SUPPORTED
case COREDUMP_MEMORY_RTC:
*start = (uint32_t)&_coredump_rtc_start;
total_sz = (uint8_t *)&_coredump_rtc_end - (uint8_t *)&_coredump_rtc_start;
@ -271,6 +278,7 @@ int esp_core_dump_get_user_ram_info(coredump_region_t region, uint32_t *start)
*start = (uint32_t)&_coredump_rtc_fast_start;
total_sz = (uint8_t *)&_coredump_rtc_fast_end - (uint8_t *)&_coredump_rtc_fast_start;
break;
#endif
default:
break;