User Tools

Site Tools


Writing /var/lib/dokuwiki/data/meta/teaching/ie0117/proyectos/2012/i/final/stm32f4-discovery/compilador.meta failed
teaching:ie0117:proyectos:2012:i:final:stm32f4-discovery:compilador

This is an old revision of the document!


Summmon-arm-toolchain, libopencm and stlink

For the stm32f4 we have to do a cross-compilation, the cross-compiler that we used is summon-arm-toolchain.

Installing summon-arm-toolchain

  • Download it:
  cd local/src/
  git clone https://github.com/esden/summon-arm-toolchain.git # or --> git clone git://github.com/esden/summon-arm-toolchain.git
  • Install needed dependencies (README):
  sudo apt-get install flex libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo build-essential libftdi-dev
  • If you installed ROS before, then you have to unset some environment variables:
  unset LIBRARY_PATH; unset LD_LIBRARY_PATH; unset CFLAGS; unset LDFLAGS; unset CPATH;   
  • Finally we run the excecutable file>
  cd ~/local/src/summon-arm-toolchain 
  ./summon-arm-toolchain

We also used a library called libopencm3

  • Download it
   cd local/src
   git clone git://github.com/libopencm3/libopencm3.git
  • To make it easier to use, we put it in the path:
   nano ~/.bashrc
  • In the export PATH add this line:
  ${HOME}/sat/bin:
  • Reload it
  cd ~
  . .bashrc
  • Finally build it:
  cd local/src/libopencm3/
  make

Stlink is going to be use to flash our program

  • Compile and install
  cd ~/local/src
  git clone git://github.com/texane/stlink.git
  cd stlink
  ./autogen.sh
  ./configure --prefix=${HOME}/local/DIR/stlink
  make
  make install
  cd ~/local/DIR
  xstow stlink
      
  • To enable the usb port, we must copy to files from stlink directory to /etc/udev/rules.d and then restart it
 sudo cp 49-stlinkv1.rules /etc/udev/rules.d/
 sudo cp 49-stlinkv2.rules /etc/udev/rules.d/

Example

  • Compiling fancyblink
  cd ~/local/src/libopencm3/examples/stm32/f4/stm32f4-discovery/fancyblink
  make clean
  make
  st-flash erase #this might not be necessary
  st-flash write fancyblink.bin 0x8000000

Touch the reset button… and now we can see the fancyblink

INDEX

teaching/ie0117/proyectos/2012/i/final/stm32f4-discovery/compilador.1457364315.txt.gz · Last modified: 2022/09/20 00:08 (external edit)