This tutorial assumes that your system is Ubuntu Linux. This should still be useful to other Linux distributions.
1. User and device privilege
1.1. To give user the privilege:
- The "lazy" method is:
sudo usermod -a -G dialout $USER
- Log out of your computer and log in again.
- Another more comprehensive method is:
- Edit the group-definition-file by
sudo nano /etc/group
- Using your cursor, go to a line that starts with
dialout
, then add your username at the end, after the colon, for example, since my username ischung
, the line will bedialout:x:20:chung
- Save the edited file, and force the shell to reset by
su - $USER
- Edit the group-definition-file by
1.2. To give the device access rights:
- Create a new udev rule by
sudo nano /etc/udev/rules.d/99-usb-stlink.rules
- Append to the file
SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="3748", MODE="0666"
. This step may vary slightly due to some differences in the idVendor, idProduct fields. To check yours, follow excellent instructions in this link.\ - Save the udev rule file and force the shell to reset udev rules by
sudo udevadm control --reload-rules
- Unplug and replug your device.
2. Install dependencies
sudo apt-get install \
python-serial openocd \
flex bison libncurses5-dev autoconf texinfo \
libftdi-dev libtool zlib1g-dev -y
3. Remove existing versions of toolchain
sudo apt-get remove \
gcc-arm-none-eabi gdb-arm-none-eabi \
binutils-arm-none-eabi gcc-arm-embedded
sudo add-apt-repository --remove ppa:team-gcc-arm-embedded/ppa
4. Install toolchain version 5.2
Put the following block of code into a file, e.g toolchain_install.bash
, and install by ./toolchain_install.bash
pushd .
cd ~
wget https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q2-update/+download/gcc-arm-none-eabi-5_4-2016q2-20160622-linux.tar.bz2
tar -jxf gcc-arm-none-eabi-5_4-2016q2-20160622-linux.tar.bz2
exportline="export PATH=$HOME/gcc-arm-none-eabi-5_4-2016q2/bin:\$PATH"
if grep -Fxq "$exportline" ~/.bash_profile;
then echo nothing to do ;
else echo $exportline >> ~/.profile;
fi
popd
5. Install 32bit support libraries
(This step might not be necessary if your computer is already a 32bit system)
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libgcc1:i386 libstdc++5:i386 libstdc++6:i386
sudo apt-get install gcc-4.6-base:i386
6. Check installation success
Restart the computer.
Run the command
arm-none-eabi-gcc --version
The output should be something similar to this
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715]
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7. Reference
This section is adapted from original PX4 developers'guide.