Skip to content

Commit e3414b9

Browse files
committed
zephyr: wrapper: hardcode SIZEs to unblock building
We have change the size of runtime_shared zone to be decided at link stage, here hardcode HEAP_RUNTIME_SHARED_SIZE to unblock the Zephyr building. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
1 parent cc7dc16 commit e3414b9

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

zephyr/wrapper.c

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,38 @@ __section(".heap_mem") static uint8_t __aligned(64) heapmem[HEAPMEM_SIZE];
7272

7373
#else
7474

75-
#define HEAPMEM_SHARED_SIZE (HEAP_SYSTEM_SIZE + HEAP_RUNTIME_SIZE + \
76-
HEAP_RUNTIME_SHARED_SIZE + HEAP_SYSTEM_SHARED_SIZE)
75+
/*
76+
* TODO: heap size should be set based on Zephyr linker output.
77+
* At the moment, the HEAP_SIZEs are approximations from the XTOS linker scripts
78+
* (e.g. src/platform/apollolake/apollolake.x.in for APL):
79+
* (_bss_end - _runtime_heap_start)
80+
*/
81+
#if (CONFIG_HP_MEMORY_BANKS < 16)
82+
/* e.g. APL */
83+
#define HEAP_SIZE 0x30000
84+
#elif (CONFIG_HP_MEMORY_BANKS < 30)
85+
/* e.g. JSL */
86+
#define HEAP_SIZE 0x80000
87+
#elif (CONFIG_HP_MEMORY_BANKS < 45)
88+
/* e.g. TGL-H */
89+
#define HEAP_SIZE 0x100000
90+
#else
91+
/* e.g. CNL/ICL/TGL */
92+
#define HEAP_SIZE 0x200000
93+
#endif
94+
7795
#ifdef ENABLE_CACHED_HEAP
78-
#define HEAPMEM_SIZE HEAP_BUFFER_SIZE
96+
/* hard code the cached portion at the moment */
97+
#define HEAP_SYSTEM_CACHED_SIZE (HEAP_SIZE / 2)
7998
#else
80-
#define HEAPMEM_SIZE (HEAP_BUFFER_SIZE + HEAPMEM_SHARED_SIZE)
99+
#define HEAP_SYSTEM_CACHED_SIZE 0
81100
#endif
101+
#define HEAPMEM_SIZE (HEAP_SIZE - HEAP_SYSTEM_CACHED_SIZE)
82102

83103
static uint8_t __aligned(PLATFORM_DCACHE_ALIGN)heapmem[HEAPMEM_SIZE];
84104
#ifdef ENABLE_CACHED_HEAP
85-
static uint8_t __aligned(PLATFORM_DCACHE_ALIGN)heapmem_shared[HEAPMEM_SHARED_SIZE];
86-
static struct k_heap sof_heap_shared;
105+
static uint8_t __aligned(PLATFORM_DCACHE_ALIGN)heapmem_cached[HEAP_SYSTEM_CACHED_SIZE];
106+
static struct k_heap sof_heap_cached;
87107
#endif
88108

89109
#endif
@@ -96,7 +116,7 @@ static int statics_init(const struct device *unused)
96116

97117
sys_heap_init(&sof_heap.heap, heapmem, HEAPMEM_SIZE);
98118
#ifdef ENABLE_CACHED_HEAP
99-
sys_heap_init(&sof_heap_shared.heap, heapmem_shared, HEAPMEM_SHARED_SIZE);
119+
sys_heap_init(&sof_heap_cached.heap, heapmem_cached, HEAP_SYSTEM_CACHED_SIZE);
100120
#endif
101121
return 0;
102122
}

0 commit comments

Comments
 (0)