大家好,我的测试硬件为ESP32-DevKitC 开发板 + ESP32-LCDKit + st7796串口屏。测试例子esp-iot-solution/examples/screen。
分辨率设置的为320X480.在测试代码执行时,提示screen example: lcd_speed_test:Memory for bitmap is not enough。
I (29) boot: ESP-IDF v4.3 2nd stage bootloader
I (29) boot: compile time 22:41:33
I (29) boot: chip revision: 3
I (32) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (39) boot.esp32: SPI Speed : 40MHz
I (43) boot.esp32: SPI Mode : DIO
I (48) boot.esp32: SPI Flash Size : 2MB
I (53) boot: Enabling RNG early entropy source...
I (58) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (69) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (76) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (84) boot: 2 factory factory app 00 00 00010000 00100000
I (91) boot: End of partition table
I (95) boot_comm: chip revision: 3, min. application chip revision: 0
I (103) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0ad8ch ( 44428) map
I (128) esp_image: segment 1: paddr=0001adb4 vaddr=3ffb0000 size=02a28h ( 10792) load
I (133) esp_image: segment 2: paddr=0001d7e4 vaddr=40080000 size=02834h ( 10292) load
I (138) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=1b3e0h (111584) map
I (184) esp_image: segment 4: paddr=0003b408 vaddr=40082834 size=0b094h ( 45204) load
I (204) esp_image: segment 5: paddr=000464a4 vaddr=50000000 size=00010h ( 16) load
I (212) boot: Loaded app from partition at offset 0x10000
I (212) boot: Disabling RNG early entropy source...
I (224) cpu_start: Pro cpu up.
I (224) cpu_start: Starting app cpu, entry point is 0x400811dc
0x400811dc: call_start_cpu1 at D:/esp/esp-idf/components/esp_system/port/cpu_start.c:141
I (0) cpu_start: App cpu up.
I (238) cpu_start: Pro cpu start user code
I (238) cpu_start: cpu freq: 240000000
I (238) cpu_start: Application information:
I (243) cpu_start: Project name: screen_demo
I (248) cpu_start: App version: 87e76fd-dirty
I (254) cpu_start: Compile time: Nov 6 2021 23:01:36
I (260) cpu_start: ELF file SHA256: 1d5e7c64840b2368...
I (266) cpu_start: ESP-IDF: v4.3
I (271) heap_init: Initializing. RAM available for dynamic allocation:
I (278) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (284) heap_init: At 3FFB3388 len 0002CC78 (179 KiB): DRAM
I (290) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (296) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (303) heap_init: At 4008D8C8 len 00012738 (73 KiB): IRAM
I (310) spi_flash: detected chip: generic
I (314) spi_flash: flash io: dio
W (317) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (331) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (347) spi_bus: SPI2 bus created
I (351) Board: Board Info: ESP32-LCDKit
I (355) Board: Board Init Done ...
I (360) spi_bus: SPI2 bus device added, CS=5 Mode=0 Speed=20000000
I (676) lcd st7796: MADCTL=e8
I (676) screen example: Screen name:ST7796 | width:480 | height:320
E (3378) screen example: lcd_speed_test:Memory for bitmap is not enough, free/need:291324/204800
lcd_speed_test 函数前部:
static void lcd_speed_test(scr_driver_t *lcd)
{
scr_info_t lcd_info;
lcd->get_info(&lcd_info);
uint32_t w = 320, h = 480;
w = lcd_info.width < w ? lcd_info.width : w;
h = lcd_info.height < h ? lcd_info.height : h;
size_t free_size = heap_caps_get_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
const uint32_t buffer_size = w * h;
uint16_t *pixels = heap_caps_malloc(buffer_size * sizeof(uint16_t), MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);
if (NULL == pixels) {
ESP_LOGE(TAG, "lcd_speed_test:Memory for bitmap is not enough, free/need:%d/%d", free_size, buffer_size * sizeof(uint16_t));
return;
}
...
}
根据heap_caps_get_free_size得到的结果,应该还有内存,为什么不行了,是哪里不对吗?这里的内存分配使用有什么规定原则要遵守吗
ESP32-DevKitC 开发板 + ESP32-LCDKit + st7796串口屏
Moderator: ESP_Bob
Re: ESP32-DevKitC 开发板 + ESP32-LCDKit + st7796串口屏
调用这个 heap_caps_get_largest_free_block 函数查看下内存
Who is online
Users browsing this forum: No registered users and 12 guests