Friday, May 23, 2014

First look at the Intel Galileo embedded linux board

I've just received an Intel Galileo board and am starting getting to know it. In the past I've used Arduinos for low level hardware "bit bang" style projects, and Raspberry Pi or Beagleboards where a little embedded Linux is needed - both are great for their purpose.

The Intel Galileo is kind of a mash up between the two worlds, underneath it runs Linux and it has software that emulates the Arduino's hardware enough for many sketches to run as they are.


You can see that it includes the standard, weirdly offset, Arduino sockets for taking "shield" boards.

The board is just 7x10cm and pretty capable:

  • USB 2 client and USB 2 host ports.
  • Serial port (wired to a convenient 3.5mm stereo socket)
  • Ethernet socket
  • Standard 5V 2.1mm power socket
  • Mini PCI Express slot with USB 2.0 Host support - this is probably most useful for adding a Wifi card.
  • All of the Arduino's analog and digital I/O ports.
  • It has the normal pin 13 LED that you get on an Arduino.
  • The CPU is an Intel Quark SoC X1000, which is a 32 bit Pentium class processor running at 400Mhz. (Single core).
  • 256MB of RAM
  • 8GB onboard flash which contains the linux boot
  • uSD card slot that can take up to 32GB cards and will boot from this if present.

As an Arduino

First up I wanted to try it as an Arduino emulator. I connected a microUSB cable from my Mac to the USB client port on the board.

The version of the Arduino development tool which has been modified for the Galileo can be downloaded from Intel's download centre. Annoyingly it's also called Arduino, so will collide with the normal Arduino app unless you rename one of them. (I read that spaces in the name are a bad thing by the way).

Choose the virtual serial port and choose "Firmware update" from the Help menu.


The update was faster than the 5 minutes they warned about. After the update I had to quit and re-launch the Arduino environment.

I selected the Blink example from the sample sketches bundled with the environment, clicked compile and then run. 

Now we see a little blinking green LED on the board, just like a real Arduino.

But this seems a waste of a Pentium CPU with a quarter of a Gig of RAM!

Talking to Linux

Sketches can fire off linux commands using a system() function.

I plugged a short ethernet cable from the port on the back of my Mac directly in to the ethernet port on the board. (Macs don't need crossover cables). To bring up the interface on linux you need to write a sketch to configure the interface and start the telnet server.


system("telnetd -l /bin/sh");
system("ifconfig eth0 169.254.1.1 netmask 255.255.0.0 up”);

With ifconfig on my Mac I can see that en0 gave it self 169.254.248.1

I ran the sketch.


And I can telnet to the board:

$ telnet 169.254.1.1
Trying 169.254.1.1...
Connected to 169.254.1.1.
Escape character is '^]'.

Poky 9.0.2 (Yocto Project 1.4 Reference Distro) 1.4.2 clanton

/ # top
Mem: 22704K used, 215448K free, 0K shrd, 0K buff, 12972K cached
CPU:  99% usr   0% sys   0% nic   0% idle   0% io   0% irq   0% sirq
Load average: 0.98 0.56 0.26 2/36 3476
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
 3468   875 root     R    10100   4%  99% /sketch/sketch.elf /dev/pts/1 /dev/ttyS0
 3476  3475 root     R     1268   1%   1% top
  951     1 root     S     1268   1%   0% telnetd -l /bin/sh
  197     2 root     SW       0   0%   0% [kworker/0:1]
  870     1 root     S     1272   1%   0% {launcher.sh} /bin/sh /opt/cln/galileo/launcher.sh
 3475   951 root     S     1268   1%   0% /bin/sh
  720     1 root     S     1264   1%   0% /sbin/syslogd -n -O /var/log/messages
  884     1 root     S     1264   1%   0% /sbin/getty 38400 tty1
  883     1 root     S     1264   1%   0% /sbin/getty 115200 ttyS1
  724     1 root     S     1260   1%   0% /sbin/klogd -n
  875   870 root     S      876   0%   0% /opt/cln/galileo/clloader --escape --binary --zmodem -
    1     0 root     S      796   0%   0% init [5]
  873     1 root     S      768   0%   0% /opt/cln/galileo/galileo_sketch_reset
    3     2 root     SW       0   0%   0% [ksoftirqd/0]

Interesting, I guess the Arduino software loader uses zmodem, that takes me back to the old dial up BBS days!

There’s a /sketch directory containing sketch.elf which is the binary of the sketch I’m running.

The little Yocto Linux distribution in the 8GB of onboard flash is pretty basic and doesn't have ssh for example so it's time to upgrade.

Boot Linux from uSD Card

There's a larger Linux distribution from the Intel download centre

I found a spare uSD card, stuck it in an SD adapter and stuck it in to my Mac, a USB reader would do.

Using Disk Utility, partition the uSD card as MSDOS FAT single partition. I called mine BOOT.

The Linux image is compressed with 7zip. I think I have that from Homebrew so you might need to find something else to uncompress the file if you don't have that.

I extracted directly to the root of the uSD card like this:

$ 7z x LINUX_IMAGE_FOR_SD_Intel_Galileo_v1.0.0.7z -o/Volumes/BOOT

Unmount the uSD card. Power off the Galileo board, insert the uSD card and power up. Lights flash enthusiastically for a little while.

To find the IP address the board has taken I use arp on the Mac:

$ arp -i en0 -a
? (169.254.165.5) at 98:4f:ee:1:45:c0 on en0 [ethernet]
? (169.254.255.255) at ff:ff:ff:ff:ff:ff on en0 [ethernet]

So we can see it’s on 169.254.165.5.

$ ssh root@169.254.165.5
The authenticity of host '169.254.165.5 (169.254.165.5)' can't be established.
RSA key fingerprint is 09:ff:22:6c:5b:1f:7b:39:53:a2:a7:6d:d4:d7:fe:54.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '169.254.165.5' (RSA) to the list of known hosts.
root@clanton:~# 

And we’re in. (No root password). I’m using an old 8GB uSD card and that leaves me with 140MB free. You can use up to 32GB cards.

I can see the on board 8GB there so presumably that could be wiped and used as a drive if you’re booting from the uSD card.

# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                  295.1M    139.5M    140.6M  50% /
none                    115.3M      4.0K    115.3M   0% /dev
/dev/mmcblk0p1            7.2G    306.4M      6.9G   4% /media/realroot
/dev/loop0              295.1M    139.5M    140.6M  50% /
/dev/mmcblk0p1            7.2G    306.4M      6.9G   4% /media/mmcblk0p1
tmpfs                   116.3M    116.0K    116.1M   0% /var/volatile
tmpfs                   116.3M         0    116.3M   0% /media/ram

There's lots of standard utilities, sshd, python and node are there so it’s a very familiar environment. Plus there’s the Arduino emulation software as well.

Conclusion

At around $110 plus shipping the Intel Galileo makes an expensive Arduino, but as an x86 Linux board it seems like a bargain. (It comes with a beefy 3A 5V power supply which explains part of the price).

I'm keen to see the things that this extra processing power can handle that a Raspberry Pi would not be able to cope with, things like FFT processing for real time signal processing. (I'm looking at you FreeDV...).

I realise the on board space is short but it might be nice if the network port was able to join a network and at least listen for telnet without the need for a sketch or uSD card boot to get to Linux. Presumably they want users to at least try the Arduino emulation side of the product.

My sincere thanks to Intel Australia for early access to the board.

No comments: