Quantcast
Channel: Light of the World
Viewing all articles
Browse latest Browse all 16

Part 1: Mac OS + Eclipse + OpenOCD + STM32 (ARM Cortex M3)

$
0
0
Intro
I really wanted to program and debug ARM processors from my Mac. This series of entries is a work in progress as I fine tune my setup for regular use.  Be sure to read the full story:
Part 1: Getting Started, what we are going to do and what parts we are going to use.
Part 2: Laying the Foundation, getting all the parts installed.
Part 3: Connecting the Plumbing, hook up all the pieces and run it.
Part 4
: Finishing Touches, troubleshooting and final thoughts.

My motivation: I am an electrical engineer that uses a Mac. It's a long story, but now that I'm here I'd rather not switch operating systems via Boot Camp multiple times per day. I admit that it's not THAT hard to reboot in Windows, nor does it take THAT long, and I'm sure I've spent more time on this research project than I'll ever save. However, I wanted to know more about open source embedded dev tools and this was a great way to find out if its worth it. Is it worth it? I don't know yet. I'll try to get comfortable debugging the STM32 in Eclipse and report back. If it works out well then I'll try the STM8 with its SWIM interface and get all of my development under one IDE umbrella.

Where I came from: IAR Embedded Workbench for ARM + IAR J-Link. This is great software and hardware, no doubt. Very easy to use, supports every processor I've ever heard of, and my chip vendor of choice (ST Micro) supplies great sample projects in IAR format. But it doesn't run on Mac, and its not cheap (even if you use the free 16K version of EWARM the J-Link will cost you a lot). For some the cost is irrelevant, but if you switch chips a lot, if you're a student, or if you have multiple developers who just want to experiment then maybe this article is for you.

Bill of Materials
I am going to show you how to establish an embedded processor programming and debugging ecosystem using as much free and open source stuff as I reasonably can, and do it all on a Mac. Here are the pieces:
  1. STM32 development board with JTAG interface. I am using an STM32F103 on my own PCB design, you can use your own platform or buy any of the many development kits out there.
  2. OlimexARM-USB-TINY-H JTAG device (buy it from Mouser.com for about $50).
  3. Mac OS X Lion 10.7.1
  4. Eclipse IDE with C/C++ Developer Tooling (CDT). These are separate downloads and you need them both. I am using Helios SR2 with CDT 7.0.2. I haven't upgraded to Indigo yet, but I'm sure the process is very similar. You will need a few helper pieces as well, described below.
  5. YAGARTO means Yet Another GNU ARM Toolchain. I used the 29 Apr 2011 version with GCC-4.6.0 and GDB-7.2. Eclipse uses this piece to cross-compile your code for the ARM on your Mac, generate the binary file used program your chip, and generate debugger data.
  6. Zylin Embedded CDT is an open source plug-in for GDB that magically fills the gap between Eclipse and OpenOCD. It gets installed into Eclipse.
  7. OpenOCD the Open On-Chip Debugger v0.4.0. This lets GDB talk to the JTAG hardware over USB. Hadn't been updated in over a year until I start using it then they release v0.5.0 : ) No hard feelings, but you should be aware that many of the OpenOCD server commands changed with the new version, so to use what I've done you should get the old one, or wait (potentially for eternity) for me to update to the latest.
  8. I used the MacPorts method to install OpenOCD, and I suggest you do the same if you are fairly new to the command line of Mac OS X or Linux. Heck, even if you're not new to the nitty gritty you should use it, I think MacPorts is great, and it's the method I'll show.
If it wasn't for the great open source community out there I never would have accomplished my goal. It took the aggregation of multiple how-to guides and forums for me to put together my specific solution, so I will reference those resources but also publish sufficient relavent information here.

First Things First
First thing to do is get the hardware interface installed, so go on to Part 2: Lay the Foundation.

Viewing all articles
Browse latest Browse all 16

Trending Articles