Development Tools

From Pandora Wiki
Revision as of 09:17, 4 October 2013 by Rockthesmurf (talk | contribs) (Tools for Pandora Software Development)
Jump to: navigation, search

Official Pandora Source Code Repository

The official source repository is under GIT revision control; EvilDragon is the admin, but the repo has a web based browser built in.===

Minor note on libpnd in the GIT; as skeezix (me) is too lazy to install vmware-tools for date sync, the check-in times are not accurate for libpnd; they're in order of course, but the actual date is usualyl off by many days, so don't sweat it.

The actual GIT repository is here: [1] It is recommended that you read the git structure information before going too far.

Official Firmware images

A Pandora specific repository is work-in-progress. From 1 July 2010, you can grab the latest unstable ready-to-be-flashed ubifs-images from http://openpandora.org/firmware/ or the rootfs which you can extract on your SD Card and boot from there.

Be aware that these images are the most recent cutting edge. They might have some bugs, but should include any new fixes which are yet to be released as Hotfixes. Note they are also 'un-configured' so will take you through the first-boot process. You will obtain a slightly different result if you copy your existing rootfs to an SD card and boot from there.

For stable released images, see other OpenPandora support pages. E.g. official forum software - pandora os news.

Pandora Specific Libraries

libpnd - the Pandora Library

libpnd is a collection of utilities that Pandora developers may find useful, as well as including the daemons and tools for creating and working with PXML.xml based applications (pnd files or unpacked application directories.)

It is hoped the community will continue to expand this library over time!

Some stubs are included as hints .. for instance, the first dev to build a clean /dev/gpio based input library should slip it into libpnd so that others may benefit as well, avoid fragmentation and application bugs.

Continue into the main libpnd documentation hub.

Notaz SDL - improved SDL for Pandora

SDL on this wiki
enhanced SDL thread, on the boards

This library is very very useful for SDL-based ports and new games / apps.

  • hardware scaling support (up and down)
  • doublebuffering support (can eliminate tearing)
  • vsync support (can give smooth scrolling if done right)
  • keymap change with a config file (porting aid)

Tentative Library Environment

Information

Please note, that this information is hearsay/guesswork, and is yet to be confirmed on a production unit.

For Pandora (Out-Of-The-Box)

  • glibc (at a guess, version 2.6.1 or whatever is compatible with OpenEmbedded)
  • libSDL (also a guess, latest available version of 1.2)

For those interested in creating libraries, or needing more low-level access, read about the kernel interface.

Tools for Pandora Software Development

  • OpenEmbedded cross-compile environment (and Angstrom distro) [2]
  • CodeSourcery gcc[3]
    • [4] - NB: OpenEmbedded uses the CodeSourcery 2007q3 to build the kernel, but uses gcc 4.3.1 to compile everything else.
  • TI CodeComposer Studio: Free Evaluation Tools[5]
  • TI c6x Codegen tools for Linux[6]; License [7]; TI account required; this is *only* for Open Source development
  • Das U-boot: The Universal Bootloader[8]
  • Git - Fast Version Control System [9]; Good tuto: [10]

Kernel Source

  • A read-only GIT repository for the kernel source has been made available (November 2008); the note from ED is:

If anybody wants to take a sneak peek at the current kernel, we've got a read-only GIT setup which features the most recent version of the MK2 OpenPandora Kernel.

The git is: [11]

Use the pandora-27-omap1 branch for the moment, there will soon be a 2.6.28.

OpenGL

