site  contact  subhomenews

Tentative first step framebuffer with LittleVGL

August 19, 2018 — BarryK

As posted earlier today, I have started to evaluate LittlevGL:

the "PC simulator" does look like a good starting point, though it is setup to create a binary named "demo" that is linked against SDL2. That's OK for learning, but I am aiming to talk directly to the Linux framebuffer.

For EasyOS, SDL2 packages are available here (libsdl2-*):

Download the pc-simulator zip file:
Direct link to version 5.1.1:

Expand the zip file, and this is what you see:


Open a terminal, and type "make". That's it, a binary named "demo" will be created. Run it "# ./demo", and you get a GUI:


There is another tutorial web page that explains how to create a simple "Hello World" app using the Linux framebuffere, so onto that...

Hello World with Linux framebuffer

There is an introduction and tutorial here:

I fiddled around for awhile. Like the "PC Simulator" tutorial page, there is a conceptual-gap in the instructions. Here:

2. Compile the code and go back to character terminal mode, how to compile it? For a beginner, this is an awkward step. A Makefile is needed. These are the steps that I followed:

  1. Run "make clean"
  2. In the 'pc-simulator' folder, I moved 'lv-conf.h', 'lv_drv_conf.h', 'lv_ex_conf.h', 'main.c' and 'Makefile' elsewhere.
  3. I then created new 'lv_drv.h', 'lv_conf.h' and 'main.c' as per instructions in the above URL.
  4. I copied-back the 'Makefile' that I had previously moved away, and edited it. Snapshot of the files, 'hide1' is where I moved the original files to:


Here is my edited Makefile:

# Makefile
CC = gcc
CFLAGS = -Wall -Wshadow -Wundef -Wmaybe-uninitialized
CFLAGS += -O3 -g3 -I./
#LDFLAGS += -lSDL2 -lm
BIN = demo

LVGL_DIR = ${shell pwd}

MAINSRC = main.c

include ./lvgl/lv_core/
include ./lvgl/lv_hal/
include ./lvgl/lv_objx/
include ./lvgl/lv_misc/lv_fonts/
include ./lvgl/lv_misc/
include ./lvgl/lv_themes/
include ./lvgl/lv_draw/

include ./lv_drivers/display/
include ./lv_drivers/indev/

OBJEXT ?= .o





all: clean default

%.o: %.c
@$(CC) $(CFLAGS) -c $< -o $@
@echo "CC $<"

default: $(AOBJS) $(COBJS) $(MAINOBJ)

rm -f $(BIN) $(AOBJS) $(COBJS) $(MAINOBJ)

I do realise that more modules than are needed, are being included in the build, but that's OK, as I plan to play with adding more widgets. Notice that SDL2 is not being linked.

Run "make", it creates 'demo'. This will not run on the Xorg desktop, though I vaguely recall a method of doing it in a terminal. Anyway, the way to test 'demo' is to exit from X, via the Shutdown menu in EasyOS (and most pups). Then, on the commandline, as long as a framebuffer has command of the screen, which is likely (there are some caveats), just execute 'demo', where-ever it is.

On the commandline, here is what it looks like:


That's as far as I've got. Next, need to investigate mouse support...

LVGL evaluation Part-3 here: 

Tags: linux