GNU Embedded Toolchain for ARM on Rasbian Jessie Lite

Shoot me. Shoot me now.

And if you don’t, don’t blame me.

~~~

I dislike GUIs for holding my coding environment, because they present me with new and therefore terrifying technology. So, I elected to put the mbed cli onto Raspbian Lite. This is already devoid of a GUI, and nothing could go wrong.

Gentle Reader, it went wrong. Mostly because the instructions for compiling from source were in a pdf which I couldn’t read without downloading it elsewhere, and by the time I had done that the schnapps I was taking medicinally had betrayed me.

Once I’d opened that, the instructions started with ‘install Ubuntu’ so I swore a bit and didn’t install Ubuntu. But I did apt-get install software-properties-common and that nearly worked. I didn’t have 7z on Rasbian Lite, and when I managed to get p7zip, I had to amend ./install-sources.h by hand, to take out mentions of 7z and add p7zip -d which got me to the point where I had everything installed and could start the build. At which point, more stuff broke.

‘This does not look like a tar archive’ is a bad message to get when you believe you are messing with tar archives. So, it was into build-common.sh to have a look-see.

I had a curious error that tar -cf – . which should – I thought – have compressed stuff, wasn’t. As far as I could read from the error message it was decompressing instead. Obviously I was not drunk enough. But there was a failure to find zlib, and that was the only thing that was compressed as a .tar.gz instead of a .tar.bz2. So I could do that by hand, right?

cd src
tar -xf zlibwhatever
cd -

Now we’re cooking with Calor.

Until there’s no usable m4 in $PATH. And I have no idea what m4 is.

So I install that:

apt-get install m4
sudo !!

!! is the most useful shortcut I have ever found. It’s the entire last line you typed. sudo !! is the thing I probably type most.

Then I attempt another build. I’m on a roll here!

./build-rerequisites.sh

And I wait. Clouds of text pass upward. My pi light blinks. I drink more. More scroll happens. I have no desk. I have no keyboard. The world is an illusion. I experience sudden horror as the scrolling stops but it is only a momentary pause for a large file. I recognise fragments of names. The word ‘pedantic’ catches my eye and I laugh. The ‘caution something or other about make check’ board scrolls past. I drink again. Makefiles are made. I hug the bottle. The scrolling is giving me a headache. Or else I am hung over. The lighting waxes and wanes as text pauses and passes on. I am at one with the Schnapps. The Schnapps is at one with me, but is also precariously balanced on the tin of shoe polish I am using as a coaster. Now we are checking the locale and it isn’t saying Drowned Ys or Property of Randolph J Carter, so I think we’re OK. ‘Making all in .’ is a travesty of grammar, but a wonderful statement from the command line. More drink. Sacrifice a goat to the old ones. Eat raw goat liver. I finish a conversation online and start another. The dragons drift by. I click things with a useless mouse. There is more scroll. The C compiler works. We check together, the computer and I, whether we are cross-compiling. … And then .configure aborts.

‘Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).’

Well, there’s lovely.

I don’t know how to remove that, because I don’t know why or where it was set in the first place. Somewhere in the haze of alcohol I remember that I must already have the GCC working to make all this stuff, and I sigh and look up the error message because that’s the sensible thing, and sleeping could stop me from thinking.

A stack exchange discussion of this problem has something that cheers me up. “The compiler is too harsh simply because there is no compiler…” At least my problem is not that.

In looking up what might be going wrong I have scrolled away from the error messages and I don’t want to look for logs so I run this again. There is a pleasing object with the word polyhedron in the file name. And now we have found warnings. Makefile.in seems to ignore the datarootdir setting. Is that bad? And then a bit of scroll later we bork.

I read back up a bit. pushd allows one to play with the directory stack. So in one of those directories, perhaps, there is a ./configure.

ls build-mingw/zlib has a configure file. There is a configure log. The configure file tells me that
try
:
else .

So now I try to remember what try means. I scroll up to find what options $CC has. The irony of me doing the scrolling makes me smile. I have the horrible feeling that this is using CC not GCC and I have no idea what that means. The bottle is calling me again. I comment out the line that is forcing me to leave, because errors are fine because it is midnight and I am drunk. I do not expect this to go well, but I am interested in what will work. Probably that file will not be regenerated and this is all safe. Perhaps I should have checked at least the start and end of the configure log before I began. The cloud scrolls past again. I can smell hamsters. long long ints exist. doubles exist. I play with the refresh rate of the scroll by blinking. I converse online about novelty fish. I open up a different terminal to rest my eyes. I scroll back in time to find out that CC=gcc. I reach the point where we make all in . The tension is acutely bearable. I have no expectations. Hope is a deceiver. I lie to myself about not hoping. The conversation about novelty fish turns to gravel and rakes. I consider Phlebas, who was tall, and is now dead. I consider how I could have learned to get along with a GUI, but no, I had to do it my way. I look lovingly at the screen, now showing me built objects that will die when ./configure fails. I love these things. They do not know that hopes are liars. Maybe once I was like them.

Everything dies. I look up the ./configure, and sure enough it’s a generated file so I cannot change it. I’ve learned a thing. I look in the configure log and I’m apparently building some cross-compiling something-or-other for the windows toolchain so I re-start without that. I can live without windows. The pain of the GUI is enough that I am doing this to avoid windows.

./build-prerequisites.sh --skip_steps=mingw32

The temperature warning for the Pi comes on. I blow over the CPU, with the tenderness of Achilles teasing Patrokleos. The air is warm. I have enclosed the main board in too many breakout boards.

The objects are created again. They never complain about this. The temperature warning has not returned. .io files click in orderly procession down the screen. More scroll. Is this further than I have gone before?… exit 0. No errors. The little coloured directory indicator is a checkpoint flag. They are playing my tune.

