PowerVR: How to get GLES examples to compile (PandaBoard 3D Graphics)

The goal is to compile the examples from the Imaginations Technologies Graphics SDK to run OpenGL ES software on a BeagleBoard/PandaBoard:


BACKGROUND:

The OMAP4430 contains several things. One area of the silicon is the Imaginations Technologies' licenced intellectual property in the Power SGX540. This section of the die supports hardward processing of the OpenGL ES 1.1 and 2.0 standards.

The exact nature of the hardware which processes the graphics is proprietary and deliberately kept closed. To protect the knowledge of how to implement graphics drivers in silicon it is assumed that it is necessary to restrict access to the low level software which interacts with it.

To this end you are unlikely to ever see the source code for the device drivers which operate the SGX540. What you do get is the binary driver. TI distribute this within the Ubuntu package "ubuntu-omap4-extras-graphics".

Therefore there are several sources of information involved to getting OpenGL ES 2.0 code to compile on the PandaBoard or the BeagleBoard etc.


STEP 1
- Download the PowerVR SDK
Now you will need to install the PowerVR SDK from Imagination Technologies:

http://www.imgtec.com/powervr/insider/sdkdownloads/index.asp

You will probably need to register an account on that website before you can download the SDK.

Have a quick read through the PDF "OpenGL ES 2.x SDK.User Guide.1.32.2.2f.External.pdf" or similar.

We will focus on the "TrainingCourse" directory and the"Builds" directory mostly.

STEP 2
- Modify the make_demo.mak Makefile
Then you need to modify the Makefile found at /Builds/OGLES2/LinuxGeneric/make_demo.mak

I modified it to include to the absolute path to the "make_platofrm.mak" file

#---------------------------------------------------------------------

#Replaced by Dingo_aus include $(SDKDIR)/Builds/OGLES2/$(PLATFORM)/make_platform.mak
include /media/restore/pandaboard/powervr_sdk/SDKPackage_OGLES2/Builds/OGLES2/LinuxARMV7/make_platform.mak

#---------------------------------------------------------------------



You can replace this with whatever path you can give make to see the "make_platform.mak" file.



STEP 3
- Modify the tools Makefile
All bar the first two demos in the "Trainingcourse" folder need to compile the tools as well as their code. Therefore we will n

Modify Tools Makefile @ SDKPackage_OGLES2/Tools/OGLES2/Build/LinuxGeneric



.PHONY: clean

SDKDIR  = ../../../..

#include $(SDKDIR)/Builds/OGLES2/$(PLATFORM)/make_platform.mak
include /media/restore/pandaboard/powervr_sdk/SDKPackage_OGLES2/Builds/OGLES2/LinuxARMV7/make_platform.mak


OUTNAME = libogles2tools.a
INCLUDES += -I$(SDKDIR)/Tools -I$(SDKDIR)/Tools/OGLES2 $(addprefix -I, $(PLAT_INC))

VPATH = $(SDKDIR)/Tools : $(SDKDIR)/Tools/OGLES2



STEP 4
- Modify the "make_platform.mak" Makefile


The beginning of my make_platform.mak file looks like:


ifdef TOOLCHAIN
PLAT_CC  = $(TOOLCHAIN)/bin/arm-none-linux-gnueabi-gcc
PLAT_CPP = $(TOOLCHAIN)/bin/arm-none-linux-gnueabi-g++
PLAT_AR  = $(TOOLCHAIN)/bin/arm-none-linux-gnueabi-ar
else
PLAT_CC  = arm-linux-gnueabi-gcc
PLAT_CPP = arm-linux-gnueabi-g++
PLAT_AR  = ar

endif




STEP 5
- Create a script to set the environment variables.

I have created a file called "dingo_build.sh" which contains the following text:


# Script to set variables for OMAP4 build by Dingo_aus
export LIBDIR=/usr/lib
export X11ROOT=/usr/include/X11
make PLATFORM=LinuxOMAP4 X11BUILD=1

I save this file in the same directory as the makefile for a particular training course's code.  I then run it with:


sh ./dingo_build.sh

You should now be able to build the demonstrations. If you have any issues, please feel free to post a comment below.

Comments

Hesham said…
I am thinking, does this process assumes that I am working on the PandaBoard it self, like download and save to the flash on the PandaBoard, or on my Ubuntu Host PC? if on my Ubuntu Host PC then you are assuming I have a Cross Compiler installed?
Dingo_aus said…
It does assume you are working on the PandaBoard natively.
Anonymous said…
Thanks for the complete instructions. I'm curious what kernel you used. I tried MeeGo base's version of 2.6.36-rc4 and also linux-linaro-2.6.38. In both cases I had failures of cpuidle.c to compile with "Arch needs cpu_idle_wait equivalent here." I'm told that cpu_idle_wait has been deprecated and that the drivers must be built with an older kernel, but I haven't tried again, just proceeded with a chroot solution using the Ubuntu 10.10 kernel and TI prebuilt drivers.
Anonymous said…
Oh wait: I see you compiled the demos but not the pvrsrvrkm module. Never mind!
vipul said…
Can u tell... the steps for running the OpenGL example ??
Tommi said…
This comment has been removed by the author.
Tommi said…
I managed to get samples working only with hardfp, so here is what I did (some steps in original guide seem to be obsolete or unnecessary):

* Edit Builds/OGLES2/LinuxGeneric/make_common.mak, add to COMMON_CFLAGS: -mfloat-abi=hard

* In Builds/OGLES2/LinuxARMV7/make_platform.mak should read
PLAT_CC = arm-linux-gnueabihf-gcc
PLAT_CPP = arm-linux-gnueabihf-g++
PLAT_AR = ar
and in both PLAT_CFLAGS -mfloat-abi=hard (NOTE: these flags might not be needed as it is defined in make_common.mak)

* Build script for samples in TrainingCourse/*/OGLES2/Build/LinuxGeneric:
export LIBDIR=/usr/lib
export X11ROOT=/usr/include/X11
make PLATFORM=LinuxARMV7 X11BUILD=1

* Launch samples from ../LinuxARMV7/ReleaseX11
Tommi said…
This comment has been removed by the author.
Tommi said…
Yesterday I could download the SDK from here, today the link is broken:
http://www.imgtec.com/downloadconfirmation.asp?SDK=OMAP4430Linux&Title=OpenGL%20ES2%20Linux%20TI%20OMAP4430%20v2.10

SDK was used on Pandaboard, so I did not need to configure a cross-compiling toolchain.