ESP32S3使用串口0作为LOG输出
配置
配置串口,在内存保护这个选项里Memory protection
修改内存申请函数
测试代码
uint8_t buf1 = heap_caps_malloc(320*240 * sizeof(lv_color_t), MALLOC_CAP_SPIRAM);
ESP_LOGI("Test", "%d", buf1);sprintf(buffer, " Biggest / Free / Total\n""\t SRAM : [%8d / %8d / %8d]\n""\t PSRAM : [%8d / %8d / %8d]",heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL),heap_caps_get_free_size(MALLOC_CAP_INTERNAL),heap_caps_get_total_size(MALLOC_CAP_INTERNAL),heap_caps_get_largest_free_block(MALLOC_CAP_SPIRAM),heap_caps_get_free_size(MALLOC_CAP_SPIRAM),heap_caps_get_total_size(MALLOC_CAP_SPIRAM));
ESP_LOGI("MEM", "%s", buffer);
运行结果