feat(heap): add heap private config to enable/disable using IRAM as heap

This commit is contained in:
Chen Wen
2019-07-17 20:58:34 +08:00
committed by dongheng
parent e9d2281335
commit a7aeeb28d5
7 changed files with 49 additions and 24 deletions

View File

@ -18,7 +18,7 @@
#define HEAP_ALIGN_SIZE 4
#ifdef CONFIG_SOC_FULL_ICACHE
#ifdef CONFIG_HEAP_DISABLE_IRAM
#define HEAP_REGIONS_MAX 1
#else
#define HEAP_REGIONS_MAX 2

View File

@ -103,9 +103,11 @@ static inline size_t blk_link_size(mem_blk_t *blk)
static inline size_t get_blk_region(void *ptr)
{
size_t num;
extern heap_region_t g_heap_region[HEAP_REGIONS_MAX];
extern size_t g_heap_region_num;
extern heap_region_t g_heap_region[];
for (num = 0; num < HEAP_REGIONS_MAX; num++) {
for (num = 0; num < g_heap_region_num; num++) {
if ((uint8_t *)ptr > (uint8_t *)g_heap_region[num].start_addr
&& (uint8_t *)ptr < ((uint8_t *)g_heap_region[num].start_addr + g_heap_region[num].total_size)) {
break;