Linux
µGFX runs natively on any Linux system. The SDL driver can be used to compile a native Linux desktop application. This is especially useful during the development process as the entire µGFX application can be developed and tested without flashing the target microcontroller every time. The Framebuffer driver is useful to use µGFX on embedded Linux systems that don't run X or a full Desktop environment.
Contents
SDL
Using the SDL driver is the recommended way of running µGFX inside a Linux system with a desktop environment. The SDL driver also supports mouse and keyboard input.
Dependencies
SDL2 is required to use the µGFX SDL driver. As we are compiling an SDL application ourselves, the development version of the SDL2 library used. On most common Linux distributions these can be installed by the libsdl2-dev
package. However, note that µGFX applications get compiled as 32-bit applications. Therefore, you have to install the 32-bit variation of that package if you are running a 64-Bit Linux.
For example, the following packages need to be installed to compile µGFX on Ubuntu 16 64-Bit:
apt install libsdl2-dev:i386 build-essential gcc-multilib
Makefile
A ready-to-use Makefile to compile a native µGFX Linux application can be found under /boards/base/Linux-SDL/example/.
It is important to note that the following line has to be added to the CFLAGS
in order for SDL to link properly:
CFLAGS = `sdl2-config --libs --cflags`
Initialization
ToDo
Framebuffer
The framebuffer driver can be used to run µGFX on embedded Linux systems that don't run X or a desktop environment.
include $(GFXLIB)/boards/base/Linux-Framebuffer/board.mk
Dependencies
There are no dependencies to use the Linux framebuffer driver. However, the Linux kernel must have been compiled with framebuffer support enabled.
Makefile
A ready-to-use Makefile to compile a native µGFX Linux application can be found under /boards/base/Linux-Framebuffer/example/.
Framebuffer device
By default, the framebuffer driver looks for the framebuffer device under /dev/fb0
and /dev/fb/0
. If your system links the framebuffer under a different path, please modify the FBDEV_PATH1
macro in the /boards/base/Linux-Framebuffer/board_framebuffer.h
file.
The pixel format can be set using GDISP_LLD_PIXELFORMAT
. By default GDISP_PIXELFORMAT_RGB888
is used. Note that the Linux framebuffer only supports RGB mode (no BGR modes).
X
Using the X driver is not recommended. It's deprecated and an old relic that is kept in the µGFX library as a reference for examples and for systems that are incapable of running SDL. It is STRONGLY recommended to use the SDL driver instead (see above).
The performance of the resulting program is very bad because the X driver just uses setPixel()
and doesn't take any advantage of area blitting or double buffering.
Dependencies
The X11 development libraries are required to run the µGFX X driver.
For example, the following packages need to be installed to compile µGFX on Ubuntu 16 64-Bit:
apt install libx11-dev:i386 xorg-dev build-essential gcc-multilib
Makefile
A ready-to-use Makefile to compile a native µGFX Linux application can be found under /boards/base/Linux-X/example/.