Showing posts with label Raspberry. Show all posts
Showing posts with label Raspberry. Show all posts

Tuesday, 27 November 2012

Unstable Pi Reports


I have also spent a lot of time today talking to the hardware types who work with me, I'm very much a software guy, beyond wiring a plug or sorting out my ethernet cables I try to stay away from hardware engineering.

I have been known to assemble my own computers, some people call this making, but really you're just taking pre-fabricated items and slotting them together, the kind of hardware guy I'm talking about are the kind who tinker with soldering guns and the like.

And one thing they've overwhelmingly said about their Raspberry Pi's is how unstable they are, how they crash on them and how slow they are...

Where as, I'm a software guy, I've never had my Pi crash, I've never had it be overly slow... I admit its not quick to compile complex C/C++ languages, especially when the latter is using the Boost libraries... but it has been stable.

In actual fact I've only had it crash out once, and that was not its fault, it was the fault of the SD card going dead midway through a compile!

So... What is this difference?... Are the hardware tinkerers, playing with the GPIO port causing themselves issues?  (I think so)... 

As a software tinkerer however I have no complaints...

Friday, 16 November 2012

Guide To Building a Raspberry Pi C/C++ compiler on Ubuntu


These are personal notes on setting up a Cross Compiler for C/C++ on my Ubuntu 12.04 machine, so I can build programs for the Raspberry Pi.

Of course my reason for this is that my PC's are far more powerful than my Pi, even compiling the most trivial program can result in waiting a duration or two on the Pi.  So, I want to employ my heavy PC metal to generate the ARM architecture code for me.

The first steps were to install all the pre-requisites, I'm assuming you have Ubuntu 12.04 32bit LTS installed fresh and clean (either as a real machine, or as a virtual one) and that you know how to use your Linux Machine, here we go.

sudo apt-get update
sudo apt-get upgrade
sudo shutdown -r now

Reboot... Log back in etc....

sudo apt-get install subversion bison flex gperf build-essential texinfo gawk libtool automake

Download ncurses tar ball from "http://ftp.gnu.org/pub/gnu/ncurses" extract it and then within its folder:

./configure
sudo make install

Download crosstool-ng from "http://www.crosstool-ng.org", extract its tar ball and from its folder:

./configure --prefix=/opt/cross
sudo make install

Now we need to add this built item to the path:

PATH=$PATH:/opt/cross

And now we need a space to do the building of the cross compiler:

cd ~
mkdir Pi
cd Pi
/opt/cross/bin/ct-ng menuconfig

Goto "Paths and misc options" and then turn ON "Try features marked as EXPERIMENTAL".

Goto "Target Options" and into "Target Archetecture" and select "ARM".
Go into "Target Options" and set Endieness to "little".
Go into "Bitness" and set it to "32bit".

Goto "Operation System"
Go into "Target OS" and select "Linux".

Goto "Binary Utilities" and then select "Binary Utilities" latest version (2.22 as of writing).

Goto "C Compiler" and enable "Show Lincro Version" these are the 4.7+ versions supporting C++11, and enable C++.

Exit and save.

And now we kick off the building of the tool chain:

/opt/cross/bin/ct-ng build

The output for me ended up in "~/x-tools/" as per the paths selected in the paths & misc options.