= 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/package11441/public/arm-none-eabi/arm-2013.05-23-arm-none-eabi.src.tar.bz2]] * [[http://sourcery.mentor.com/GNUToolchain/doc16559/as.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16558/binutils.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16566/libc.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16562/gcc.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16564/gdb.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16565/getting-started.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16560/ld.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16567/libm.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16563/cpp.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16561/gprof.pdf]] ARM none linux gnueabi and Docs (http or https): * [[http://sourcery.mentor.com/GNUToolchain/package11446/public/arm-none-linux-gnueabi/arm-2013.05-24-arm-none-linux-gnueabi.src.tar.bz2]] * [[http://sourcery.mentor.com/GNUToolchain/doc16569/as.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16568/binutils.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16576/libc.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16572/gcc.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16574/gdb.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16575/getting-started.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16570/ld.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16573/cpp.pdf]] * [[http://sourcery.mentor.com/GNUToolchain/doc16571/gprof.pdf]] == Slackbuilds creation == The SlackBuilds is created based on the instructions available in http://www.slackwiki.com/Writing_A_SlackBuild_Script. Run commands: {{{#!highlight sh APPNAME=arm-gnueabi-toolchain SOURCECODE=arm-2013.05-24-arm-none-linux-gnueabi.src.tar.bz2 cd /tmp mkdir $APPNAME cd $APPNAME wget [[http://sourcery.mentor.com/GNUToolchain/package11446/public/arm-none-linux-gnueabi/arm-2013.05-24-arm-none-linux-gnueabi.src.tar.bz2]] touch $APPNAME.SlackBuild touch slack-desc tar -xvif $SOURCECODE || exit 1 nano slack-desc #fill slack-desc nano $APPNAME.SlackBuild #fill arm-gnueabi-toolchain.SlackBuild chmod 755 $APPNAME.SlackBuild ./$APPNAME.SlackBuild installpkg /tmp/ }}} Content of slack-desc {{{#!highlight bash # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' on # the right side marks the last column you can put a character in. You must make # exactly 11 lines for the formatting to be correct. It's also customary to # leave one space after the ':'. |-----handy-ruler------------------------------------------------------| arm-gnueabi-toolchain: arm-gnueabi-toolchain - ARM Linux toolchain arm-gnueabi-toolchain: arm-gnueabi-toolchain: Complete development environment for embedded C/C++ arm-gnueabi-toolchain: development on ARM. arm-gnueabi-toolchain: arm-gnueabi-toolchain: Homepage: http://www.mentor.com/embedded-software arm-gnueabi-toolchain: /sourcery-tools/sourcery-codebench/editions arm-gnueabi-toolchain: /lite-edition/ arm-gnueabi-toolchain: arm-gnueabi-toolchain: arm-gnueabi-toolchain: }}} Content of arm-gnueabi-toolchain.SlackBuild {{{#!highlight bash #!/bin/sh -e #V.B. revision date 2013/07/01 #Set initial variables: CWD=$(pwd) if [ "$TMP" = "" ]; then TMP=/tmp fi # The version which appears in the application's filename VERSION=2013.05-24-arm-none-linux-gnueabi # If the version conflicts with the Slackware package standard # The dash character ("-") is not allowed in the VERSION string # You can set the PKG_VERSION to something else than VERSION PKG_VERSION=2013.05_24_arm_none_linux_gnueabi # the version which appears in the package name. ARCH=${ARCH:-i486} # the architecture on which you want to build your package # First digit is the build number, which specifies how many times it has been built. # Second string is the short form of the authors name, typical three initials:w BUILD=${BUILD:-1_SBo} # The application's name APP=arm # The installation directory of the package (where its actual directory # structure will be created) PKG=$TMP/package-$APP if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" fi # Delete the leftover directories if they exist (due to a previous build) # and (re)create the packaging directory rm -rf $PKG mkdir -p $TMP $PKG rm -rf $TMP/$APP-$VERSION # Change to the TMP directory cd $TMP || exit 1 # Extract the application source in TMP # Note: if your application comes as a tar.bz2, you need tar -jxvf tar -xvif $CWD/$APP-$VERSION.src.tar.bz2 || exit 1 # Change to the application source directory cd $APP-$VERSION || exit 1 # Change ownership and permissions if necessary # This may not be needed in some source tarballs, but it never hurts chown -R root:root . chmod -R u+w,go+r-w,a-s . # clean the source, but exit if anything goes wrong make clean || exit # compile the source, but exit if anything goes wrong make || exit # Install everything into the package directory, but exit if anything goes wrong make install DESTDIR=$PKG || exit # Create a directory for documentation mkdir -p $PKG/usr/doc/$APP-$VERSION # Copy documentation to the docs directory and fix permissions cp -a AUTHORS BUGS COPYING Changelog FAQ INSTALL README TODO $PKG/usr/doc/$APP-$VERSION find $PKG/usr/doc/$APP-$VERSION -type f -exec chmod 644 {} \; # slackbuild copy cat $CWD/$APP.SlackBuild > $PKG/usr/doc/$APP-$VERSION/$APP.SlackBuild echo "Create the ./install directory and copy the slack-desc into it" mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc echo "Add doinst.sh to package (if it exists)" if [ -e $CWD/doinst.sh.gz ]; then zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh fi echo "Strip some libraries and binaries" ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) echo "Compress man pages if they exist" if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done ) fi echo "Compress info pages if they exist (and remove the dir file)" if [ -d $PKG/usr/info ]; then gzip -9 $PKG/usr/info/*.info rm -f $PKG/usr/info/dir fi echo "Build the package" cd $PKG /sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD.tgz }}} ## page was renamed from EmdebianLucid32 == 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: {{{#!highlight sh # comment all the other Ubuntu lines deb http://www.emdebian.org/debian/ squeeze main deb http://ftp.pt.debian.org/debian squeeze main contrib non-free deb http://security.debian.org/ squeeze/updates main contrib non-free }}} Run the following commands: {{{#!highlight sh apt-get update apt-get install emdebian-archive-keyring apt-get install linux-libc-dev-armel-cross apt-get install libc6-armel-cross apt-get install libc6-dev-armel-cross apt-get install binutils-arm-linux-gnueabi apt-get install gcc-4.4-arm-linux-gnueabi apt-get install g++-4.4-arm-linux-gnueabi apt-get install pdebuild-cross apt-get install dpkg-cross apt-get install qemu }}} === Test the compiler === As in [[http://wiki.debian.org/BuildingCrossCompilers#Test_compilation]]. {{{#!highlight c #include int main() { printf("Hello cross-compiling world!\n"); return 0; } }}} Compile and run statically linked: {{{#!highlight sh arm-linux-gnueabi-gcc -static hello.c -o hello file hello #hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.18, not stripped qemu-arm hello #Hello cross-compiling world! }}} Compile and run dynamically linked: {{{#!highlight sh arm-linux-gnueabi-gcc hello.c -o hello 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 qemu-arm hello #/lib/ld-linux.so.3: No such file or directory qemu-arm -L /usr/arm-linux-gnueabi/ hello #Hello cross-compiling world! }}} Basic cross compilation http://www.gumstix.org/basic-cross-compilation.html {{{#!highlight sh wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.5.tar.xz }}} == Build GSL for ARM on emdebian == {{{#!highlight sh mkdir -p /usr/local/arm cp gsl-1.16.tar.gz /tmp cd /tmp tar xvzf gsl-1.16.tar.gz cd gsl-1.16 ./configure --prefix=/usr/local/arm --exec-prefix=/usr/local/arm CC=arm-linux-gnueabi-gcc --host armv5 --target arm-linux-gnueabi make clean; make; make install }}} == Vagrant, change Vagrantfile to SSH listen on 0.0.0.0 == Change Vagrantfile {{{#!highlight sh config.vm.network :forwarded_port, guest: 22, host: 2222, host_ip: "0.0.0.0", id: "ssh", auto_correct: true }}}