Monday, August 16, 2010

How to program the BeagleBoard

I've gotten a lot of questions over the past couple of weeks of people asking me, "how do I program the BeagleBoard?" It's not that silly of a question, actually, and it reminds me that I once asked this question too, only a couple of months ago.

The answer is: you don't! The BeagleBoard programs you! (just kidding, this isn't Russia)

In all seriousness, the BeagleBoard isn't like the Arduino, in that it doesn't have an IDE program that sits on the desktop and communicates with the board. Instead, all of its files exist on an SD card.

The BeagleBoard SD card is the easiest way to get programs and files on and off of the BeagleBoard. Just popthe SD card out of the BeagleBoard, pop it into a multi-card SD reader, plug the reader into the desktop USB port, and then copy files onto the SD card that you want to make available to the BeagleBoard.

Ok, here's a step-by-step guide:

Step 1: Turn BeagleBoard on it's side

In my case, I always leave the BeagleTouch on the front side of the BeagleBoard, so it can display graphics and the Linux OS on the screen.

Step 2: Locate the SD Card in the BeagleBoard

Every BeagleBoard is operated with software that is loaded on an SD card. This is different than the Arduino, because the Arduino stores all of it's data in a small area of Flash memory on the Atmel chip. The Atmel has something like 128-256K of space. The BeagleBoard SD card that I use (and sell pre-programmed) has 4 gigabytes of space. That's a huge difference...

Step 3: Remove SD Card from the BeagleBoard

This is not a very hard step:

Step 4: Plug SD Card into SD Card Reader

I use a Sony or Ultra one, only because I like the brushed silver / aluminum look.

Step 5: Plug SD Card Reader into PC

Using a USB cable that came with the reader:

Step 6: Copy Files to the SD Card

This is the hardest part of the whole thing, which isn't saying much. Basically it's really easy. You copy the files from your computer onto the SD card.

On Windows, it looks like this:

On Linux (and MacOS X), it looks like this:

Step 7: Install an Ext2 Partition Reader on Windows

Windows users have one extra step. The SD Card that runs the BeagleBoard has two partitions on it. One of those partitions is formatted in "vfat" which is the native format that Windows can read. This is the partition that stores the boot-up data.

The second partition is in a format called "ext2". That partition is where you want to copy the files on to the BeagleBoard. I'm not going to try to recount an explanation of ext2 here, but instead, there's a really good, easy read about it on wikipedia here. Here's the catch: Windows 7 can't read "ext2" out of the box, so you need a program to access the partition.

So to access ext2 on Windows 7, in theory, you have 3 options: Install Explore2fs (open source, free) from here, Install Diskinternals (freeware) from here, Install "Installable Ext2 File System for Windows" (freeware) from here.

I've only ever gotten it to work by following these instructions for the "Installable Ext2 File System for Windows". Here's a tutorial on how to get that working.

After you've installed one of those programs, you can now access the ext2 partition, and copy data to and from it.


Guilherme said...

Hi Matt,

This is a great post! Indeed, interfacing with the BeagleBoard can be a bit of a pain if you don't have any IDE to help you.

I thought you and your readers could like to check out ARM's DS-5 ( It is an IDE based on Eclipse and targeted on ARM Linux developers. From their website is possible to download a free time-limited version of the suite, which works seamlessly with the BeagleBoard - graphical remote file explorer, automated application download and gdbserver launch for debug purposes and an extremely helpful visual performance analyzer.

BTW it works on both Windows and Linux hosts!

Hope this helps.


Matt said...

@Guilherme - you know, normally i'm like a vigilante about blog spam and product ads, because some rando guy from taiwan keeps telling me about all these fun sites he wants me to visit. but in this case, i'll make you a deal... if you let me have a copy, i'll do the following:

1) promise not to crack it :-)

2) promise not to upload the cracked version onto bittorrent :-)

3) write a serious review of the product on my blog, using the beagleboard...

Matt said...

@guilherme x 2 - ok, i just submitted a request for a product quote, even thought I hate that word. i'm surprised that i couldn't just figure out how much it costs on the web...

Guilherme said...

@Matt - (Almost) sounds like a deal :). Hope you have downloaded a free copy and decided to give it a go.
You can find me on Linkedin. GM @ BeagleBoard Linkedin group

Raj said...

Hi, i got a question. I am currently formating my sd card for beagleboard Rev 5 and am trying to port a software (RTKlib) into it. porting in the sense is basically putting the software into the sd card and running it via the linux console,isnt it?..

cladden said...

@raj - The BeagleBoard linux distribution has gcc and Make, so you can compile the library directly on the device.

I usually grab a copy of the source files by copying them to the SD card or downloading using wget if you have an internet connection. Then, the next step is to run make.

Further install instructions are usually found the README file of the source package. Hope that helps.