espcoredump: fix a bug where tracked DRAM data where not dumped

Variables marked as COREDUMP_DRAM_ATTR will now be part of the core dump.

* Closes https://github.com/espressif/esp-idf/issues/8151
pull/8238/head
Omar Chebib 2021-12-29 10:40:22 +08:00
rodzic 5d47efb72d
commit b0afae5e60
3 zmienionych plików z 26 dodań i 17 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -25,17 +25,24 @@ extern "C" {
// Forces data into DRAM instead of flash
#define DRAM_ATTR _SECTION_ATTR_IMPL(".dram1", __COUNTER__)
#ifdef CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY
// IRAM can only be accessed as an 8-bit memory on ESP32, when CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY is set
#define IRAM_8BIT_ACCESSIBLE (CONFIG_IDF_TARGET_ESP32 && CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY)
// Make sure that IRAM is accessible as an 8-bit memory on ESP32.
// If that's not the case, coredump cannot dump data from IRAM.
#if IRAM_8BIT_ACCESSIBLE
// Forces data into IRAM instead of DRAM
#define IRAM_DATA_ATTR __attribute__((section(".iram.data")))
// Forces data into IRAM instead of DRAM and map it to coredump
#define COREDUMP_IRAM_DATA_ATTR _SECTION_ATTR_IMPL(".iram.data.coredump", __COUNTER__)
#define COREDUMP_IRAM_DATA_ATTR _SECTION_ATTR_IMPL(".iram2.coredump", __COUNTER__)
// Forces bss into IRAM instead of DRAM
#define IRAM_BSS_ATTR __attribute__((section(".iram.bss")))
#else
#define COREDUMP_IRAM_DATA_ATTR
// IRAM is not accessible as an 8-bit memory, put IRAM coredump variables in DRAM
#define COREDUMP_IRAM_DATA_ATTR COREDUMP_DRAM_ATTR
#define IRAM_DATA_ATTR
#define IRAM_BSS_ATTR
@ -95,7 +102,9 @@ extern "C" {
#define RTC_NOINIT_ATTR _SECTION_ATTR_IMPL(".rtc_noinit", __COUNTER__)
// Forces code into DRAM instead of flash and map it to coredump
#define COREDUMP_DRAM_ATTR _SECTION_ATTR_IMPL(".dram1.coredump", __COUNTER__)
// Use dram2 instead of dram1 to make sure this section will not be included
// by dram1 section in the linker script
#define COREDUMP_DRAM_ATTR _SECTION_ATTR_IMPL(".dram2.coredump", __COUNTER__)
// Forces data into RTC memory and map it to coredump
#define COREDUMP_RTC_DATA_ATTR _SECTION_ATTR_IMPL(".rtc.coredump", __COUNTER__)

Wyświetl plik

@ -178,7 +178,8 @@ SECTIONS
mapping[iram0_text]
/* added to maintain compability */
/* Added to maintain compability, there are no iram0 data section to put
* sections:iram_coredump entry defined in espcoredump's linker.lf file */
_coredump_iram_start = 0;
_coredump_iram_end = 0;

Wyświetl plik

@ -8,20 +8,21 @@ entries:
[sections:dram_coredump]
entries:
.dram1.coredump+
.dram2.coredump+
if IDF_TARGET_ESP32S2 = n:
[sections:iram_coredump]
entries:
.iram.data.coredump+
# Always include .iram2.coredump section in the final linker script file,
# even though it may be empty. The coredump component will ignore empty
# sections when generating the ELF dump.
[sections:iram_coredump]
entries:
.iram2.coredump+
[scheme:coredump_default]
entries:
dram_coredump -> dram0_data
rtc_coredump -> rtc_data
rtc_fast_coredump -> rtc_force_fast
if IDF_TARGET_ESP32S2 = n:
iram_coredump -> iram0_data
iram_coredump -> iram0_data
[mapping:coredump_default]
archive: *
@ -29,10 +30,8 @@ entries:
* (coredump_default);
rtc_fast_coredump -> rtc_force_fast SURROUND(coredump_rtc_fast),
rtc_coredump -> rtc_data SURROUND(coredump_rtc),
dram_coredump -> dram0_data SURROUND(coredump_dram)
if IDF_TARGET_ESP32S2 = n:
* (coredump_default);
iram_coredump -> iram0_data SURROUND(coredump_iram)
dram_coredump -> dram0_data SURROUND(coredump_dram),
iram_coredump -> iram0_data SURROUND(coredump_iram)
[mapping:espcoredump]
archive: libespcoredump.a