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
4
5 1 steve-m
This page will describe the procedure for compiling a GNU ARM toolchain.
6
We will build a toolchain consisting of:
7 12 ahuemer
8 13 ahuemer
* GCC 4.8.2
9
* Binutils 2.21.1
10
* Newlib 1.19
11 1 steve-m
12
13 13 ahuemer
h3. Getting the buildscript
14
15
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
You will need to make it executable:
18
19 13 ahuemer
<pre>
20 1 steve-m
$ chmod +x gnu-arm-build.3.sh
21 13 ahuemer
</pre>
22 1 steve-m
23
24 13 ahuemer
h3. Dependencies
25
26
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
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
35 13 ahuemer
h3. Preparation
36
37
38 1 steve-m
Open a shell in the directory of gnu-arm-build.sh and create the following directories:
39
40 13 ahuemer
<pre>
41 1 steve-m
$ mkdir build install src
42 13 ahuemer
</pre>
43 1 steve-m
44
Download the needed sources to src/:
45
46 13 ahuemer
<pre>
47 6 steve-m
$ cd src/
48 1 steve-m
$ wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
49
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.1a.tar.bz2
50
$ 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
57
58
<pre>
59 1 steve-m
$ cd ..
60
$ ./gnu-arm-build.3.sh 
61
I will build an arm-none-eabi cross-compiler:
62
63
  Prefix: <YOURPATH>/install
64
  Sources: <YOURPATH>/src
65
  Build files: <YOURPATH>/build
66
67
Press ^C now if you do NOT want to do this.
68 13 ahuemer
</pre>
69 1 steve-m
70
Hit enter and after some time hopefully end up with:
71
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
accessible directly.
75 13 ahuemer
</pre>
76 12 ahuemer
77 13 ahuemer
h3. Making it accessible
78
79
80 1 steve-m
If you're using bash, you can add the following in your ~/.bashrc file:
81
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
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)