ARM EABI
From http://engineernabendu.blogspot.pt/2012/09/difference-of-compilers-arm-none-linux.html is told that the differences between GNUEABI and EABI are the following:
- arm-none-linux-gnueabi is meant for the compilation of ELF which uses linux
- arm-none-eabi is meant for the compilation of code which will run on bare metal arm core
ARM EABI Toolchain
Download Sourcery CodeBench Lite Edition following from http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/
Sourcery CodeBench Lite Edition for ARM GNU/Linux (TAR Source and documentation PDF files)
Sourcery CodeBench Lite Edition for ARM EABI (TAR Source and documentation PDF files)
ARM none eabi and Docs (http or https):
http://sourcery.mentor.com/GNUToolchain/doc16558/binutils.pdf
http://sourcery.mentor.com/GNUToolchain/doc16565/getting-started.pdf
ARM none linux gnueabi and Docs (http or https):
http://sourcery.mentor.com/GNUToolchain/doc16568/binutils.pdf
http://sourcery.mentor.com/GNUToolchain/doc16575/getting-started.pdf
Slackbuilds creation
The SlackBuilds is created based on the instructions available in http://www.slackwiki.com/Writing_A_SlackBuild_Script.
Run commands:
1 APPNAME=arm-gnueabi-toolchain
2 SOURCECODE=arm-2013.05-24-arm-none-linux-gnueabi.src.tar.bz2
3 cd /tmp
4 mkdir $APPNAME
5 cd $APPNAME
6 wget [[http://sourcery.mentor.com/GNUToolchain/package11446/public/arm-none-linux-gnueabi/arm-2013.05-24-arm-none-linux-gnueabi.src.tar.bz2]]
7 touch $APPNAME.SlackBuild
8 touch slack-desc
9 tar -xvif $SOURCECODE || exit 1
10 nano slack-desc #fill slack-desc
11 nano $APPNAME.SlackBuild #fill arm-gnueabi-toolchain.SlackBuild
12 chmod 755 $APPNAME.SlackBuild
13 ./$APPNAME.SlackBuild
14 installpkg /tmp/
Content of slack-desc
1 # HOW TO EDIT THIS FILE:
2 # The "handy ruler" below makes it easier to edit a package description. Line
3 # up the first '|' above the ':' following the base package name, and the '|' on
4 # the right side marks the last column you can put a character in. You must make
5 # exactly 11 lines for the formatting to be correct. It's also customary to
6 # leave one space after the ':'.
7
8 |-----handy-ruler------------------------------------------------------|
9 arm-gnueabi-toolchain: arm-gnueabi-toolchain - ARM Linux toolchain
10 arm-gnueabi-toolchain:
11 arm-gnueabi-toolchain: Complete development environment for embedded C/C++
12 arm-gnueabi-toolchain: development on ARM.
13 arm-gnueabi-toolchain:
14 arm-gnueabi-toolchain: Homepage: http://www.mentor.com/embedded-software
15 arm-gnueabi-toolchain: /sourcery-tools/sourcery-codebench/editions
16 arm-gnueabi-toolchain: /lite-edition/
17 arm-gnueabi-toolchain:
18 arm-gnueabi-toolchain:
19 arm-gnueabi-toolchain:
Content of arm-gnueabi-toolchain.SlackBuild
1 #!/bin/sh -e
2 #V.B. revision date 2013/07/01
3 #Set initial variables:
4 CWD=$(pwd)
5 if [ "$TMP" = "" ]; then
6 TMP=/tmp
7 fi
8
9 # The version which appears in the application's filename
10 VERSION=2013.05-24-arm-none-linux-gnueabi
11 # If the version conflicts with the Slackware package standard
12 # The dash character ("-") is not allowed in the VERSION string
13 # You can set the PKG_VERSION to something else than VERSION
14 PKG_VERSION=2013.05_24_arm_none_linux_gnueabi # the version which appears in the package name.
15 ARCH=${ARCH:-i486} # the architecture on which you want to build your package
16 # First digit is the build number, which specifies how many times it has been built.
17 # Second string is the short form of the authors name, typical three initials:w
18 BUILD=${BUILD:-1_SBo}
19 # The application's name
20 APP=arm
21 # The installation directory of the package (where its actual directory
22 # structure will be created)
23 PKG=$TMP/package-$APP
24
25 if [ "$ARCH" = "i486" ]; then
26 SLKCFLAGS="-O2 -march=i486 -mtune=i686"
27 elif [ "$ARCH" = "x86_64" ]; then
28 SLKCFLAGS="-O2 -fPIC"
29 fi
30
31 # Delete the leftover directories if they exist (due to a previous build)
32 # and (re)create the packaging directory
33 rm -rf $PKG
34 mkdir -p $TMP $PKG
35 rm -rf $TMP/$APP-$VERSION
36
37 # Change to the TMP directory
38 cd $TMP || exit 1
39
40 # Extract the application source in TMP
41 # Note: if your application comes as a tar.bz2, you need tar -jxvf
42 tar -xvif $CWD/$APP-$VERSION.src.tar.bz2 || exit 1
43
44 # Change to the application source directory
45 cd $APP-$VERSION || exit 1
46
47 # Change ownership and permissions if necessary
48 # This may not be needed in some source tarballs, but it never hurts
49 chown -R root:root .
50 chmod -R u+w,go+r-w,a-s .
51
52 # clean the source, but exit if anything goes wrong
53 make clean || exit
54
55 # compile the source, but exit if anything goes wrong
56 make || exit
57
58 # Install everything into the package directory, but exit if anything goes wrong
59 make install DESTDIR=$PKG || exit
60
61 # Create a directory for documentation
62 mkdir -p $PKG/usr/doc/$APP-$VERSION
63
64 # Copy documentation to the docs directory and fix permissions
65 cp -a AUTHORS BUGS COPYING Changelog FAQ INSTALL README TODO $PKG/usr/doc/$APP-$VERSION
66 find $PKG/usr/doc/$APP-$VERSION -type f -exec chmod 644 {} \;
67 # slackbuild copy
68 cat $CWD/$APP.SlackBuild > $PKG/usr/doc/$APP-$VERSION/$APP.SlackBuild
69
70 echo "Create the ./install directory and copy the slack-desc into it"
71 mkdir -p $PKG/install
72 cat $CWD/slack-desc > $PKG/install/slack-desc
73
74 echo "Add doinst.sh to package (if it exists)"
75 if [ -e $CWD/doinst.sh.gz ]; then
76 zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
77 fi
78
79 echo "Strip some libraries and binaries"
80 ( cd $PKG
81 find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
82 find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
83 )
84
85 echo "Compress man pages if they exist"
86 if [ -d $PKG/usr/man ]; then
87 ( cd $PKG/usr/man
88 find . -type f -exec gzip -9 {} \;
89 for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
90 )
91 fi
92
93 echo "Compress info pages if they exist (and remove the dir file)"
94 if [ -d $PKG/usr/info ]; then
95 gzip -9 $PKG/usr/info/*.info
96 rm -f $PKG/usr/info/dir
97 fi
98
99 echo "Build the package"
100 cd $PKG
101 /sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD.tgz
ARM compiler and emulator on a Lucid32 Vagrant box
Install ARM EABI toolchain
Start Vagrant for Lucid32 box.
Based on http://www.cnx-software.com/2012/01/16/installing-emdebian-arm-cross-toolchain-in-debian/.
Edit /etc/apt/sources.list with only:
Run the following commands:
1 apt-get update
2 apt-get install emdebian-archive-keyring
3 apt-get install linux-libc-dev-armel-cross
4 apt-get install libc6-armel-cross
5 apt-get install libc6-dev-armel-cross
6 apt-get install binutils-arm-linux-gnueabi
7 apt-get install gcc-4.4-arm-linux-gnueabi
8 apt-get install g++-4.4-arm-linux-gnueabi
9 apt-get install pdebuild-cross
10 apt-get install dpkg-cross
11 apt-get install qemu
Test the compiler
As in http://wiki.debian.org/BuildingCrossCompilers#Test_compilation.
Compile and run statically linked:
Compile and run dynamically linked:
1 arm-linux-gnueabi-gcc hello.c -o hello
2 file hello #hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
3 qemu-arm hello #/lib/ld-linux.so.3: No such file or directory
4 qemu-arm -L /usr/arm-linux-gnueabi/ hello #Hello cross-compiling world!
5
Basic cross compilation http://www.gumstix.org/basic-cross-compilation.html
1 wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.5.tar.xz
Build GSL for ARM on emdebian
Vagrant, change Vagrantfile to SSH listen on 0.0.0.0
Change Vagrantfile
1 config.vm.network :forwarded_port, guest: 22, host: 2222, host_ip: "0.0.0.0", id: "ssh", auto_correct: true