Got my STM32F4DISCOVERY board today from digikey.  I didnt know there
was a cortex-m with an fpu so I wanted to try it out.  Cost about $20,
they are giving these things away you might as well get one.

http://www.st.com/internet/evalboard/product/252419.jsp

Under the Design support tab you will want to download the users manual

UM1472: STM32F4DISCOVERY STM32F4 high-performance discovery board

It contains the schematic so we can figure out where the leds and other
stuff are on the board.

It uses the STM32F407VGT6 part

http://www.st.com/internet/mcu/product/252140.jsp

You are definitely going to need the reference manual under the Design
Support tab.

RM0090: STM32F405xx, STM32F407xx, STM32F415xx and STM32F417xx advanced
ARM-based 32-bit MCUs

You are also going to want the TRM for the ARM cortex-m4f core

http://infocenter.arm.com/help/topic/com.arm.doc.ddi0439c/DDI0439C_cortex_m4_r0p1_trm.pdf

I derived a command line loader from

https://github.com/texane/stlink

which is a gdbserver for the various stm32 stlink boards.  Mine is
limited to this board.  You only need the mini-b usb plugged in to use
the stlink interface, powers the board and communicates with the stlink
interface.

Another way to load is to remove the zero ohm resistor on solder bridge
SB18.  SB18 as shipped shorts boot0 to ground.  With boot0 high
the normal embedded bootloader runs on the stm32f4.  It happens to be a
dfu based usb bootloader.  You will need the micro-b usb connected as
well.  this util works on ubuntu:

http://gitorious.org/~tormod/unofficial-clones/dfuse-dfu-util

Power cycle or reset the microcontroller with boot0 floating wait a
few seconds then

dfu-util -d 0483:df11 -c 1 -i 0 -a 0 -s 0x08000000 -D myprogram.bin

After loading, short boot0 to ground and reset again to run your program
from flash.  Open boot0 and press reset to try again.

If you leave boot0 tied to ground, it is as if SB18 were connected and
you can use the stlink interface.


I decided to separate/isolate the stm32f4 discovery samples from the stm32 value line discovery samples
so now this is in its own repo


UPDATE:  openocd supports the stlink interface.  I have tried this
stm32f4 discovery and the stm32f0 discovery boards so far (both stlink
version 2).  You do not need to desolder the boot0 solder bridge.  On
the stm32f0 at this time it does not write the flash, I dont know if that
is also the case for the stm32f4, dfu-util does make flash writing very
easy.

http://openocd.sourceforge.net/

If you svn the latest you will need to run the bootstrap command below
otherwise start with the configure command.  You may wish to change
the --prefix.  I have an openocd install that has a different
interface installed, and dont want to confuse you by mixing them so
I am building an placing in directory then adding that path before using
openocd.  I downloaded the 0.6.0 tarball and started with the configure
line.

./bootstrap
./configure --prefix=/stlink --enable-maintainer-mode --enable-stlink
make
sudo make install

then before using I

PATH=/stlink/bin:$PATH

(TODO: provide stm32f4discovery.cfg, for now get it from tcl/boards
directory in openocd sources)

To load a program in sram and run it the simplest way to do it is to
have one terminal in the directory that contains your binary file
(elf format), this way you dont have to type in a path, then with
openocd in your path

openocd -f stm32f0discovery.cfg

it will connect and mention some breakpoints and such.

In another terminal, doesnt matter what directory it is in,

telnet localhost 4444

This should connect to the other and you should see both screens reflect
the connection.  IF THE CONNECTION WORKS then

> halt
> load_image blinker01.gcc.thumb.elf
> resume 0x20000000

If you happen to be running as root in that telnet window and the telnet
doesnt connect and you type halt without thinking, you turn off your
computer, a bit annoying...



I have focuses my stm32 examples in a different repo, stm32_samples.
Guess I didnt pull this one in yet.  Need to find where I put these
boards, I have so many different ones now.