Installing and Activating Cross Development Environment Print

 

The Linux Cortex-M development software is distributed as a linux-<mcu>-<release>.tgz file available for download from the Emcraft site. That file can be installed to an arbitrary directory on your Linux development host, as follows:

[psl@ocean SF]$ mkdir release
[psl@ocean SF]$ cd release
[psl@ocean release]$ tar xvjf ../linux-STM32F4-2.0.0.tar.bz2
linux-cortexm-2.0.0/
linux-cortexm-2.0.0/linux/
linux-cortexm-2.0.0/linux/lib/
...
[psl@ocean release]$ ls -l linux-cortexm-2.0.0
total 24
drwxr-xr-x 22 yur yur 4096 2016-09-19 10:50 A2F
-rwxr-xr-x 1 yur yur 356 2016-09-19 10:44 ACTIVATE.sh
drwxr-xr-x 23 yur yur 4096 2016-09-19 10:44 linux
drwxr-xr-x 3 yur yur 4096 2016-09-19 10:44 projects
drwxr-xr-x 4 yur yur 4096 2016-09-19 10:56 tools
drwxr-xr-x 31 yur yur 4096 2016-09-18 23:31 u-boot

You do not need to be the superuser (root) in order to install the Linux Cortex-M distribution. The installation can be performed from an arbitrary unprivileged user account.

As a next step in the installation procedure, you need to download the GNU cross-build tools for Cortex-M. The tools are available from CodeSourcery and can be downloaded from the URL described below:
http://www.codesourcery.com/sgpp/lite/arm/portal/package6503/public/arm-uclinuxeabi/arm-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu.tar.bz2

It is recommended that you install the GNU development tools to the tools/ directory in the cross-development tree, as follows:

[psl@ocean linux-cortexm-2.0.0]$ cd tools/
[psl@ocean tools]$ wget \
http://www.codesourcery.com/sgpp/lite/arm/portal/package6503/public/arm-uclinuxeabi/arm- 2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu.tar.bz2

...
Saving to: arm-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu.tar.bz2
...
[psl@ocean tools]$ tar xvfj arm-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu.tar.bz2
arm-2010q1/arm-uclinuxeabi/
arm-2010q1/arm-uclinuxeabi/libc/
...

It is possible to install the tools to an alternative location, however, should you do that, you will need to modify the ACTIVATE.sh script to provide a correct path to the installed tools (specifically, PATH must include a correct path to the directory where you have installed the cross-tools).

The tools can be installed from an unprivileged account.

In case you already have the toolchain installed on your development host (it would be the case, for instance, if you have more than one installation of the cross development environment on your host) and the underlying filesystem supports symbolic links (DOS FAT does not), you do not have to install the whole toolchain again. Instead, do the following:

[psl@ocean linux-cortexm-2.0.0]$ cd tools/
[psl@ocean tools]$ ln -s /usr/local/arm-2010q1 .

Note: The CodeSourcery tools are 32-bit applications and need a compatibility library to run on 64-bit Linux OS distributions. On the recent Fedora distributions, the compatibility package (e.g.
glibc-2.17-14.fc19.i686) is installed by default. On Debian, you need to install it by running
sudo apt-get install ia32-libs.

Generally speaking, our customers do not have many issues (if any) with installation and activation of the development environment. For some reason, the most frequently occurring error is that people forget to run the activation script. This obviously results in insufficient path settings and the compiler failing to build sources for Cortex-M.

The activation script needs to be run any time you start a development session. The script resides at the top of the installation directory:

[psl@ocean release]$ cd linux-cortexm-2.0.0
[psl@ocean linux-cortexm-2.0.0]$ ls
A2F ACTIVATE.sh linux projects tools u-boot
[psl@ocean linux-cortexm-2.0.0]$

An alternative way to run the script is to perform the following command:

[psl@ocean linux-cortexm-2.0.0]$ source ACTIVATE.sh
[psl@ocean linux-cortexm-2.0.0]$

Whichever way you run the script, it sets a number of environment variables that are required for the cross development environment to function correctly. One of those variables is called MCU. The easy way to test if the cross development environment is active is to run the following command:

[psl@ocean linux-cortexm-2.0.0]$ echo $MCU
STM32F4X9
[psl@ocean linux-cortexm-2.0.0]$

If MCU is empty or set to something other than STM32F4, this means that you have forgotten to run the activation script or somehow run it incorrectly.

Some of our customers ask if the cross development environment can be run on a Windows host. We don't support Windows, however some of our customers have been successfully running the development environment on a virtual Linux machine under Windows. Again, we don't support that explicitly so if you want to try that, you are on your own.