09 April 2012

The real important feature of C++

I've been having to write a lot of C code recently, and it makes me pine for some features of C++ because of the verbosity of some portions of code. It made me consider what really changes the way you code in C++ on comparison to C.

 

There are features like inheritance, but that really just manages the function overriding that is implicit. There is templates whilst discounting template meta programming is just a glorified way of avoiding code duplication. There is obviously the more aggressive type checking which is handy but doesn't really change that much about your coding style.

 

So what is this feature? Destructors. Immediately by adding that feature you change the way you can code and also by avoiding some C verbosity you avoid memory leaks. This opens up the whole realm of RAII and the code scoping rules start to take on a different life because you can execute code when objects begin to fall out of scope and are freed. This code then kind of discourages gotos (I really hate those) because you are relying more on the stack unwinding than remembering to malloc/free.

 

I reckon if I had destructors for the C code I have written in the context of structs then I could have had a lot less code.

 

03 April 2012

Allwinner A10 - open-source ARM

Developing on ARM is a minefield.  Each platform is different (even if they look the same) and you are lucky if any of the software is not covered by NDA or some prohibitive SDK cost for experimentation.

People have obviously heard of the Raspberry Pi but mid-to-lat 2011 there was anotehr project starting with a company called Rhombus-Tech where they wanted to create a proper CPU card and also have all the software GPL compliant.  This is exciting because you can then get the hardware and with the software available create what you want to.  They went around trying to find the hardware that could potentially have GPL compliant software.  The project has become a CPU card that uses the legacy PCMCIA form factor but re-tasks it entirely for a pluggable processor.  The spec is called the EOMA-68.

Enter the Allwinner A10, a seriously cheap piece of kit ($7 per chip in volume) which is a Cortex A8 with MALI 400 graphics, DDR3 memory and has a BSP capable of decoding 2160p video.  The company behind it Allwinner want to be GPL compliant and have been providing source code for the kernel and the other bits.  The A10 has started to appear in tablets and set-top boxes and the fully integrated platforms are very cheap.  I picked a capacitive touch 7 inch tablet off eBay for £86 including next day postage.  The Mele A1000 set top box is the platform of choice that people have started to pre-emptively use whilst waiting for the Rhombus Tech project to take off and it costs about £80.

The Rhombus Tech spec for the Allwinner A10 is here and you can sign up for preorders for the alpha/beta/release boards here.

So the real exciting bit about this is potentially all the software is out there to construct a decent Linux distribution to build toys and products on.

The main kernel development and tidying up is occurring here and is even being rebased on the 3.3 kenel as well as the Android one.  The u-boot repository for getting it booting is here.  There is a partial code dump for the hardware video decoding here although it looks like it is some of the user space code.  There are some repositories of core Android libraries here and there are some board files for the Allwinner here.  It looks like in the board files there is the OpenGL ES 2.0 and EGL shared objects here.

There are also a couple of good articles about building a custom Android for Allwinner A10 based appliances - part 1 and part 2.  There are also lots of resources for board hacking at the Rhombus Tech website and also some on the Embedded Linux wiki.

So if you fancy some cheap ARM development its worth signing up on the orders page.

Now I need to get hacking on that tablet....