Flashing the IFLAT-32 with OpenOCD

The IFLAT-32 is a STM32 development board from iteadstudio. It comes with an STM32F103 ARM Cortex M3 processor, and guess what, Windows support. Since I do not run a copy of Windows, and since I never will, this article describes how to flash the board by using the X-Link JTAG board from the same vendor with Linux.

Regarding this post at iteadstudio.com, the X-Link uses the FT2232 interface (an FTDI chip), and has vendor ID 0x0403 and Product ID 0x6010. One could easily verify this by plugging the X-Link to the USB port, and check for the FT2232 device with „lsusb“. This will show you the vendor and product ID the device uses.

1. Insatalling OpenOCD

When using Ubuntu 11.10, you can install the latest version (0.5.0) of OpenOCD through apt:

apt-get install openocd

If you are not on Ubuntu, or your have an older version, you can download and compile OpenOCD yourself (make sure to have „libftdi“ and „libusb“ development versions installed). In the directory with the extracted sources do the following:

./configure --enable-ft2232_libftdi
sudo make install

2. Check if OpenOCD is Working

OpenOCD (at least 0.5.0) could be used out of the box with X-Link and the IFLAT32. No configuration is needed since for interface we are going to use the „openocd-usb“ script provided with the package (it is already configured to uses the above mentioned vendor-/product-ID), and for the board we use the provided „olimex_stm32_h103“ script. To check if everything works, connect the X-Link to the IFLAT32 (make sure, to select 3.3V on the X-Links voltage switch), plug the X-Link to your USB-port, and do NOT power the IFLAT with external power or through its USB port. It will get power supply through the X-Link. Now launch openocd:

openocd -f interface/openocd-usb.cfg -f board/olimex_stm32_h103.cfg

If everything works, OpenOCD should report the STM32 MCU like so:

Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : JTAG tap: stm32.bs tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)

You now may connect via telnet to port 4444 and enter the OpenOCD shell, or connect GDB through the remote debug port.

3. Flashing with OpenOCD

If you intend to only flash the IFLAT-32, you could simply script OpenOCD to do so. E. g. to flash the firmware „fancyblink.elf“:

openocd -f interface/openocd-usb.cfg -f board/olimex_stm32_h103.cfg \
        -c init -c targets -c "halt" -c "flash write_image erase fancyblink.elf" \
        -c "verify_image fancyblink.elf" \
        -c "reset run" -c shutdown

Note: You could use „elf, bin or hex“ format for your firmware.


Leave a Reply

You must be logged in to post a comment.