| 1 |
GNU Tools for ARM Embedded Processors |
| 2 |
|
| 3 |
Table of Contents |
| 4 |
* Installing executables on Linux |
| 5 |
* Installing executables on Mac OS X |
| 6 |
* Installing executables on Windows |
| 7 |
* Invoking GCC |
| 8 |
* Architecture options usage |
| 9 |
* C Libraries usage |
| 10 |
* GCC Plugin usage |
| 11 |
* Linker scripts & startup code |
| 12 |
* Samples |
| 13 |
* GDB Server for CMSIS-DAP based hardware debugger |
| 14 |
|
| 15 |
* Installing executables on Linux * |
| 16 |
Unpack the tarball to the install directory, like this: |
| 17 |
$ cd $install_dir && tar xjf gcc-arm-none-eabi-*-yyyymmdd-linux.tar.bz2 |
| 18 |
|
| 19 |
For 64 bit system, 32 bit libc and libncurses are required to run the tools. |
| 20 |
|
| 21 |
For some Ubuntu releases, the toolchain can also be installed via |
| 22 |
Launchpad PPA at https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded. |
| 23 |
|
| 24 |
* Installing executables on Mac OS X * |
| 25 |
Unpack the tarball to the install directory, like this: |
| 26 |
$ cd $install_dir && tar xjf gcc-arm-none-eabi-*-yyyymmdd-mac.tar.bz2 |
| 27 |
|
| 28 |
* Installing executables on Windows * |
| 29 |
Run the installer (gcc-arm-none-eabi-*-yyyymmdd-win32.exe) and follow the |
| 30 |
instructions. |
| 31 |
|
| 32 |
The toolchain in windows zip package is a backup to windows installer for |
| 33 |
those who cannot run installer. We need decompress the zip package |
| 34 |
in a proper place and then invoke it following instructions in next section. |
| 35 |
|
| 36 |
* Invoking GCC * |
| 37 |
On Linux and Mac OS X, either invoke with the complete path like this: |
| 38 |
$ $install_dir/gcc-arm-none-eabi-*/bin/arm-none-eabi-gcc |
| 39 |
|
| 40 |
Or set path like this: |
| 41 |
$ export PATH=$PATH:$install_dir/gcc-arm-none-eabi-*/bin |
| 42 |
$ arm-none-eabi-gcc |
| 43 |
|
| 44 |
On Windows (although the above approaches also work), it can be more |
| 45 |
convenient to either have the installer register environment variables, or run |
| 46 |
INSTALL_DIR\bin\gccvar.bat to set environment variables for the current cmd. |
| 47 |
|
| 48 |
For windows zip package, after decompression we can invoke toolchain either with |
| 49 |
complete path like this: |
| 50 |
TOOLCHAIN_UNZIP_DIR\bin\arm-none-eabi-gcc |
| 51 |
or run TOOLCHAIN_UNZIP_DIR\bin\gccvar.bat to set environment variables for the |
| 52 |
current cmd. |
| 53 |
|
| 54 |
* Architecture options usage * |
| 55 |
|
| 56 |
This toolchain is built and optimized for Cortex-A/R/M bare metal development. |
| 57 |
the following table shows how to invoke GCC/G++ with correct command line |
| 58 |
options for variants of Cortex-A/R and Cortex-M architectures. |
| 59 |
|
| 60 |
-------------------------------------------------------------------- |
| 61 |
| ARM Core | Command Line Options | multilib | |
| 62 |
|----------|--------------------------------------------|----------| |
| 63 |
|Cortex-M0+| -mthumb -mcpu=cortex-m0plus | armv6-m | |
| 64 |
|Cortex-M0 | -mthumb -mcpu=cortex-m0 | | |
| 65 |
|Cortex-M1 | -mthumb -mcpu=cortex-m1 | | |
| 66 |
| |--------------------------------------------| | |
| 67 |
| | -mthumb -march=armv6-m | | |
| 68 |
|----------|--------------------------------------------|----------| |
| 69 |
|Cortex-M3 | -mthumb -mcpu=cortex-m3 | armv7-m | |
| 70 |
| |--------------------------------------------| | |
| 71 |
| | -mthumb -march=armv7-m | | |
| 72 |
|----------|--------------------------------------------|----------| |
| 73 |
|Cortex-M4 | -mthumb -mcpu=cortex-m4 | armv7e-m | |
| 74 |
|(No FP) |--------------------------------------------| | |
| 75 |
| | -mthumb -march=armv7e-m | | |
| 76 |
|----------|--------------------------------------------|----------| |
| 77 |
|Cortex-M4 | -mthumb -mcpu=cortex-m4 -mfloat-abi=softfp | armv7e-m | |
| 78 |
|(Soft FP) | -mfpu=fpv4-sp-d16 | /softfp | |
| 79 |
| |--------------------------------------------| | |
| 80 |
| | -mthumb -march=armv7e-m -mfloat-abi=softfp | | |
| 81 |
| | -mfpu=fpv4-sp-d16 | | |
| 82 |
|----------|--------------------------------------------|----------| |
| 83 |
|Cortex-M4 | -mthumb -mcpu=cortex-m4 -mfloat-abi=hard | armv7e-m | |
| 84 |
|(Hard FP) | -mfpu=fpv4-sp-d16 | /fpu | |
| 85 |
| |--------------------------------------------| | |
| 86 |
| | -mthumb -march=armv7e-m -mfloat-abi=hard | | |
| 87 |
| | -mfpu=fpv4-sp-d16 | | |
| 88 |
|----------|--------------------------------------------|----------| |
| 89 |
|Cortex-R4 | [-mthumb] -march=armv7-r | armv7-ar | |
| 90 |
|Cortex-R5 | | /thumb | |
| 91 |
|Cortex-R7 | | | |
| 92 |
|(No FP) | | | |
| 93 |
|----------|--------------------------------------------|----------| |
| 94 |
|Cortex-R4 | [-mthumb] -march=armv7-r -mfloat-abi=softfp| armv7-ar | |
| 95 |
|Cortex-R5 | -mfpu=vfpv3-d16 | /thumb | |
| 96 |
|Cortex-R7 | | /softfp | |
| 97 |
|(Soft FP) | | | |
| 98 |
|----------|--------------------------------------------|----------| |
| 99 |
|Cortex-R4 | [-mthumb] -march=armv7-r -mfloat-abi=hard | armv7-ar | |
| 100 |
|Cortex-R5 | -mfpu=vfpv3-d16 | /thumb | |
| 101 |
|Cortex-R7 | | /fpu | |
| 102 |
|(Hard FP) | | | |
| 103 |
|----------|--------------------------------------------|----------| |
| 104 |
|Cortex-A* | [-mthumb] -march=armv7-a | armv7-ar | |
| 105 |
|(No FP) | | /thumb | |
| 106 |
|----------|--------------------------------------------|----------| |
| 107 |
|Cortex-A* | [-mthumb] -march=armv7-a -mfloat-abi=softfp| armv7-ar | |
| 108 |
|(Soft FP) | -mfpu=vfpv3-d16 | /thumb | |
| 109 |
| | | /softfp | |
| 110 |
|----------|--------------------------------------------|----------| |
| 111 |
|Cortex-A* | [-mthumb] -march=armv7-a -mfloat-abi=hard | armv7-ar | |
| 112 |
|(Hard FP) | -mfpu=vfpv3-d16 | /thumb | |
| 113 |
| | | /fpu | |
| 114 |
-------------------------------------------------------------------- |
| 115 |
|
| 116 |
* C Libraries usage * |
| 117 |
|
| 118 |
This toolchain is released with two prebuilt C libraries based on newlib: |
| 119 |
one is the standard newlib and the other is newlib-nano for code size. |
| 120 |
To distinguish them, we rename the size optimized libraries as: |
| 121 |
|
| 122 |
libc.a --> libc_nano.a |
| 123 |
libg.a --> libg_nano.a |
| 124 |
|
| 125 |
To use newlib-nano, users should provide additional gcc link time option: |
| 126 |
--specs=nano.specs |
| 127 |
|
| 128 |
Nano.specs also handles two additional gcc libraries: libstdc++_nano.a and |
| 129 |
libsupc++_nano.a, which are optimized for code size. |
| 130 |
|
| 131 |
For example: |
| 132 |
$ arm-none-eabi-gcc src.c --specs=nano.specs $(OTHER_OPTIONS) |
| 133 |
|
| 134 |
This option can also work together with other specs options like |
| 135 |
--specs=rdimon.specs |
| 136 |
|
| 137 |
Please be noticed that --specs=nano.specs is a linker option. Be sure |
| 138 |
to include in linker option if compiling and linking are separated. |
| 139 |
|
| 140 |
** additional newlib-nano libraries usage |
| 141 |
|
| 142 |
Newlib-nano is different from newlib in addition to the libraries' name. |
| 143 |
Formatted input/output of floating-point number are implemented as weak symbol. |
| 144 |
If you want to use %f, you have to pull in the symbol by explicitly specifying |
| 145 |
"-u" command option. |
| 146 |
|
| 147 |
-u _scanf_float |
| 148 |
-u _printf_float |
| 149 |
|
| 150 |
e.g. to output a float, the command line is like: |
| 151 |
$ arm-none-eabi-gcc --specs=nano.specs -u _printf_float $(OTHER_LINK_OPTIONS) |
| 152 |
|
| 153 |
For more about the difference and usage, please refer the README.nano in the |
| 154 |
source package. |
| 155 |
|
| 156 |
Users can choose to use or not use semihosting by following instructions. |
| 157 |
** semihosting |
| 158 |
If you need semihosting, linking like: |
| 159 |
$ arm-none-eabi-gcc --specs=rdimon.specs $(OTHER_LINK_OPTIONS) |
| 160 |
|
| 161 |
** non-semihosting/retarget |
| 162 |
If you are using retarget, linking like: |
| 163 |
$ arm-none-eabi-gcc --specs=nosys.specs $(OTHER_LINK_OPTIONS) |
| 164 |
|
| 165 |
* GCC Plugin usage |
| 166 |
This release includes following Linux GCC plugins for additional performance |
| 167 |
optimization: |
| 168 |
|
| 169 |
** tree_switch_shortcut: optimize (Finite State Machine) FSM style program |
| 170 |
to reduce condition jump or indirect jumps. Usage: |
| 171 |
(GCC option) -fplugin=tree_switch_shortcut_elf |
| 172 |
|
| 173 |
Please be noticed that current GCC plugin can only run on Linux host. They |
| 174 |
are not available to Windows or Mac OS hosted GCC. |
| 175 |
|
| 176 |
* Linker scripts & startup code * |
| 177 |
|
| 178 |
Latest update of linker scripts template and startup code is available on |
| 179 |
http://www.arm.com/cmsis |
| 180 |
|
| 181 |
* Samples * |
| 182 |
Examples of all above usages are available at: |
| 183 |
/usr/share/doc/gcc-arm-none-eabi/examples |
| 184 |
|
| 185 |
Read readme.txt under it for further information. |
| 186 |
|
| 187 |
* GDB Server for CMSIS-DAP based hardware debugger * |
| 188 |
CMSIS-DAP is the interface firmware for a Debug Unit that connects |
| 189 |
the Debug Port to USB. More detailed information can be found at |
| 190 |
http://www.keil.com/support/man/docs/dapdebug/. |
| 191 |
|
| 192 |
A software GDB server is required for GDB to communicate with CMSIS-DAP based |
| 193 |
hardware debugger. The pyOCD is an implementation of such GDB server that is |
| 194 |
written in Python and under Apache License. |
| 195 |
|
| 196 |
For those who are using this toolchain and have board with CMSIS-DAP based |
| 197 |
debugger, the pyOCD is our recommended gdb server. |
| 198 |
More information can be found at https://github.com/mbedmicro/pyOCD. |
| 199 |
|
| 200 |
Currently pyOCD is still in development stage but has a quite active community. |
| 201 |
Reporting issues in either our Launchpad website or pyOCD community are welcomed. |