mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
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
This commit is contained in:
parent
5d47efb72d
commit
b0afae5e60
@ -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
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -25,17 +25,24 @@ extern "C" {
|
|||||||
// Forces data into DRAM instead of flash
|
// Forces data into DRAM instead of flash
|
||||||
#define DRAM_ATTR _SECTION_ATTR_IMPL(".dram1", __COUNTER__)
|
#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
|
// Forces data into IRAM instead of DRAM
|
||||||
#define IRAM_DATA_ATTR __attribute__((section(".iram.data")))
|
#define IRAM_DATA_ATTR __attribute__((section(".iram.data")))
|
||||||
|
|
||||||
// Forces data into IRAM instead of DRAM and map it to coredump
|
// 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
|
// Forces bss into IRAM instead of DRAM
|
||||||
#define IRAM_BSS_ATTR __attribute__((section(".iram.bss")))
|
#define IRAM_BSS_ATTR __attribute__((section(".iram.bss")))
|
||||||
#else
|
#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_DATA_ATTR
|
||||||
|
|
||||||
#define IRAM_BSS_ATTR
|
#define IRAM_BSS_ATTR
|
||||||
@ -95,7 +102,9 @@ extern "C" {
|
|||||||
#define RTC_NOINIT_ATTR _SECTION_ATTR_IMPL(".rtc_noinit", __COUNTER__)
|
#define RTC_NOINIT_ATTR _SECTION_ATTR_IMPL(".rtc_noinit", __COUNTER__)
|
||||||
|
|
||||||
// Forces code into DRAM instead of flash and map it to coredump
|
// 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
|
// Forces data into RTC memory and map it to coredump
|
||||||
#define COREDUMP_RTC_DATA_ATTR _SECTION_ATTR_IMPL(".rtc.coredump", __COUNTER__)
|
#define COREDUMP_RTC_DATA_ATTR _SECTION_ATTR_IMPL(".rtc.coredump", __COUNTER__)
|
||||||
|
@ -178,7 +178,8 @@ SECTIONS
|
|||||||
|
|
||||||
mapping[iram0_text]
|
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_start = 0;
|
||||||
_coredump_iram_end = 0;
|
_coredump_iram_end = 0;
|
||||||
|
|
||||||
|
@ -8,20 +8,21 @@ entries:
|
|||||||
|
|
||||||
[sections:dram_coredump]
|
[sections:dram_coredump]
|
||||||
entries:
|
entries:
|
||||||
.dram1.coredump+
|
.dram2.coredump+
|
||||||
|
|
||||||
if IDF_TARGET_ESP32S2 = n:
|
# Always include .iram2.coredump section in the final linker script file,
|
||||||
[sections:iram_coredump]
|
# even though it may be empty. The coredump component will ignore empty
|
||||||
entries:
|
# sections when generating the ELF dump.
|
||||||
.iram.data.coredump+
|
[sections:iram_coredump]
|
||||||
|
entries:
|
||||||
|
.iram2.coredump+
|
||||||
|
|
||||||
[scheme:coredump_default]
|
[scheme:coredump_default]
|
||||||
entries:
|
entries:
|
||||||
dram_coredump -> dram0_data
|
dram_coredump -> dram0_data
|
||||||
rtc_coredump -> rtc_data
|
rtc_coredump -> rtc_data
|
||||||
rtc_fast_coredump -> rtc_force_fast
|
rtc_fast_coredump -> rtc_force_fast
|
||||||
if IDF_TARGET_ESP32S2 = n:
|
iram_coredump -> iram0_data
|
||||||
iram_coredump -> iram0_data
|
|
||||||
|
|
||||||
[mapping:coredump_default]
|
[mapping:coredump_default]
|
||||||
archive: *
|
archive: *
|
||||||
@ -29,10 +30,8 @@ entries:
|
|||||||
* (coredump_default);
|
* (coredump_default);
|
||||||
rtc_fast_coredump -> rtc_force_fast SURROUND(coredump_rtc_fast),
|
rtc_fast_coredump -> rtc_force_fast SURROUND(coredump_rtc_fast),
|
||||||
rtc_coredump -> rtc_data SURROUND(coredump_rtc),
|
rtc_coredump -> rtc_data SURROUND(coredump_rtc),
|
||||||
dram_coredump -> dram0_data SURROUND(coredump_dram)
|
dram_coredump -> dram0_data SURROUND(coredump_dram),
|
||||||
if IDF_TARGET_ESP32S2 = n:
|
iram_coredump -> iram0_data SURROUND(coredump_iram)
|
||||||
* (coredump_default);
|
|
||||||
iram_coredump -> iram0_data SURROUND(coredump_iram)
|
|
||||||
|
|
||||||
[mapping:espcoredump]
|
[mapping:espcoredump]
|
||||||
archive: libespcoredump.a
|
archive: libespcoredump.a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user