Project

General

Profile

GnuArmToolchain » History » Version 19

unrznbl, 02/26/2021 04:32 AM
s/libmfr/libmpfr/

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 19 unrznbl
Note: you maybe have to adjust some libncurses and libmpfr version numbers in the above for newer distributions (as of 2021). Use apt-cache search to figure it out.
35 18 unrznbl
36 1 steve-m
37 13 ahuemer
h3. Preparation
38
39
40 1 steve-m
Open a shell in the directory of gnu-arm-build.sh and create the following directories:
41
42 13 ahuemer
<pre>
43 1 steve-m
$ mkdir build install src
44 13 ahuemer
</pre>
45 1 steve-m
46
Download the needed sources to src/:
47
48 13 ahuemer
<pre>
49 6 steve-m
$ cd src/
50 1 steve-m
$ wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
51
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.1a.tar.bz2
52
$ wget ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz
53 13 ahuemer
</pre>
54 1 steve-m
55 17 unrznbl
On Ubuntu 18.04 and Debian 10, tweak the build script such that it applies attachment:gcc-4.8.2-ubuntu-18-04.diff after unpacking gcc sources.
56 12 ahuemer
57 13 ahuemer
h3. Building the toolchain
58
59
60
<pre>
61 1 steve-m
$ cd ..
62
$ ./gnu-arm-build.3.sh 
63
I will build an arm-none-eabi cross-compiler:
64
65
  Prefix: <YOURPATH>/install
66
  Sources: <YOURPATH>/src
67
  Build files: <YOURPATH>/build
68
69
Press ^C now if you do NOT want to do this.
70 13 ahuemer
</pre>
71 1 steve-m
72
Hit enter and after some time hopefully end up with:
73
74 13 ahuemer
<pre>
75 1 steve-m
Build complete! Add <YOURPATH>/bin to your PATH to make arm-none-eabi-gcc and friends
76
accessible directly.
77 13 ahuemer
</pre>
78 12 ahuemer
79 13 ahuemer
h3. Making it accessible
80
81
82 1 steve-m
If you're using bash, you can add the following in your ~/.bashrc file:
83
84 13 ahuemer
<pre>
85 1 steve-m
export PATH=$PATH:<YOURPATH>/install/bin
86 13 ahuemer
</pre>
87 1 steve-m
88 14 laforge
That's it. You can build [[OsmocomBB]] now (see [[Software Getting Started]]).
89 1 steve-m
90 13 ahuemer
*Credits:*
91 1 steve-m
92 13 ahuemer
This script is a slightly updated/modified version of the script found "here":http://hobbycode.googlecode.com/svn/trunk/gnu-arm-installer/. 
93
94 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)