(See also OpenGLES On the Pandora)

  • OpenGL ES 2.0 emulator for PC[12] This works both on Linux and Windows. One needs to register with imgtec before downloading.
    • To build the applications a few environment variables need to be set (tested on Ubuntu Gutsy). Note that to run them, you do need an OpenGL 2.0 compliant gfx card.
      • LD_LIBRARY_PATH needs to be set to the folder holding the important libraries, such as libEGL.so ($SDK_PATH/Builds/OGLES2/LinuxPC/Lib might be enough)
      • To run the makefiles in the Training section you need to set a PLATFORM variable to either LinuxPC or LinuxGeneric. I have had success with LinuxPC.
      • See [13] for a script that you can run to set these for you.
  • PowerVR Texture creation tool
    • "PVRTexTool enables conversion of standard bitmap files (e.g. BMP, JPG, PNG, TGA, etc.) to any texture type supported by POWERVR MBX or POWERVR SGX hardware including PVRTC, DXT and ETC compressed formats. Both a GUI and command line version are supplied for Windows and Linux. There are also plug-ins for Autodesk 3ds Max, Maya and Adobe Photoshop." - requires imgtec registration.
    • Note, this is part of the main SDK - (Linux path to it is /SDKPackage/Utilities/PVRTexTool/)

Packaging

(See also Making PND files and the PND package format)


Profiling

If you need performance analysis, you can find a compiled version of the "perf" tool there : http://boards.openpandora.org/index.php?/topic/9809-profiling/#entry181954
Just unzip the tool somewhere and launch it with LD_LIBRARY_PATH set.

See https://perf.wiki.kernel.org/index.php/Main_Page to learn how to use it and happy optimizations!

Post Mortem

All the console output from your application is written to a file (on a per PND basis), and typically users with crashes or other problems will post the contents of this file to help diagnose the problem. So, as a developer, it is sensible to make this file as useful as possible for getting to the bottom of problems. A common issue is the good old fashioned 'crash'; although despite the frequency of this problem typically nothing is logged leaving the developer with very few clues as to what has gone wrong (forcing them to take guesses based on previous data that has been logged). A pretty easy way to improve this situation is to catch crashes and write out the call stack to the console (which gets put in the PND log file). The code to do this is along the lines of:

static const bool kUseExceptionHandler = true;

void handler(int sig) 
{
	void *array[ 16 ];
	size_t size;
	
	// get void*'s for all entries on the stack
	size = backtrace(array, PiArraySize( array ) );
	
	// print out all the frames to stderr
	fprintf(stderr, "Error: signal %d:\n", sig);
	backtrace_symbols_fd( array, size, 2 );
	exit( 1 );
}

int main( int argc, char ** argv )
{        
	if ( kUseExceptionHandler )
	{
		signal(SIGSEGV, handler);
		signal(SIGBUS, handler);
	}

	// Etc.
}

This will dump out a list of addresses on the callstack. You as the developer need to make sure you have access to the binary that caused the crash, and make sure that binary has debug symbols (i.e. is not stripped). Providing you have an unstripped binary, you can use the addr2line utility to convert the callstack addresses into filename, line number and function names, just like you'd see in the debugger. For addr2line, you can use syntax along the lines of:

addr2line --exe=/path/to/unstripped/executabe -i -f -C

The console will then waiting for your input, so you can copy and paste any addresses you wish to look up (or copy and paste entire callstacks to have them decoded).

Compressing textures

ImgTec also supplies a tool that allows you to compress your textures to a format the OMAP chip natively supports, such as PVR-TC1, PVR-TC2 (PowerVR tex compression formats) and ETC1 (an Ericsson format)

This toolset comes in a variety of flavors, including a stand-alone GUI, a commandline tool, and plugins for Photoshop, Maya, and 3DS-Max. The tool is already included in the emulator+SDK package, but it is available separately at this page:

  • PowerVR Texture creation tool - "PVRTexTool enables conversion of standard bitmap files (e.g. BMP, JPG, PNG, TGA, etc.) to any texture type supported by POWERVR MBX or POWERVR SGX hardware including PVRTC, DXT and ETC compressed formats. Both a GUI and command line version are supplied for Windows and Linux. There are also plug-ins for Autodesk 3ds Max, Maya and Adobe Photoshop." - requires imgtec registration.