fix(heap): Fix heap initialize error when disable IRAM for heap

This commit is contained in:
Dong Heng
2018-09-20 19:52:02 +08:00
parent 8ead6d15c6
commit 8eacaee32c
2 changed files with 9 additions and 4 deletions

View File

@ -22,17 +22,18 @@ heap_region_t g_heap_region[HEAP_REGIONS_MAX];
void heap_caps_init(void)
{
extern char _heap_start;
extern char _lit4_end;
#ifndef CONFIG_SOC_FULL_ICACHE
extern char _lit4_end;
g_heap_region[0].start_addr = (uint8_t *)&_lit4_end;
g_heap_region[0].total_size = ((size_t)(0x4010C000 - (uint32_t)&_lit4_end));
g_heap_region[0].caps = MALLOC_CAP_32BIT;
#endif
g_heap_region[1].start_addr = (uint8_t *)&_heap_start;
g_heap_region[1].total_size = ((size_t)(0x40000000 - (uint32_t)&_heap_start));
g_heap_region[1].caps = MALLOC_CAP_8BIT | MALLOC_CAP_32BIT | MALLOC_CAP_DMA;
g_heap_region[HEAP_REGIONS_MAX - 1].start_addr = (uint8_t *)&_heap_start;
g_heap_region[HEAP_REGIONS_MAX - 1].total_size = ((size_t)(0x40000000 - (uint32_t)&_heap_start));
g_heap_region[HEAP_REGIONS_MAX - 1].caps = MALLOC_CAP_8BIT | MALLOC_CAP_32BIT | MALLOC_CAP_DMA;
esp_heap_caps_init_region(g_heap_region, HEAP_REGIONS_MAX);
}

View File

@ -18,6 +18,10 @@
#define HEAP_ALIGN_SIZE 4
#ifdef CONFIG_SOC_FULL_ICACHE
#define HEAP_REGIONS_MAX 1
#else
#define HEAP_REGIONS_MAX 2
#endif
#define MEM_BLK_MIN 1