Skip to content

Commit ff78dd0

Browse files
committed
zephyr: alloc: Move heap on MT8365 platform to ADSP SRAM
sram0 memory region holds vectors and heap. On MT8365 platform it is assigned to DRAM. Allocate heap on MT8365 platform on ADSP SRAM instead. Signed-off-by: Andrew Perepech <andrew.perepech@mediatek.com>
1 parent 9bd165d commit ff78dd0

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/platform/mtk/dai.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#define SRAM_CPU_START 0x1a210000
2525
#elif defined(CONFIG_SOC_MT8365)
2626
#define MTK_AFE_BASE 0x11220000
27-
#define SRAM_CPU_START 0x40020000
27+
#define SRAM_CPU_START 0x1e000000
2828
#else
2929
#error Unrecognized device
3030
#endif

zephyr/lib/alloc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,17 @@ char __aligned(8) heapmem[HEAPMEM_SIZE];
120120
#elif defined(CONFIG_SOC_FAMILY_MTK)
121121

122122
extern char _mtk_adsp_sram_end;
123+
#if defined(CONFIG_SOC_MT8365)
124+
#define SRAM_START DT_REG_ADDR(DT_NODELABEL(sram1))
125+
#define SRAM_SIZE DT_REG_SIZE(DT_NODELABEL(sram1))
126+
#define heapmem ((uint8_t *)SRAM_START)
127+
#else
123128
#define SRAM_START DT_REG_ADDR(DT_NODELABEL(sram0))
124129
#define SRAM_SIZE DT_REG_SIZE(DT_NODELABEL(sram0))
125-
#define SRAM_END (SRAM_START + SRAM_SIZE)
126130
#define heapmem ((uint8_t *)ALIGN_UP((uintptr_t)&_mtk_adsp_sram_end, PLATFORM_DCACHE_ALIGN))
131+
#endif /* CONFIG_SOC_MT8365 */
132+
133+
#define SRAM_END (SRAM_START + SRAM_SIZE)
127134

128135
/* Heap size is limited to 0x7fffU chunk units when CONFIG_SYS_HEAP_SMALL_ONLY is set */
129136
#if defined(CONFIG_SYS_HEAP_SMALL_ONLY)

0 commit comments

Comments
 (0)