OpenPandora: Development toolchains, SDK’s and build platforms (Part 1).

This is the 1st of 2 posts that I hope will form simple guides to help you through the process of getting a working development environment and basic SDK setup for the OpenPandora allowing you to build applications, compile up code, all of that neat stuff really.

Note: These guides and toolchain/SDK packages do not constitute any ‘official’ OpenPandora SDK or anything of the sort, they are just what I have put together during the development process in the hope somebody may find it useful.

Some of the information in these articles has already been covered, I just got tired of covering the same ground helping people so I figured I could refer them here so everyone benefits.

With the OpenPandora you have 2 primary options for code development…

  • Native (on device) software development

Want to write code for the OpenPandora on the OpenPandora, have a little read of this. Not the way I would recommend doing normal development but handy sometimes.

The is covered by this part of the article.

The most common method of code development for a device such as the OpenPandora. Requires access to a regular PC to using for building code.

The is covered in part 2 of this article.

I’ll aim to outline how you can start to develop code using either setup, and provide a really simple test app to prove your setup is working.

This is mainly aimed at C, C++ and Assembler developers who are familiar with GCC, build tools and Linux in general.


Native (on device) software development:

It is possible to easily get a development environment running on your OpenPandora, if this sort of thing floats your boat.

Developing code natively on the OpenPandora comes with a few caveats, don’t expect to be able to build huge suite applications like XOrg, you will run out of RAM and storage long before your compile is complete and even if you setup lots of swap and such on the SD you may well go grey haired waiting for the compile to actually finish :).

That said, if your not trying to build 500,000 lines of code in one go you may well find native development quite viable for your needs. And it’s imposable to deny there is a certain ‘geek cool’ to writing some code, building it and running it on the go ;).

Setting up the environment:

The first thing you will want to do is check you have enough free space on the NAND to install all the development tools.

Assuming you have not installed lots of extra packages to the NAND you should be fine but it is prudent to check 1st.

Run the command below in a terminal.

df -h

Looking at the results, they should look something like this

Filesystem                Size      Used Available Use% Mounted on
ubi0:rootfs             455.1M    325.7M    129.3M  72% /


The important figure here is Available, my OpenPandora has 129M available on the NAND (it may well be more with compression, that is a worst case estimate). You can expect the install of the development tools on the NAND to eat something in the region of 35-40M.

Assuming you have enough free space, the next step is to install some packages from the Ångström repositories. You will need a network connection to do this.

First off, make sure your list of packages is up to date.

sudo opkg update

Once that is done you want to install some tools.

sudo opkg install gcc gcc-symlinks make binutils-dev cpp cpp-symlinks g++ g++-symlinks libstdc++-dev

This will install the development essentials onto the NAND of your unit, you will actually install more then just the packages listed above as dependencies will be dragged in (it’s safe it ignore any warnings about “unsatisfied recommendation for” concerning various locale packages).

At this stage it would be prudent to check the amount of space left on the NAND again.

Filesystem                Size      Used Available Use% Mounted on
ubi0:rootfs             455.1M    357.5M     97.6M  79% /


Ok, so about 32.5M taken installing the core development tools, scary but not all that bad.

Assuming that all goes well you will now want to add some development libraries to your NAND so you can actually build stuff.

sudo opkg install libsdl-1.2-dev libsdl-image-1.2-dev libsdl-gfx-dev libsdl-net-1.2-dev libsdl-ttf-2.0-dev libgles-omap3-dev

That command will install a minimal set of development bits, SDL and the headers/libraries for the OpenGLes hardware. It will also pull in dependencies.

After all this is setup lets check the NAND space once again.

Filesystem                Size      Used Available Use% Mounted on
ubi0:rootfs             455.1M    361.2M     93.9M  79% /

That’s not all that bad, about 3.5M used by the headers and such (remember, the shared libs are already installed).
 
Just keep an eye on free space if your installing packages with OPKG to the NAND a lot.
 

If you need more libraries or support tools I am sure you can install them from the Ångström repositories or compile them yourself.

Once you have this all installed your ready to go…

Testing the toolchain:

Ok, this is just a REALLY simple test app that uses SDL to display a bitmap image. Nothing special but it will show your toolchain and basic SDL are working. It’s not fit for any purpose what so ever and I don’t suggest you actually build code this way either (use a makefile ;)).

I can’t claim to be the author of this sample code, it’s been sat on my HDD for years and I can’t remember who wrote it :o.

Extract this somewhere on your OpenPandora (SD, home folder, where ever suits you).

Compile it by opening a terminal window, changing into the directory you extracted the test app to and issuing the following command.

gcc -Wall DisplayImage.c -o DisplayImage –l SDL

Next up you can test the app. It will show an image for 10 seconds then exit.

./DisplayImage

Note: If you connecting to the OpenPandora remotely (i.e. over SSH) to run the app you will need to run sudo ./DisplayImage or SDL won’t be able to claim the screen.

With a little luck your now all set for native development.

Part 2 will cover installing and setting up a cross compiling environment so you can build code on your PC to target the OpenPandora.

Regards,

John

Comments are closed.