i have updated this post over here: updated guide. So please use the new tutorial.
after couple hours of research i couldn’t find any tutorial that is up to date and describes how to use the stm32f4 discovery development board with the latest operating system for the Mac ( OS X 10.9 Mavericks). So i will try to summaries my experience with this board . The stm32f4 board is a very cheap development board holding and 32-bit ARM Cortex-M4F core with 1 MB Flash, 192 KB RAM in an LQFP100 package. More information about this board can be found on the vendors website Before we can start to use this board we need to download and install some utilities on the Mac. Lets start with the basics.
Xcode Command Line Tools
First of all, make sure you have installed Apples free Xcode command line tools installed or the full Xcode IDE. If it is not installed yet or you don’t know, check this resource about how to
install the command line tools. Install some dependencies i recommend to install homebrew as little (actually big) helper. homebrew is package manager for OS X similar to macports or fink. You can also use macports to download the dependencies by your own. if you have homebrew installed just open your preferred Terminal application and run the command: $ brew install libusb autogen automake wget pkg-config
The stlink utility tool is used for programming and debugging different micro-controllers. First download/clone the source code from github. Therefor we create a new directory.
$ mkdir ~/dev/ $ cd ~/dev/
Clone the source from Github into the new created directory. This can take a while, depending on your internet connectivity.
$ git clone https://github.com/texane/stlink.git $ cd ~/dev/stlink/
Now we can configure and compile the source code of the stlink utility.
$ ./autogen.sh $ ./configure $ make
After this we also need to compile the flash tool. The compilation should be fast and run without errors. If you got, take a look at the Github project.
$ cd ~/dev/stlink/flash $ make
which should generate a file called st-flash in the flash directory. Next step is to compile the gdbserver. Therefor switch to the directory
$ cd ~/dev/stlink/gdbserver $ make
now a new executable file will appear in your directory with the name st-util
gcc-arm-none-eabi for Mac
Download a pre compilted version GNU Tools for ARM Embedded Processors into the same dev dir. There are versions available for windows, mac and linux.
$ cd ~/dev/ $ wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update/+download/gcc-arm-none-eabi-4_7-2013q3-20130916-mac.tar.bz2 $ tar xvf gcc-arm-none-eabi-4_7-2013q3-20130916-mac.tar.bz2
dont worry, we will realy need all this tool.
install the IDE
Because i am lazy i will use the GUI debugger front-end of Eclipse. Download Eclipse as C++ development environment from the eclipse
website or directly with $ cd ~/dev/
$ wget http://ftp.osuosl.org/pub/eclipse/technology/epp/downloads/release/kepler/SR1/eclipse-cpp-kepler-SR1-macosx-cocoa-x86_64.tar.gz $ tar xvf eclipse-cpp-kepler-SR1-macosx-cocoa-x86_64.tar.gz $ ./eclipse/eclipse
eclipse should start now and we can go on. Choose a workspace location you prefer. In the next step we will install some plugins in Eclipse. These plugins will handle the cross compilation and provides the libs for the stm32f32 and other boards. Like i said: lazy. So go and install new Software:
First add the source
http://gnuarmeclipse.sourceforge.net/updates as show in the following two screenshots.
and just select all
The next package is the following one
and this time just select the “C/C++ GDB Hardware Debugging” package show in the next screenshot. The other packages can be installed as well, but are not necessary in order to debug your code on the device.
create an example create a new c project and choose in
Project Type Executable -> STM32F4xx StdPeriph Lib v1.2 C Project and as Toolchain Cross ARM GCC. Choose a name and click Next this dialog.
Locate the toolchain on your files system and go on, to Finish.
get the debugger running
We still need to integrate the debugger with eclipse. But before we can do this, we have to integrate the ST-link tool as external tool. Make sure that you modify the location of st-util. Also notice the Arguments.
Now we can configure a new debugger like in the following pictures.
You can now compile and debug your project. If you are not able to compile the project, close and open eclipse and try again. Befor you can debug you have to start the external tool.
then start the debugger and you are ready to go. If you have any questions, please ask and comment. And please notice that in the screenshots i havn’t been conseqently in naming. The project is sometimes testing or tester.