mbed: A strange IDE
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-M0 (Figure above); the other an M3 (Figure below), 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.
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:
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.
Jack G. Ganssle is a lecturer and consultant on embedded development issues. He conducts seminars on embedded systems and helps companies with their embedded challenges. Contact him at firstname.lastname@example.org. His website is www.ganssle.com.