From 1d6357340818346756751f1793a91fbb2564e1a5 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Tue, 21 Sep 2021 17:54:35 +0200 Subject: [PATCH] Adding FreeBSD support --- boards/base/FreeBSD-SDL/board.mk | 7 ++++ boards/base/FreeBSD-SDL/example/Makefile | 52 ++++++++++++++++++++++++ boards/base/FreeBSD-SDL/readme.txt | 22 ++++++++++ changelog.txt | 1 + tools/gmake_scripts/compiler_gcc.mk | 4 ++ tools/gmake_scripts/os_freebsd.mk | 16 ++++++++ 6 files changed, 102 insertions(+) create mode 100644 boards/base/FreeBSD-SDL/board.mk create mode 100644 boards/base/FreeBSD-SDL/example/Makefile create mode 100644 boards/base/FreeBSD-SDL/readme.txt create mode 100644 tools/gmake_scripts/os_freebsd.mk diff --git a/boards/base/FreeBSD-SDL/board.mk b/boards/base/FreeBSD-SDL/board.mk new file mode 100644 index 00000000..ae3cc20b --- /dev/null +++ b/boards/base/FreeBSD-SDL/board.mk @@ -0,0 +1,7 @@ +GFXINC += $(GFXLIB)/boards/base/Linux +GFXSRC += +GFXDEFS += -DGFX_USE_OS_LINUX=GFXON +GFXLIBS += rt + +include $(GFXLIB)/drivers/multiple/SDL/driver.mk + diff --git a/boards/base/FreeBSD-SDL/example/Makefile b/boards/base/FreeBSD-SDL/example/Makefile new file mode 100644 index 00000000..551163d5 --- /dev/null +++ b/boards/base/FreeBSD-SDL/example/Makefile @@ -0,0 +1,52 @@ +# Possible Targets: all clean Debug cleanDebug Release cleanRelease + +############################################################################################## +# Settings +# + +# General settings + # See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables + OPT_OS = freebsd + OPT_LINK_OPTIMIZE = yes + # Change this next setting (or add the explicit compiler flags) if you are not compiling for x86 linux + OPT_CPU = x64 + +# uGFX settings + # See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables + GFXLIB = ../uGFX + GFXBOARD = FreeBSD-SDL + GFXDEMO = modules/gdisp/basics + +# Linux settings + # See $(GFXLIB)/tools/gmake_scripts/os_linux.mk for the list of variables + +############################################################################################## +# Set these for your project +# + +ARCH = +XCC = gcc10 +XAS = gcc10 +XLD = gcc10 +SRCFLAGS = -ggdb -O0 +CFLAGS = `sdl2-config --libs --cflags` +CXXFLAGS = +ASFLAGS = +LDFLAGS = + +SRC = +OBJS = +DEFS = +LIBS = +INCPATH = +LIBPATH = + +############################################################################################## +# These should be at the end +# + +include $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk +include $(GFXLIB)/tools/gmake_scripts/os_$(OPT_OS).mk +include $(GFXLIB)/tools/gmake_scripts/compiler_gcc.mk +# *** EOF *** + diff --git a/boards/base/FreeBSD-SDL/readme.txt b/boards/base/FreeBSD-SDL/readme.txt new file mode 100644 index 00000000..b2063ae3 --- /dev/null +++ b/boards/base/FreeBSD-SDL/readme.txt @@ -0,0 +1,22 @@ +This directory contains the interface for FreeBSD using SDL. + +As of today, this is simply a wrapper around the Linux drivers/support. + +On this board uGFX currently supports: + - GDISP via the SDL driver + - GINPUT-touch via the SDL driver + - GINPUT-keyboard via the SDL driver + + +The folowing packages are required to run uGFX using this driver on +a 64-bit FreeBSD system using SDL: + + devel/gcc10 + + devel/sdl2 + + +The following should be added to the CFLAGS of the target makefile: + CFLAGS = `sdl2-config --libs --cflags` + + +There is an example Makefile and project in the examples directory. + diff --git a/changelog.txt b/changelog.txt index bc639582..e65d2974 100644 --- a/changelog.txt +++ b/changelog.txt @@ -24,6 +24,7 @@ FIX: Prevent const qualifier being discarded in vfnprintg(). FIX: Fix missing return value in gfxQueueFSyncPut(). FIX: Fix missing return value in gfxQueueFSyncPush(). FIX: Fix missing return value in gfxQueueFSyncInsert(). +FEATURE: Adding support for FreeBSD. *** Release 2.9 *** diff --git a/tools/gmake_scripts/compiler_gcc.mk b/tools/gmake_scripts/compiler_gcc.mk index 106e94d8..e8890846 100644 --- a/tools/gmake_scripts/compiler_gcc.mk +++ b/tools/gmake_scripts/compiler_gcc.mk @@ -116,6 +116,10 @@ ifeq ($(basename $(OPT_OS)),osx) EXEFILE = $(BUILDDIR)/$(PROJECT) TARGETS = $(EXEFILE) endif +ifeq ($(basename $(OPT_OS)),freebsd) + EXEFILE = $(BUILDDIR)/$(PROJECT) + TARGETS = $(EXEFILE) +endif ifeq ($(EXEFILE),) LDFLAGS += -nostartfiles EXEFILE = $(BUILDDIR)/$(PROJECT).elf diff --git a/tools/gmake_scripts/os_freebsd.mk b/tools/gmake_scripts/os_freebsd.mk new file mode 100644 index 00000000..8a5c4e06 --- /dev/null +++ b/tools/gmake_scripts/os_freebsd.mk @@ -0,0 +1,16 @@ +# +# This file is subject to the terms of the GFX License. If a copy of +# the license was not distributed with this file, you can obtain one at: +# +# http://ugfx.io/license.html +# + +# See readme.txt for the make API + +# Requirements: +# +# NONE +# + +LDFLAGS += -pthread +