Browse Source

finished and tested NetBSD support for i386 and amd64

feature/2015
Christian Kroll 11 years ago
parent
commit
20adfc367f
  1. 42
      README.md
  2. 19
      defaults.mk
  3. 2
      ld_scripts/elf_i386_nbsd.x

42
README.md

@ -41,15 +41,15 @@ Games
Build Build
===== =====
Supported build platforms are Linux, FreeBSD and Windows (via Cygwin). Due to Supported build platforms are Linux, FreeBSD, NetBSD and Windows (via Cygwin).
customized linker scripts, simulator support is currently limited to x86 and Due to customized linker scripts, simulator support is currently limited to x86
x86_64 archs. Following dependencies have to be met: and x86_64 archs. Following dependencies have to be met:
Linux / FreeBSD Linux / FreeBSD / NetBSD
--------------- ------------------------
Package names are based on Debian/Ubuntu repositories. Please adapt the names Package names are based on Debian/Ubuntu repositories. Please adapt the names
according to your Linux distribution (or FreeBSD for that matter). according to your Linux distribution (or BSD for that matter).
* build-essential (pulls in an ordinary gcc build tool chain for the host) * build-essential (pulls in an ordinary gcc build tool chain for the host)
* bc * bc
@ -60,6 +60,7 @@ according to your Linux distribution (or FreeBSD for that matter).
* binutils-avr * binutils-avr
* avrdude * avrdude
* freeglut3-dev * freeglut3-dev
* bash (note to the BSD folks: bash is required for the config tool)
Windows Windows
------- -------
@ -90,12 +91,21 @@ Configure
Open a (Cygwin) terminal, change to your checkout directory and type: Open a (Cygwin) terminal, change to your checkout directory and type:
> make menuconfig > make menuconfig
This starts a curses based text interface for configuring certain aspects of In case you build on BSD, just use 'gmake' instead of 'make'. This starts an
your target platform. Be careful if you use an IDE like Eclipse to manage the Ncurses based text interface for configuring certain aspects of your target
build, as integrated terminal emulators tend to choke on curses generated shell platform. After a fresh checkout, the first thing you do is to load a profile
output. Make sure that 'make menuconfig' has been run at least once in an with sane defaults. In the menuconfig interface, select 'Load a Default
ordinary terminal emulator after a fresh checkout or after issuing 'make Configuration' and choose a preset. After hitting enter, the main menu returns
mrproper'. immediately. You can either tune your configuration or just exit (choose 'Yes'
at the confirmation dialog to save your stuff).
Be careful if you use an IDE like Eclipse to manage the build, as
integrated terminal emulators tend to choke on Ncurses generated output.
Make sure that 'make menuconfig' has been run at least once in an ordinary
terminal emulator after a fresh checkout or after issuing 'make mrproper'.
Note: Always use 'make clean' after changing something in the menu, because
subsequent builds may be broken if you don't.
Compile Compile
------- -------
@ -103,11 +113,13 @@ Compile
To build for the actual target platform, just type: To build for the actual target platform, just type:
> make > make
This yields an 'image.hex' file which you can flash to your AVR device.
If you want to test and debug your code within a GUI application, you can use If you want to test and debug your code within a GUI application, you can use
the simulator: the simulator:
> make simulator > make simulator
In case you build on FreeBSD, just use 'gmake' instead of 'make'. Again, use 'gmake' instead of 'make' on BSD.
You can start the simulator by typing ./borgsim(.exe) You can start the simulator by typing ./borgsim(.exe)
@ -116,8 +128,8 @@ Simulator Handling
Please keep in mind that the simulator is NOT an emulator. All it does is Please keep in mind that the simulator is NOT an emulator. All it does is
compile the source code to a native host application so you can step through compile the source code to a native host application so you can step through
your C-Code. The GUI thread reads the simulated frame buffer every 40ms and your C-Code with an ordinary host debugger. The GUI thread reads the simulated
draws its contents. frame buffer every 20ms (40ms on Windows) and draws its contents.
Joystick directions are simulated by the WASD keys and SPACE acts as the fire Joystick directions are simulated by the WASD keys and SPACE acts as the fire
button. The OpenGL based simulator (Linux/FreeBSD) enables you to adjust the button. The OpenGL based simulator (Linux/FreeBSD) enables you to adjust the

19
defaults.mk

@ -43,7 +43,7 @@ ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN)
ifeq ($(MACHINE),i686) ifeq ($(MACHINE),i686)
LDFLAGS_SIM = -T ld_scripts/i386pe.x LDFLAGS_SIM = -T ld_scripts/i386pe.x
else else
$(error $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n)) $(warning $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n))
endif endif
endif endif
LIBS_SIM = -lgdi32 -lwinmm -lm LIBS_SIM = -lgdi32 -lwinmm -lm
@ -57,7 +57,7 @@ else
ifeq ($(MACHINE),i386) ifeq ($(MACHINE),i386)
LDFLAGS_SIM = -L/usr/local/lib -T ld_scripts/elf_i386_fbsd.x LDFLAGS_SIM = -L/usr/local/lib -T ld_scripts/elf_i386_fbsd.x
else else
$(error $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n)) $(warning $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n))
endif endif
endif endif
LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm
@ -71,7 +71,7 @@ else
ifeq ($(MACHINE),i386) ifeq ($(MACHINE),i386)
LDFLAGS_SIM = -L/usr/pkg/lib -L/usr/X11R7/lib -T ld_scripts/elf_i386_nbsd.x -Wl,-R/usr/pkg/lib,-R/usr/X11R7/lib LDFLAGS_SIM = -L/usr/pkg/lib -L/usr/X11R7/lib -T ld_scripts/elf_i386_nbsd.x -Wl,-R/usr/pkg/lib,-R/usr/X11R7/lib
else else
$(error $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n)) $(warning $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n))
endif endif
endif endif
LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm
@ -84,22 +84,21 @@ else
ifeq ($(MACHINE),i686) ifeq ($(MACHINE),i686)
LDFLAGS_SIM = -T ld_scripts/elf_i386.x LDFLAGS_SIM = -T ld_scripts/elf_i386.x
else else
$(error $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n)) $(warning $(n)$(n)Simulator build is only supported on i386 and amd64.$(n)$(n))
endif endif
endif endif
LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm
else else
($(error $(n)$(n)Simulator build is not supported on your system.$(n)$(n)\ ($(warning $(n)$(n)Simulator build is not supported on your system.$(n)$(n)\
Currently supported platforms:$(n) \ Currently supported platforms:$(n) \
Linux on x86 and amd64$(n) \ Linux on i386 and amd64$(n) \
FreeBSD on x86 and amd64$(n) \ FreeBSD on i386 and amd64$(n) \
NetBSD on x86 and amd64$(n) \ NetBSD on i386 and amd64$(n) \
Windows (via Cygwin) on x86 and amd64) Windows (via Cygwin) on i386 and amd64)
endif endif
endif endif
endif endif
endif endif
############################################################################## ##############################################################################
# the default target # the default target
$(TARGET): $(TARGET):

2
ld_scripts/elf_i386_nbsd.x

@ -3,7 +3,7 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386",
"elf32-i386") "elf32-i386")
OUTPUT_ARCH(i386) OUTPUT_ARCH(i386)
ENTRY(_start) ENTRY(_start)
SEARCH_DIR("=/usr/lib/i386"); SEARCH_DIR("=/usr/lib");
SECTIONS SECTIONS
{ {
/* Read-only sections, merged into text segment: */ /* Read-only sections, merged into text segment: */

Loading…
Cancel
Save