IntroI 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:
- 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.
- Olimex ARM-USB-TINY-H JTAG device (buy it from Mouser.com for about $50).
- Mac OS X Lion 10.7.1
- 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.
- 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.
- 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.
- 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.
- 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.
Hi, Your article is realy excellent !ReplyDelete
I'm just starting to work with STM32 with a Mac.
Very nice set of instructions. I have a web site where I am collecting Electronic Engineering tools for OS X, http://www.rau-deaver.org/Links.html
May I link to you?
Thank you and God bless.
I was kinda in the same process except I'm using Linux as platform. Using OpenOCD 0.6.0-dev from git now and Eclipse Indigo. There are indeed a lot of changes in OpenOCD regarding the STM32, but switching is quite easy actually. The main thing is that the flash commands now use stm32f1x instead of stm32.
Thanks for the update, Tom. Looks like my email notifications of comments stopped working, but better late reply than never right? I've been working successfully with the old version, but now that I'm two minor builds behind its probably time to update the guide. Thanks again, S.Delete
Very interesting post. I like to share this post with my friends and book mark this interesting page. Keep it up.pcb designReplyDelete
very good set of posts. I made my own tutorial too, as I didn't quite understand all of the information in your posts. I also used GDB hardware debugger rather than Zylin as Zylin isn't maintained any more.ReplyDelete
hi...Im student from Informatics engineering nice article,ReplyDelete
thanks for sharing :)
Learning to program these exciting SoC's is a complicated process, which doesn't need to be made more complicated by involving Windows 8. Thanks for taking time and effort to support those of us that think Macs are good for development.ReplyDelete
Thanks for review, it was excellent and very informative.ReplyDelete
thank you :)
Thank You for sharing the blog. It is really nice.ReplyDelete
best Website Design Development and Mobile Application Development company in Kanpur India Australia USA
Best Android and iOS Mobile Application Development in Kanpur India Australia USA
Really Nice Article & Thanks for sharing.ReplyDelete
Oflox Is The Best Website Design & Development Company In Dehradun
Its Helpful for developement ProcessReplyDelete
We are global provider of offshore development solutions.