Project

General

Profile

GnuArmToolchain » History » Revision 16

Revision 15 (stsp, 08/23/2018 11:53 AM) → Revision 16/19 (stsp, 08/23/2018 11:55 AM)

 
 h2. GNU ARM toolchain 


 This page will describe the procedure for compiling a GNU ARM toolchain. 
 We will build a toolchain consisting of: 

 * GCC 4.8.2 
 * Binutils 2.21.1 
 * Newlib 1.19 


 h3. Getting the buildscript 


 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. 
 You will need to make it executable: 

 <pre> 
 $ chmod +x gnu-arm-build.3.sh 
 </pre> 


 h3. Dependencies 


 In order to build the toolchain, you will need to install the following packages (assuming you're using a Debian-based distribution): 

 <pre> 
 $ sudo apt-get install build-essential libgmp3-dev libmpfr-dev libx11-6 libx11-dev texinfo flex bison libncurses5 \ 
   libncurses5-dbg libncurses5-dev libncursesw5 libncursesw5-dbg libncursesw5-dev zlibc zlib1g-dev libmpfr4 libmpc-dev 
 </pre> 


 h3. Preparation 


 Open a shell in the directory of gnu-arm-build.sh and create the following directories: 

 <pre> 
 $ mkdir build install src 
 </pre> 

 Download the needed sources to src/: 

 <pre> 
 $ cd src/ 
 $ wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2 
 $ wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.1a.tar.bz2 
 $ wget ftp://sources.redhat.com/pub/newlib/newlib-1.19.0.tar.gz 
 </pre> 

 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. 

 


 h3. Building the toolchain 


 <pre> 
 $ cd .. 
 $ ./gnu-arm-build.3.sh  
 I will build an arm-none-eabi cross-compiler: 

   Prefix: <YOURPATH>/install 
   Sources: <YOURPATH>/src 
   Build files: <YOURPATH>/build 

 Press ^C now if you do NOT want to do this. 
 </pre> 

 Hit enter and after some time hopefully end up with: 

 <pre> 
 Build complete! Add <YOURPATH>/bin to your PATH to make arm-none-eabi-gcc and friends 
 accessible directly. 
 </pre> 

 h3. Making it accessible 


 If you're using bash, you can add the following in your ~/.bashrc file: 

 <pre> 
 export PATH=$PATH:<YOURPATH>/install/bin 
 </pre> 

 That's it. You can build [[OsmocomBB]] now (see [[Software Getting Started]]). 

 *Credits:* 

 This script is a slightly updated/modified version of the script found "here":http://hobbycode.googlecode.com/svn/trunk/gnu-arm-installer/.  

 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)