Trying to port lvgl to samd21 in atmel studio. Getting ram overflow issue. Looking for ways to use less memory

Description

I am new to lvgl. I was using MPLAB X IDE w/ Harmony, but it was so buggy I gave up. I am finding lvgl pretty complex but also interesting enough to keep at it.

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

SAMD21 Xplained Pro (ATSAMD21J18A) w/ New Haven 3.5" TFT Eval Board (SSD1963)

What do you want to achieve?

I am trying to port lvgl for use with a samd21 and an ssd1963 to run the display. I am using 8-bit parallel gpio to run the display.

What have you tried so far?

I am using Atmel Studio (ASF3) as my software framework. It doesn’t really use a HAL, rather a hard coded set of drivers for the d21. I

I am deviating from the template here because my issue isn’t really solely code based (I don’t think?) but probably a configuration issue.

So for some context, here is my project tree:

.
├── ASF
│   ├── common
│   │   ├── boards
│   │   └── utils
│   │       └── interrupt
│   ├── sam0
│   │   ├── boards
│   │   │   └── samd21_xplained_pro
│   │   ├── drivers
│   │   │   ├── extint
│   │   │   │   └── extint_sam_d_r_h
│   │   │   ├── port
│   │   │   │   └── quick_start
│   │   │   ├── sercom
│   │   │   │   └── usart
│   │   │   │       ├── quick_start
│   │   │   │       ├── quick_start_callback
│   │   │   │       ├── quick_start_dma
│   │   │   │       └── quick_start_lin
│   │   │   └── system
│   │   │       ├── clock
│   │   │       │   └── clock_samd21_r21_da_ha1
│   │   │       ├── interrupt
│   │   │       │   └── system_interrupt_samd21
│   │   │       ├── pinmux
│   │   │       │   └── quick_start
│   │   │       ├── power
│   │   │       │   └── power_sam_d_r_h
│   │   │       └── reset
│   │   │           └── reset_sam_d_r_h
│   │   └── utils
│   │       ├── cmsis
│   │       │   └── samd21
│   │       │       ├── include
│   │       │       │   ├── component
│   │       │       │   ├── instance
│   │       │       │   └── pio
│   │       │       └── source
│   │       │           └── gcc
│   │       ├── header_files
│   │       ├── linker_scripts
│   │       │   └── samd21
│   │       │       └── gcc
│   │       ├── make
│   │       ├── preprocessor
│   │       └── syscalls
│   │           └── gcc
│   └── thirdparty
│       ├── CMSIS
│       │   ├── Include
│       │   └── Lib
│       │       └── GCC
│       └── lvgl
│           ├── docs
│           ├── porting
│           ├── scripts
│           │   └── built_in_font
│           └── src
│               ├── lv_core
│               ├── lv_draw
│               ├── lv_font
│               ├── lv_hal
│               ├── lv_misc
│               ├── lv_objx
│               └── lv_themes
├── config
├── drivers
└── main.c

I know this is kinda a lot so Ill narrow it down to important stuff:

├── ASF
│   └── thirdparty
│       ├── CMSIS
│       ├── lvgl
│	└── lv_conf.h
│           ├── docs
│           ├── porting
│           ├── scripts
│           │   └── built_in_font
│           └── src
│               ├── lv_core
│               ├── lv_draw
│               ├── lv_font
│               ├── lv_hal
│               ├── lv_misc
│               ├── lv_objx
│               └── lv_themes
├── config
├── drivers
└── main.c

I am noticing that the example project for platformio does not actually contain the lvgl folder or lv_conf.h file, which is extremely confusing to me. The tree is simply

├── drivers
│   ├── sdl2
│   └── stm32f429_disco
│       ├── tft
│       └── touchpad
├── lib
├── src
└── test

Am I not supposed to just drop the entire folder into my project? If I’m not supposed to do this, how am I supposed to integrate it?

And this may not even be the problem. If it isn’t how do I lower memory consumption?

lv_conf.h is in the src directory for that project, and lvgl gets downloaded automatically when the project is first built. Put simply, all files you mentioned are available when compilation actually begins.

What is the exact RAM overflow issue you are seeing? Does it just not work? Is there a compilation/linker error?

Thanks for the response. It took me a bit to figure out why it wasn’t working, but it seems that I had to lower allocated heap space to 8KiB, which seems oddly low for a MCU with 32KiB of SRAM. Since, I’m working in Atmel Studio, not PIO(vscode), I don’t have the luxury of only downloading needed parts of the lvgl stack. I guess eventually I can just manually remove parts I don’t need.

Hi,

Don’t know if you still use LVGL on the SAM D21 but thought I would ask.

How much flash and RAM space do you wind up using for the GUI. I have relatively small GUI with about 20 different screens each with no more than 15 basic elements. Do you think this is feasible?

About 64KB is taken up by a bootloader. So really I only have about 3/4 of the 256KB available. Your thoughts would be really valuable.