Project

General

Profile

GnuArmToolchain » History » Version 16

stsp, 08/23/2018 11:55 AM

1 1 steve-m
2 13 ahuemer
h2. GNU ARM toolchain
3 13 ahuemer
4 13 ahuemer
5 1 steve-m
This page will describe the procedure for compiling a GNU ARM toolchain.
6 1 steve-m
We will build a toolchain consisting of:
7 12 ahuemer
8 13 ahuemer
* GCC 4.8.2
9 13 ahuemer
* Binutils 2.21.1
10 13 ahuemer
* Newlib 1.19
11 1 steve-m
12 1 steve-m
13 13 ahuemer
h3. Getting the buildscript
14 13 ahuemer
15 13 ahuemer
16 1 steve-m
First of all, create a directory you want to use for building the toolchain, and download the buildscript [raw-attachment:gnu-arm-build.3.sh] there.
17 1 steve-m
You will need to make it executable:
18 1 steve-m
19 13 ahuemer
<pre>
20 1 steve-m
$ chmod +x gnu-arm-build.3.sh
21 13 ahuemer
</pre>
22 1 steve-m
23 1 steve-m
24 13 ahuemer
h3. Dependencies
25 13 ahuemer
26 13 ahuemer
27 1 steve-m
In order to build the toolchain, you will need to install the following packages (assuming you're using a Debian-based distribution):
28 1 steve-m
29 13 ahuemer
<pre>
30 10 vogelchr
$ sudo apt-get install build-essential libgmp3-dev libmpfr-dev libx11-6 libx11-dev texinfo flex bison libncurses5 \
31 1 steve-m
  libncurses5-dbg libncurses5-dev libncursesw5 libncursesw5-dbg libncursesw5-dev zlibc zlib1g-dev libmpfr4 libmpc-dev
32 13 ahuemer
</pre>
33 1 steve-m
34 1 steve-m
35 13 ahuemer
h3. Preparation
36 13 ahuemer
37 13 ahuemer
38 1 steve-m
Open a shell in the directory of gnu-arm-build.sh and create the following directories:
39 1 steve-m
40 13 ahuemer
<pre>
41 1 steve-m
$ mkdir build install src
42 13 ahuemer
</pre>
43 1 steve-m
44 1 steve-m
Download the needed sources to src/:
45 1 steve-m
46 13 ahuemer
<pre>
47 6 blombo
$ cd src/
48 1 steve-m
$ wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
49 1 steve-m
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.1a.tar.bz2
50 1 steve-m
$ wget ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz
51 13 ahuemer
</pre>
52 1 steve-m
53 16 stsp
On Ubuntu 18.04, tweak the build script such that it applies attachment:gcc-4.8.2-ubuntu-18-04.diff after unpacking gcc sources.
54 12 ahuemer
55 13 ahuemer
h3. Building the toolchain
56 13 ahuemer
57 13 ahuemer
58 13 ahuemer
<pre>
59 1 steve-m
$ cd ..
60 1 steve-m
$ ./gnu-arm-build.3.sh 
61 1 steve-m
I will build an arm-none-eabi cross-compiler:
62 1 steve-m
63 1 steve-m
  Prefix: <YOURPATH>/install
64 1 steve-m
  Sources: <YOURPATH>/src
65 1 steve-m
  Build files: <YOURPATH>/build
66 1 steve-m
67 1 steve-m
Press ^C now if you do NOT want to do this.
68 13 ahuemer
</pre>
69 1 steve-m
70 1 steve-m
Hit enter and after some time hopefully end up with:
71 1 steve-m
72 13 ahuemer
<pre>
73 1 steve-m
Build complete! Add <YOURPATH>/bin to your PATH to make arm-none-eabi-gcc and friends
74 1 steve-m
accessible directly.
75 13 ahuemer
</pre>
76 12 ahuemer
77 13 ahuemer
h3. Making it accessible
78 13 ahuemer
79 13 ahuemer
80 1 steve-m
If you're using bash, you can add the following in your ~/.bashrc file:
81 1 steve-m
82 13 ahuemer
<pre>
83 1 steve-m
export PATH=$PATH:<YOURPATH>/install/bin
84 13 ahuemer
</pre>
85 1 steve-m
86 14 laforge
That's it. You can build [[OsmocomBB]] now (see [[Software Getting Started]]).
87 1 steve-m
88 13 ahuemer
*Credits:*
89 1 steve-m
90 13 ahuemer
This script is a slightly updated/modified version of the script found "here":http://hobbycode.googlecode.com/svn/trunk/gnu-arm-installer/. 
91 13 ahuemer
92 1 steve-m
The original version also builds Insight, but since we don't need that, we won't build it. If you want to, just remove the comments in the shellscript.
Add picture from clipboard (Maximum size: 48.8 MB)