1. Fix backtrace is incomplete

2. Optimization code style
This commit is contained in:
Li Shuai
2019-08-14 16:07:24 +08:00
committed by jiangguangming
parent 653d8b5bdd
commit bd29202520
7 changed files with 27 additions and 25 deletions

View File

@@ -39,12 +39,16 @@ possible. This should optimize the amount of RAM accessible to the code without
IRAM_ATTR static void *dram_alloc_to_iram_addr(void *addr, size_t len)
{
uintptr_t dstart = (uintptr_t)addr; //First word
uintptr_t dend = dstart + len - 4; //Last word
uintptr_t dend = dstart + len; //Last word + 4
assert(esp_ptr_in_diram_dram((void *)dstart));
assert(esp_ptr_in_diram_dram((void *)dend));
assert((dstart & 3) == 0);
assert((dend & 3) == 0);
#if CONFIG_IDF_TARGET_ESP32
uint32_t istart = SOC_DIRAM_IRAM_LOW + (SOC_DIRAM_DRAM_HIGH - dend);
#elif CONFIG_IDF_TARGET_ESP32S2BETA
uint32_t istart = SOC_DIRAM_IRAM_LOW + (dstart - SOC_DIRAM_DRAM_LOW);
#endif
uint32_t *iptr = (uint32_t *)istart;
*iptr = dstart;
return iptr + 1;