fix(esp8266): fix backtrace does not trace ROM code

This commit is contained in:
Dong Heng
2019-12-02 10:19:52 +08:00
parent b30796bde2
commit a9c34d2c77
2 changed files with 7 additions and 1 deletions

View File

@ -208,9 +208,13 @@
#define RTC_USER_BASE (0x60001200)
#define RTC_USER_SIZE (0x200)
#define ROM_BASE (0x40000000)
#define ROM_SIZE (0x10000)
#define IS_DRAM(a) ((size_t)(a) >= DRAM_BASE && (size_t)(a) < (DRAM_BASE + DRAM_SIZE))
#define IS_IRAM(a) ((size_t)(a) >= IRAM_BASE && (size_t)(a) < (IRAM_BASE + IRAM_SIZE))
#define IS_FLASH(a) ((size_t)(a) >= FLASH_BASE && (size_t)(a) < (FLASH_BASE + FLASH_SIZE))
#define IS_USR_RTC(a) ((size_t)(a) >= RTC_USER_BASE && (size_t)(a) < (RTC_USER_BASE + RTC_USER_SIZE))
#define IS_ROM(a) ((size_t)(a) >= ROM_BASE && (size_t)(a) < (ROM_BASE + ROM_SIZE))
#endif //_EAGLE_SOC_H_

View File

@ -15,7 +15,7 @@
#include <stdint.h>
#include "esp8266/eagle_soc.h"
static inline uint32_t prev_text_size(const uint32_t pc)
static uint32_t prev_text_size(const uint32_t pc)
{
uint32_t size;
extern uint32_t _text_start, _text_end;
@ -24,6 +24,8 @@ static inline uint32_t prev_text_size(const uint32_t pc)
size = pc - (uint32_t )&_text_start;
} else if (IS_IRAM(pc)) {
size = pc - IRAM_BASE;
} else if (IS_ROM(pc)) {
size = pc - ROM_BASE;
} else {
size = 0;
}