diff --git a/components/heap/port/esp8266/esp_heap_init.c b/components/heap/port/esp8266/esp_heap_init.c index 889b0670..1afa0a91 100644 --- a/components/heap/port/esp8266/esp_heap_init.c +++ b/components/heap/port/esp8266/esp_heap_init.c @@ -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); } diff --git a/components/heap/port/esp8266/include/esp_heap_config.h b/components/heap/port/esp8266/include/esp_heap_config.h index 6c1c97c1..a912b951 100644 --- a/components/heap/port/esp8266/include/esp_heap_config.h +++ b/components/heap/port/esp8266/include/esp_heap_config.h @@ -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