Porting lvgl to NUCLEO-F446ZE caused RAM overflowed

Description

I am trying to port lvgl to NUCLEO-F446ZE board using stm32cubemx generated makefile then i added the lvgl folder and hal_stm_lvgl folder to the makefile lists. However, when i ran make, i get compilation error stating that RAM overflowed by 926120 bytes.

What MCU/Processor/Board and compiler are you using?

NUCLEO-F446ZE (STM32F446ZET6)
compiled using arm-none-eabi-gcc via Makefile generated from stm32cubemx and flashing via JLink.

What do you want to achieve?

Trying to port lvgl to use with this nucleo board and my 800x480 display using Riverdi FT812 chip as display driver.

What have you tried so far?

I have tried removing

#include "../lvgl/lvgl.h"
#include "../hal_stm_lvgl/tft/tft.h"
#include "../lvgl/examples/lv_examples.h"

from main.c and also removing

#include "../lvgl/src/hal/lv_hal_tick.h"

from stm32f4xx_it.c
and it compiles ok.

Code folder

https://drive.google.com/file/d/1vpEQSOqaa_k4UjNM4HMffDKADECqNgE7/view?usp=sharing

I already figured it out. At first i tried to compile everything including examples folder which i think make my compiled code very large therefore i adjust my Makefile to compile only files in lvgl/Src folder and iit is able to compile now.

Check if you have -ffunction-sections -fdata-sections in your compiler flags and --gc-sections in your linker flags. If they are not present, the compiler includes even unused code in the final binary, which significantly bloats its size.

The generated makefile from stm32cubemx already has those flags included. However, I try to recompile the whole lvgl/ folder (not just Src folder) again and it compiles ok now. Not really sure what i go wrong in the first place.