What do you want to achieve?
Hello,
I have a working SDRAM setup on an STM32 device, and it performs perfectly in basic tests, such as writing values directly to SDRAM addresses. It also works reliably when flushing two buffers and using direct mode access.
Now, I want to use SDRAM to store the LVGL memory block, as specified in the lv_conf.h configuration file. My goal is to offload the LVGL display buffer to SDRAM to free up internal RAM.
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
#define LV_MEM_SIZE (480 * 1024U) /*[bytes]*/
/*Size of the memory expand for `lv_malloc()` in bytes*/
#define LV_MEM_POOL_EXPAND_SIZE 0
#define LV_MEM_ADR 0xD0600000 /*0: unused*/
/*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/
#if LV_MEM_ADR == 0
#undef LV_MEM_POOL_INCLUDE
#undef LV_MEM_POOL_ALLOC
#endif
#endif /*LV_USE_MALLOC == LV_STDLIB_BUILTIN*/```
However, it doesn’t work as expected. The project compiles successfully, but it triggers a hard fault 0x00000000 when calling lv_display_create().
As shown in the picture, the buffer is correctly placed in SDRAM2, and Display data is stored at address 0xD0600EF4. The fault seems to occur when LVGL attempts to store data related to the theme: theme->base.color_secondary = color_secondary;
theme->disp_size = new_size;
theme->disp_dpi = new_dpi;
theme->base.disp = new_disp;
theme->base.color_primary = color_primary;
theme->base.color_secondary = color_secondary;
theme->base.font_small = font;
theme->base.font_normal = font;
theme->base.font_large = font;
theme->base.apply_cb = theme_apply;
theme->base.flags = dark ? MODE_DARK : 0;
what can I do to find more clues about what is happening?
Any ideas?
What have you tried so far?
I’ve done what it said in the documentation, and also, verified that SDRAM works as desired.
Without using external SDRAM for the main memory pool it works correctly.
Screenshot and/or video

Environment
-
MCU cortex M7
-
LVGL version: 9.1.1