mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -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
000d3823bb
commit
b868fd2a95
@ -1,17 +1,9 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
#ifndef __ESP_ATTR_H__
|
||||
#define __ESP_ATTR_H__
|
||||
|
||||
@ -33,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
|
||||
@ -103,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__)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -8,19 +8,20 @@ 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
|
||||
|
||||
[mapping:coredump_default]
|
||||
@ -29,9 +30,7 @@ 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);
|
||||
dram_coredump -> dram0_data SURROUND(coredump_dram),
|
||||
iram_coredump -> iram0_data SURROUND(coredump_iram)
|
||||
|
||||
[mapping:espcoredump]
|
||||
|
Loading…
Reference in New Issue
Block a user