Arm Toolchain

Before we used the summon-arm-toolchain script to make the crosscompiler tool, but now summon-arm-toolchain is not maintained anymore and now they recommend to use the official toolchain from ARM:

Also you must install the following packages:

sudo apt-get install libftdi1 openocd libusb-1.0-0-dev

To install:

  1. Set multiarch in your system.
  • To add an extra architecture (in Debian from dpkg 1.16.2 onwards) the syntaxis is as follows:
    dpkg --add-architecture <arch>
    dpkg --add-architecture i386
  • Your dpkg architectures are stored in /var/lib/dpkg/arch.
  • Now, modify /etc/apt/sources.list. Apt-sources can be architecture qualified with this syntax for each 'source':
    deb [arch=amd64,i386] distribution
  • Next, do apt-get update always after adding new architectures.
  1. Get the dependencies:
sudo apt-get install libncurses5:i386
  1. Download the latest installation tarball for GNU Tools for ARM Embedded Processors, and uncompress:
cd ~/local/src
tar -xjf gcc-arm-none-eabi-4_9-2014q4-20141203-linux.tar.bz2
  1. Make the toolchain executables available to the users add the bin directory to your PATH variable:
echo 'export PATH=$PATH:/home/****user****/local/src/gcc-arm-none-eabi-4_9-2014q4/bin/' >> /home/****user****/.bashrc
  1. Remember to reload your .bashrc file, there are two ways:
  • Close your session and login again.
  • Reloading your .bashrc file directly:
. .bashrc

Project's webpage:

First we need to install the package: libusb-1.0

También se debe seguir el tutorial Using xstow for local installations antes de continuar con la instalación.

Primero ingresamos a la carpeta

cd ~/local/src/

Se descarga con git

git clone

Ingresamos a la carpeta

cd stlink


mkdir build
cd build
ccmake ..

Presione “c”. Seleccione en CMAKE_BUILD_TYPE=debug. Luego en CMAKE_INSTALL_PREFIX=/home/user/local/DIR/stlink Presione “c”, y luego “g” denuevo.

Compilamos, e instalamos

make install 
cd local/DIR
xstow stlink

Ahora necesitamos copiar las siguientes reglas (tenemos que estar ubicados en ~/local/src/stlink/etc/udev/rules.d/),

sudo cp 49-stlinkv1.rules /etc/udev/rules.d/
sudo cp 49-stlinkv2.rules /etc/udev/rules.d/
sudo cp 49-stlinkv2-1.rules /etc/udev/rules.d/
sudo /etc/init.d/udev restart
udevadm control --reload-rules
udevadm trigger --attr-match=subsystem=usb


To build the library:

cd ~/local/src/
git clone
cd libopencm3-examples
git submodule init
git submodule update
cd libopencm3

Be sure to install python-yaml first.

To build an example and flash it to the f4discovery:

cd ../
cd examples/stm32/f4/stm32f4-discovery/miniblink/
make flash

New STM versions

New versions use STLINK 2-1. If you have errors, flashing the microcontroller, you should change your OOCD_INTERFACE configuration in the corresponding Makefile or passing as an argument on the flash instruction as seen below:

$ make flash OOCD_INTERFACE=stlink-v2-1


Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download this .wav file to get them read to you.
  • tutorials/stm32f4.txt
  • Last modified: 2019/04/24 20:19
  • by admin