Sunday, 6 October 2013

Raspberry Pi Setup

A couple of weekends ago I installed Raspbian in preparation for work on computer control aspect of the project.  Raspbian is an optimized port of Debian Wheezy for the Raspberry Pi.   I've also setup a complete development environment to write applications in native C, C++ and embedded JAVA.

This update explains how this was done...


Installing Raspbian was surprisingly straight forward.  The same sd-card imaging technique used to install RISC OS was followed here.

I think the Software Configuration Tool started automatically on first boot, although it can be run anytime by typing:  sudo raspi-config



Expanding the Filesystem ensures all available space on the SD card is used by the root partition.  I would recommend this is done; a reboot is required.  Also, don't forget to configure your keyboard, timezone, and networking settings.  After which, the system will be ready for use....


This picture shows the standard X desktop running.  I configured mine to always boot to Desktop.

I would highly recommended before doing anything else at this point - update your operating system:
  • Double click LXTerminal to get a command prompt
  • sudo apt-get update
  • sudo apt-get install

After updating the operating system, I installed a SAMBA server allowing files to be shared between Windows.   Other tools you might consider installing on your Windows clients are Putty, and WinSCP.

Useful Links
http://www.raspberrypi.org/
http://www.debian.org/
http://forums.debian.net/
http://www.linux.org/


Development Tools

The GCC C compiler is already included and installed with Raspbian.

Installed the following third party libraries which will be potentially useful (following the installation instructions on each site):

Both of these libraries are GPIO access libraries written in C for the BCM2835 used in the Raspberry Pi.   WiringPi includes a handy command-line utility gpio which can be used to program and setup the IO pins - very useful for testing!

I'm still looking for a decent text editor (please don't suggest vi), but in the meantime I'll probably write my code on Windows, then copy and compile on the device.


JAVA

You might actually be wondering why...  why Java ?   After we have written some basic Armdroid test programs in C/C++, the first major project of this site will be constructing a web-based control solution.  We'll be implementing this software in Java, to be hosted in a Java based Application Server.

I happened to find this blog article https://blogs.oracle.com/hinkmond/entry/quickie_guide_getting_hard_float which explains how to setup an Early Access Oracle JDK 8 on the Raspberry Pi.

In case your wondering what all this Hard Float and Soft Float is all about....  Earlier this year, Raspbian was available in two flavors - with hardware or soft-floating point number support.  At the time, the available JVMs only supported the software floating point, so if you intended to use Java, you needed to install that variant of the operating system.   The article above posted last December introduced the Early Access Release of the Oracle JDK running on hard float editions.   A couple of months ago, it would seem the Raspberry Pi Foundation dropped all support for the soft-float images, and now, you can only download and install the hard float images...

I downloaded the JDK 8, then compiled & ran HelloWorld.java to prove everything is working correctly.

Finally, I installed the Pi4J library which simplifies controlling the GPIO port from a java application.
I ran the included sample programs to check everything was working using my Logic Probe to prove the pins are changing state high to low, etc.



- update -

Since setting up my Raspberry Pi, the foundation posted this article last week  http://www.raspberrypi.org/archives/4920 announcing future releases of Raspbian will include Oracle Java; existing users can install it by typing:
sudo apt-get update && sudo apt-get install oracle-java7-jdk

No comments:

Post a Comment