How To Install The GNU ARM Toolchain
How To Install The GNU ARM Toolchain
This option can also work together with other specs options like --specs=rdimon.specs
Please note that --specs=nano.specs is a both a compiler and linker option. Be sure to include
in both compiler and linker options if compiling and linking are separated. ** additional
newlib-nano libraries usage
Newlib-nano is different from newlib in addition to the libraries' name. Formatted input/output
of floating-point number are implemented as weak symbol. If you want to use %f, you have
to pull in the symbol by explicitly specifying
"-u" command option.
-u _scanf_float
-u _printf_float
e.g. to output a float, the command line is like:
$ arm-none-eabi-gcc --specs=nano.specs -u _printf_float $(OTHER_LINK_OPTIONS)
For more about the difference and usage, please refer the README.nano in the source
package.
Users can choose to use or not use semihosting by following instructions. ** semihosting
If you need semihosting, linking like:
$ arm-none-eabi-gcc --specs=rdimon.specs $(OTHER_LINK_OPTIONS)
** non-semihosting/retarget
If you are using retarget, linking like:
$ arm-none-eabi-gcc --specs=nosys.specs $(OTHER_LINK_OPTIONS)
(G)Samples
Examples of all above usages are available at:
$install_dir/gcc-arm-none-eabi-*/share/gcc-arm-none-eabi/samples
Installing on Linux...
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2
Copyright (C) 2013 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.
If that does not work you can try the previous instructions:
→Download toolchain 4.7: https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-
update/+download/gcc-arm-none-eabi-4_7-2013q3-20130916-linux.tar.bz2
→Install dependencies in Ubuntu/Debian: (Ubuntu 12.04 LTS recommended to avoid the
following Eclipse bug: http://stackoverflow.com/a/19543780)
sudo apt-get install python-serial python-argparse openocd \
flex bison libncurses5-dev autoconf texinfo build-essential \
libftdi-dev libtool zlib1g-dev genromfs ia32-libs-multiarch git-core wget
→Note: on older systems, "ia32-libs-multiarch" may be called just "ia32-libs."
→Extract gcc-arm-none-eabi-4_7.tar.bz2 to a desired folder e.g., ~/openwsn/gcc-arm-none-eabi-
4_7.
→Modify the PATH environment variable:
exportline="export PATH=$HOME/openwsn/gcc-arm-none-eabi-4_7/bin:\$PATH"
if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >>
~/.profile; fi
. ~/.profile
→Add your username to the dialout group to make serial port access easier:
sudo usermod -a -G dialout $USER
→Verify that you can invoke the compiler:
~$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.7.3 20130312 (release)
[ARM/embedded-4_7-branch revision 196615]
Copyright (C) 2012 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.
Installing on Windows...
→Modified the PATH environment to contain the bin/ directory of the toolchain
installation directory. For example:
C:\Program Files\GNU Tools ARM Embedded\4.8 2013q4\bin
C:\Users\Thomas>arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.8.3 20131129 (release)
[ARM/embedded-4_8-branch revision 205641]
Copyright (C) 2013 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.
http://gnuarmeclipse.sourceforge.net/updates
Step 6) Testing
• Once the gnu-arm plug-in is installed you can test that everything works by
creating a test project.
• To do so, click File > New > C Project and select ARM Cross Target Application
• Make sure to select the right cross compiler. In my case I choose ARM Linux
GCC (GNUARM). If you are using Code Sourcery or Yagarto or another tool
chains, select the appropriate.
• Name your project (e.g. "test") and click Finish.
• Right click on the project and select properties:
If you have update your computer PATH environment variable, you can just
enter arm-none-eabi-gcc, without the full path.
• Repeat the same steps for the compiler, which in our case is also arm-none-eabi-
gcc.
• Repeat the same steps for the linker, which in our case is also arm-none-eabi-gcc.
• Configure the "Flash image creator" as follows:
• At this point, configure any extra options you might want, such as
optimizations and debug levels.
• Click OK to apply all changes.
• Create a file to test the compiler. You can toggle an LED according to your
hardware specification or simply code a while loop and test the compiler.
1
int main(void){
2 int i = 0;
3 while (i < 10) {
4 i++;
5 }
return i;
6
}
7
• Right-click on the project and select Build Project. Based on your configuration,
Eclipse invokes the ARM GCC compiler, linker, flash image creator, and size
printer tools.
15:49:03 **** Incremental Build of configuration Debug for project openwsn ****
make all
Building file: ../src/main.c
Invoking: ARM Linux GCC C Compiler
arm-none-eabi-gcc -O0 -Wall -Wa,-adhlns="src/main.o.lst" -c -fmessage-length=0 -
MMD -MP -MF"src/main.d" -MT"src/main.d" -mcpu=cortex-m4 -mthumb -g3 -
gdwarf-2 -o "src/main.o" "../src/main.c"
Finished building: ../src/main.c
~~~~~End~~~~~