Skip to content
Peter Kietzmann edited this page Mar 19, 2015 · 3 revisions

Description

Many STM-boards include an on-board ST-LINK programmer. To program the board you just need to connect a micro-USB cable to the USB port that is centered on the top of the board. To write software into the mircrocontrollers flash memory we recommend to use OpenOCD. However, some time ago we used the ST-LINK tool for this. This is a quick guide about installing and using the ST-LINK tool.

Installing the 'stlink' tool under Linux/OSX

  1. First of all you have to download the st-flash tool from texane's github repository:

# git clone https://github.com/texane/stlink.git stlink

  1. Change into the new directory:

# cd stlink

  1. Build the st-flash tool
# ./autogen
# ./configure 
# make

For this step you have to have a working build-environment installed, for debian/ubuntu you can do this by installing the build-essential package.

  1. Add the st-flash and st-util tools to your bin-path

Flashing a new firmware to the device

Now you have to connect the device to your computer via USB-microUSB to write your program on it. Use the CN1 connector on the STM32F4discovery board for this. Normally, the device should be flashed automatically by typing:

make flash

which should run the st-flash tool. However, this did not work at my setup so I flashed the board manually using the st-flash tool:

sudo st-flash write bin/stm32f4discovery/hello-world.hex 0x8000000

(For other boards you type the respective board name). The .hex file should be written to the devices program-storage with start address 0x8000000

Clone this wiki locally