Linux toolchain setup - multirotor/Multirotor GitHub Wiki

Windows and VirtualBox

If you only have a Windows OS: - follow e.g. this guide: http://www.psychocats.net/ubuntu/virtualbox

  • when you get to the hard disk creation dialog, pick "fixed size" and assign around 20GB instead of default 8GB. (8GB is not really enough for (K)Ubuntu.
  • start the VM
  • go to next chapter

Linux

From the VM or if you already run Linux: - open a console ("Konsole" in Kubuntu) and install openocd (write "sudo apt-get install openocd")

  • install the debugger ("sudo apt-get install gdb-arm-none-eabi")
  • install git (the same way, sudo apt-get...)
  • install openocd
  • install cmake
  • install vim
  • install eclipse (do NOT use apt-get, download from the eclipse website (choose "for C/C++ developers", Linux 64bit) and extract it. no "installation" necessary as eclipse is java)
  • install eclipse arm plugin http://gnuarmeclipse.livius.net/blog/plugins-install/

ST cube drivers: - download and extract STM32cubeF4 http://www.st.com/web/en/catalog/tools/PF259243#

gcc-arm-none-eabi

Step1: Inside Ubuntu, open a terminal and input "sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded"

Step2: Continue to input "sudo apt-get update"

Step3: Continue to input to install toolchain "sudo apt-get install gcc-arm-none-eabi"

Copied from: https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded

openocd setup

We need to use openocd-0.9 because the 0.8 version does not support the nucleo board yet. To download, compile and install do the following:

  • make a openocd directory, cd to it

  • Get openocd 0.9 from http://sourceforge.net/projects/openocd/files/openocd/0.9.0/

  • Extract it (- do git clone git://git.code.sf.net/p/openocd/code openocd-code)[Amir: This will give you openocd0.10 which is under development, might still work though.]

  • install libtool (sudo apt-get install libtool)

  • install autotools (sudo apt-get install autoconf)

  • install libusb (sudo apt-get install libusb-1.0-0-dev)

  • [(Amir): I needed to install pkg-config (sudo apt-get install pkg-config)]

  • run ./bootstrap

  • run ./configure --verbose --enable-maintainer-mode --enable-stlink

    in case that you run into an error, install libtcl8.5

  • run make

  • run sudo make install

openocd test

If you run on VirtualBox, plug in the development board and enable the ST-Link USB connection:

  1. In the running VirtualBox window, go to the menubar --> Devices --> USB Devices --> ST Microelectronics ... ST Link

  2. Now, the ST Link interface should be available from inside VirtualBox

  3. Test connection to the board: sudo openocd -f /usr/local/share/openocd/scripts/board/st_nucleo_f4.cfg

  4. If this does not work install the ST-link drivers on your host machine (Windows: http://www.st.com/web/en/catalog/tools/PF260219). Then repeat step 1-3.

libopencm3

Documentation: https://libopencm3.github.io/docs/latest/stm32f4/html/