Ladies and Gentlemen, we are halfway!

./build-toolchain --skip_steps=mingw32 holds no fears for me now. I believe!

I take a moment to marvel at the complexity of the compiler building a compiler. So many people worked on this. Hardly any of them need to be destroyed. I blow on the CPU again. I wonder if I have built this in the wrong place. Awww. Error 2. recipe for target failed up above somewhere. I can hear the Glory. I should probably sleep. The Pi can cool down overnight.

Dear reader, I came back to it in the morning, and tried again with TeX installed. Why TeX, I do not know. It seems to have been making make all fail, even though it was almost certainly optional in the minds of the writers. I added flex to give me gengtype-lex.c, and ran into what was probably a memory issue. So, I increased the swap file from 100MB to 400MB. df –total showed that I still had 10% of my space free. (At this point, I decided to build the toolchain on my desktop machine as well, to find out if it was just the Pi being awkward. It’s the Pi being awkward, *and* I failed to build on ARCH.) I installed bison, and increased the swap file to 800MB. The temperature warning light stayed on, meaning that the CPU was being throttled. However, finally, I ran out of space on the device. One last gambit was to decrease the swap file to 600, because I didn’t know if the installation of bison could fix the earlier issue. Again, I ran out of space. More in next week’s exciting episode, folks.

My Little Pi-ny

Dev Machine
Here’s the development machine. I love hardware that folds down almost as much as I love free hardware that I picked up because someone else didn’t need it, and this is a blend of the two.

Everything I have in this photo fits into the official touch screen box, along with a chunky battery and a spare USB lead for power. It’s a Pi 3 with blinkt hat, touch screen, Rii-diculously small keyboard on which yes, I genuinely type, and two Fold Holds (by Jonathan Woolf) to hold it all up and protect the screen when it’s packed. You might say the touch screen is overkill – I don’t have a GUI on the machine.

I’m going to design a hat to go on top, which will be able to fly out the unused pins currently covered by the blinkt, giving me breadboarded GPIO access. Nothing could possibly go wrong with that plan.

Clinkt

Pi Larson ScanningI may have got a little carried away.

The Blinkt hat has a perfectly* good python library which does everything you might reasonably want to do with a set of 8 APA102 lights. My problem there is the word ‘reasonably’. So, I re-wrote it in C++, because my soul has never seen the light of day.

(* nearly perfectly. Some might say that flushing the visible buffer by writing white pixels off the end of it is a little much if you decide to define the number of LEDs as 6 for testing and OW MY EYES.)

It’ll take arbitrary pixel length, just like the python library, but unlike the python library it’s built with the assumption you’ll want to make and use multiple patterns, and manipulate those patterns with regard to each other. I can cross over patterns based on whatever input I like, as long as I painstakingly craft that input and sanitise it myself.

The reason I wanted to dig deeper than the python framework was that the Raspberry Pi is my lightweight development machine. I have a laptop that fits into a box. More on that in the next post.

I’m reliably informed that it’s against the law to have a blinkt and not use it to output something something pop culture Davis Hasselhoff – so here is the Larson Scanner in use: Video 19-04-2017, 14 00 28

The C++ library is available at https://github.com/dianaprobst/clinkt. You’ll need the bcm28somethingorother library, but the README.txt has that information. If you want to use cheerlights or APIs you’ll also need libcurl.

blinktenlights

I picked up a pimoroni blinkt in a swag bag recently, and I think I should make a colour clock out of it. There’s a simple one-liner for installation of all required libraries, but it pipes to bash.

That is against my religion. I like to know for myself how I’m messing things up. I like to make sure the checksums are right. Disappointingly, I did it through aptitude, and it didn’t go wrong /at all/.

Lasers

A while back I decided for safety reasons not to put laser cutting capability onto my Art Bot. So, the laser and heatsink bundle arrived today. I’m going to be messing with the voltage and current using a dummy load (also bought that, rather than scraping it together) and nothing could possibly go wrong.

I’ve already written the software.

Kernel Fun

The current linux kernel is messing with the intel graphics chip on my laptop, which consequently thinks it’s helping to run a Cathode Ray Tube, and this is less than perfect.

My options are running a 3 month old kernel, which is perfectly sensible, or using linux-lts, which is also perfectly sensible. So, I’ve gone for the third option. I’m going to have the newest release kernel and also linux-lts as a fallback. This is unusual for me in that it’s a third option that is also perfectly sensible.

However, it does rely on me not building the lts kernel with the wrong name, so as to over-write the kernel I already have. So, I’m going to be here for a while.

It would have gone a lot better if the power lead hadn’t fallen out half an hour before I typed ‘make’.

Cannonball Gilding

This is not about cannonball gilding at all. I showed a friend a photo from the process of making his Christmas Present and he said he was in need of a cannonball, so that’s my code name for this. I have pictures of it being polished as well. But, as there’s a chance he might see this before Christmas, let me just say that the gilding powder picture came out badly.

Oozi – I hate Oozi

I need to mess with the PID loop on the 3D printer. Right now it’s got about 12 possible temperature states in a look-up table, and that’s not enough. It needs 60, I think. The symptom is that the print never starts, and I believe that’s because the temperature never stabilises enough. If the change in loop doesn’t fix it, I’ll end up using an Arduino/Ramps combo, but I need to do this.

I’ve needed to do it for about five months now. I do not want to flash that damned thing Yet Again. For one thing, it’s been months since I have and I’ve forgotten most of the steps.

Update: Have accidentally ordered an Arduino Mega to go with the early RAMPS board I picked up. I was on eBay and it fell into my basket.