Linux

From uGFX Wiki
Revision as of 15:03, 1 July 2014 by Tectu (Talk | contribs) (Created page with "µGFX runs natively on any Linux system that runs the X server. Running µGFX on your computer can be used to simplify the process of developing your embedded GUI because you...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

µGFX runs natively on any Linux system that runs the X server. Running µGFX on your computer can be used to simplify the process of developing your embedded GUI because you don't have to flash the firmware every time to try it. Also, this way µGFX can be used as the native GUI system on low power Linux devices such as the Raspberry-Pi and other single board computers.

Note: The performance of the resulting program is very bad. This is because the X driver just uses setPixel() and doesn't take any advantage of area blitting or double buffering. The application will run A LOT faster on the actual microcontroller.

Makefile

The following Makefile can be used to compile an µGFX application on a Linux system. Modify the highlighted line(s).

  1. # The name of the project / binary
  2. PROJECT = ugfx
  3.  
  4. # List C source files here
  5. SRC     = $(GFXSRC) \
  6.           main.c
  7.  
  8. # List all user directories here
  9. UINCDIR = $(GFXINC) \
  10.  
  11. # List all libraries
  12. LIBS    = -lX11 -pthread
  13.  
  14. # Include uGFX
  15. GFXLIB  = /home/tectu/projects/resources/ugfx
  16. include $(GFXLIB)/gfx.mk
  17. include $(GFXLIB)/boards/base/Linux/board.mk
  18.  
  19.  
  20. ###############################################################################
  21. # Do not change anything below this line unless you know what you're doing    #
  22. ###############################################################################
  23.  
  24. # Your toolchain
  25. CC      = gcc
  26. INCDIR  = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR))
  27. LIBDIR  = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
  28. OBJS    = $(SRC:.c=.o)
  29. CCFLAGS = -O2 -Wall -DGFX_USE_OS_LINUX=TRUE
  30. LDFLAGS = 
  31.  
  32.  
  33. ###############################################################################
  34. # Actual Makefile rules                                                       #
  35. ###############################################################################
  36.  
  37. all: $(OBJS) $(PROJECT)
  38.  
  39. %.o : %.c
  40. 	$(CC) -c $(CCFLAGS) -I . $(INCDIR) $< -o $@
  41.  
  42. $(PROJECT): $(OBJS)
  43. 	$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
  44.  
  45. clean:                                      
  46. 	-rm -f $(OBJS)
  47. 	-rm -f $(PROJECT)