1 /* 2 * Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/kernel.h> 8 #include <zephyr/sys/printk.h> 9 #include <soc/soc_memory_layout.h> 10 #include <zephyr/multi_heap/shared_multi_heap.h> 11 main(void)12int main(void) 13 { 14 int *m_ext, *m_int; 15 16 m_ext = shared_multi_heap_aligned_alloc(SMH_REG_ATTR_EXTERNAL, 32, 4096); 17 18 if (!esp_ptr_external_ram(m_ext)) { 19 printk("SPIRAM mem test failed\n"); 20 } else { 21 printk("SPIRAM mem test pass\n"); 22 } 23 24 shared_multi_heap_free(m_ext); 25 26 m_int = k_malloc(4096); 27 if (!esp_ptr_internal(m_int)) { 28 printk("Internal mem test failed\n"); 29 } else { 30 printk("Internal mem test pass\n"); 31 } 32 33 k_free(m_int); 34 35 return 0; 36 } 37