Follow @jack_ganssle

The logo for The Embedded Muse For novel ideas about building embedded systems (both hardware and firmware), join the 27,000+ engineers who subscribe to The Embedded Muse, a free biweekly newsletter. The Muse has no hype, no vendor PR. It takes just a few seconds (just enter your email, which is shared with absolutely no one) to subscribe.

By Jack Ganssle

A Strange IDE

Published on embedded.com November, 2012.

IDEs are all pretty much the same. Sure, an IDE may be based on Eclipse, or could be proprietary, but basically they all consist of an enormous installable that gobbles as many resources as possible on your PC. In the embedded world most are PC centric, though a few do support Linux or the Mac. In general these tools offer a huge wealth of resources for building and debugging firmware.

Then there's the mbed IDE.

mbed is an ARM-sponsored outfit that sells a couple of low-cost development boards based on ARM cores from NXP. One uses a Cortex-M3; the other an M0, and they cost $45 to $60 or so. As is common today these cores have gobs of I/O ranging from simple analog to USB and Ethernet (depending on the board).

Both are the size of a 40 pin DIP and have a DIP pinout, which makes it easy to use these on solderless breadboards. And they'll connect to the development host via a USB cable which also provides power.

M3
The Cortex M3 mbed board.

But they won't sell you an IDE.

Instead, the compiler et al are web-hosted and access to the environment is free.

Unpack the board and connect it to your computer. The thing looks just like a USB flash drive; click on the file named MBED.HTM and it will take your browser to their site. You'll have to register, but this gives you your own sandbox for storing code. Go to the compiler window, cut and paste one of their many examples and press "compile." Save the binary to the mbed board pseudo-drive and hit the reset on the board.

That's it. Your program is now running on the Cortex CPU.

Figure on ten minutes, tops, to get your first program going. I have never experienced such an easy-to-use development environment.

Being web-hosted the tools don't care what sort of host computer you're using. PC, Linux, Mac, heck, I imagine they'd run fine on a VAX if it had a web browser.

The tools aren't toys; that web interface is connected to the full suite of ARM tools.

Debugging resources are just about non-existent. Don't count on trace or complex breakpoints. Your code can toggle the board's LEDs to provide some debugging feedback, or you can use printfs. Formatted output goes back up the USB link to a terminal window, and works surprisingly well.

I don't know about you, but I hate digging through the CPU's manual to figure out how to configure all of the peripheral's registers. Sure, some vendors have tools that will automatically generate the interface code, but that's never a painless process. On the mbed board all of that goes away. They have resources predefined to drive devices. So, to toggle a pin one might write:

DigitalOut signal(p4);		// Use pin 4 as a digital output
             int i;
void main(){
             signal.write=1;			// write to pin 4
             i=signal.read;			// read from pin 4
             }

That's it -- the tools will do all of the work to properly multiplex and configure the pin.

All of the headaches of doing embedded work disappear. There's no obvious link process, no memory maps to puzzle out, and no I/O configuration. Interrupts are supported but you don't have to set up the vectors, NVIC, and all of that.

There's the old joke that one wants to avoid writing comments because if they can understand how the system works, they won't need you any more. Well, the mbed board's automation of all of the usual embedded problems almost makes me fear that they won't need us deeply embedded people any more.

This is a fantastic resource for kids and others who want to get acquainted with embedded programming. I plan to keep the board around for those times when I want to quickly play with a little embedded problem and don't want to relearn and struggle with a big, complex IDE.

mbed's web site is mbed.org. There you'll also find a ton of code, all ready to go.