2024-10-25 8:49 AM
I am new to firmware and integrated LVGL in stm32u5 dk1 board . And my elf hex file size is bigger than internal flash hence using external flash for lvgl images . Also running LVGL in external psram . After running I see first screen then it goes immediately to hardfault . Not able to understand this hardfault reason . Need help here . And I checked that PSRAM and External flash is working fine . I have copied entire code at github https://github.com/rohit-trustedwear/stm32dk1-code . the fault is happening at line bg_color.full = buf[0] + (buf[1] << 8); in
#if LV_COLOR_SCREEN_TRANSP
static inline void set_px_argb(uint8_t * buf, lv_color_t color, lv_opa_t opa)
{
lv_color_t bg_color;
lv_color_t res_color;
lv_opa_t bg_opa = buf[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
#if LV_COLOR_DEPTH == 8
bg_color.full = buf[0];
lv_color_mix_with_alpha(bg_color, bg_opa, color, opa, &res_color, &buf[1]);
if(buf[1] <= LV_OPA_MIN) return;
buf[0] = res_color.full;
#elif LV_COLOR_DEPTH == 16
bg_color.full = buf[0] + (buf[1] << 8);
lv_color_mix_with_alpha(bg_color, bg_opa, color, opa, &res_color, &buf[2]);
if(buf[2] <= LV_OPA_MIN) return;
buf[0] = res_color.full & 0xff;
buf[1] = res_color.full >> 8;
#elif LV_COLOR_DEPTH == 32
bg_color = *((lv_color_t *)buf);
lv_color_mix_with_alpha(bg_color, bg_opa, color, opa, &res_color, &buf[3]);
if(buf[3] <= LV_OPA_MIN) return;
buf[0] = res_color.ch.blue;
buf[1] = res_color.ch.green;
buf[2] = res_color.ch.red;
#endif
}
screenshot attached here
2024-11-12 1:54 AM
Hello @Rohit-Trustedwear ,
I recommend you to take a look at this FAQ: How to debug a HardFault on an Arm Cortex®-M STM32.
In this article, we explain how to debug faults on Arm Cortex®-M based STM32 devices. In the process, we learn about fault registers, how to automate fault analysis, and figure out ways to recover from some faults.
I hope this help you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.