Arm compiler environment
The arm compiler environment for the ST microcontrollers used in the 3D localization project contains a number of software packages, which ones are needed depends on the users demands to debugging. It consists of an arm compiler including accessory binaries, openOCD for SWD usage (programming & debugging through GDB) and DFU-util for programming through USB.
Compiler setup - Linux
The following steps were performed on Linux Mint (Procedure is the same for Linux Ubuntu, but please adjust them accordingly for other distributions):
since the toolchain executables are 32-bits apps, when running on 64-bits machines, be sure you install the following 32-bits libraries (for different versions check the toolchain README for the actual list):
$ sudo apt-get -y install lib32z1 lib32ncurses5 lib32bz2-1.0
on Mint 17.3 / Ubuntu 15.04 the following libraries are required:
$ sudo apt-get -y install lib32ncurses5
on Ubuntu 12 LTSx64 all 32-bits libraries were packed in ia32-libs, so you can also use, but be prepared to get a lot of useless libraries:
$ sudo apt-get -y install ia32-libs
download the latest Linux install tarball file from Launchpad (currently gcc-arm-none-eabi-5_3-2016q1-20160330-linux.tar.bz2, more than 60 MB)
Note: DO NOT install the ARM GCC package that comes with your distribution, especially if it is newer than the one provided by Launchpad, since generally it is not supported, and debugging sessions might fail.
locate the file (usually in the $HOME/Downloads/ folder) decide on a location to install the toolchain; the recommended folder is /usr/local/ or /opt/ unpack the archive in the destination folder
$ cd /opt $ sudo tar xjf ~/Downloads/gcc-arm-none-eabi-5_3-2016q1-20160330-linux.tar.bz2
the result should be a folder like /opt/gcc-arm-none-eabi-5_3-2016q1 test if the compiler is functional; use the actual install path:
$ /opt/gcc-arm-none-eabi-5_3-2016q1/bin/arm-none-eabi-gcc --version arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.3 20160330 (release) [ARM/embedded-5-branch revision 234589]
In order to let the system know where to find the compiler binaries, there are three options:
- Add the extracted folder to your environment variables ($PATH for linux) (Not recommended for linux)
- This can be done on linux by adding the following to
~/.profile
-
export PATH=$PATH:/opt/gcc-arm-none-eabi-5_3-2016q1/bin/
- This can be done on linux by adding the following to
- Add a symbolic link of all the binaries for the compiler to your
/usr/bin/
- This can be done by issuing the following command with root privileges (NOTE You have to add all the binary files in the bin folder)
-
ln -s /opt/gcc-arm-none-eabi-5_3-2016q1/bin/<binary name> /usr/bin/
- The third and last option is to alter the Makefile of the project to contain the absolute path to the compiler binaries (Also NOT recommended)
- This can be done by changing the line in the Makefile containing the path to compiler binary folder
If you’ll ever need to remove the toolchain, just remove the /opt/gcc-arm-none-eabi-5_3-2016q1, there are no other components stored in system folders.
OpenOCD setup
DFU-Util setup
OBS: Only the anchors, with their Cortex-M0 processor, supports programming through USB (DFU protocol).
The host-side tool used for programming the devices through USB, is called DFU-Util.
The tool can be downloaded at http://dfu-util.sourceforge.net/releases/, and is ready to be used out of the box.
Extract the tool where you usually install programs (for linux this is usually /opt/ or /usr/local/), and choose one of the following three:
- Add the extracted folder to your environment variables ($PATH for linux) (Not recommended for linux)
- This can be done on linux by adding the following to
~/.profile
-
export PATH=$PATH:/path/to/DFU-Util/binary_folder/
- This can be done on linux by adding the following to
- Add a symbolic link of the DFU-Util binaries to your
/usr/bin/
- This can be done by issuing the following command with root privileges
-
ln -s /path/to/DFU-Util/binary /usr/bin/
- The third and last option is to alter the Makefile of the project to contain the absolute path to the DFU-Util binaries (Also NOT recommended)
- This can be done by changing the line in the Makefile containing the path to DFU-Util
The DFU-util also comes in a Python version, which is included in the Scripts folder for convenience.
More info about the DFU-Util can be found at http://dfu-util.sourceforge.net/.