[FE training-materials-updates] sysdev: switch to an EABIhf toolchain

Alexandre Belloni alexandre.belloni at free-electrons.com
Thu Jul 24 18:12:23 CEST 2014

Repository : git://git.free-electrons.com/training-materials.git

On branch  : sysdev-xplained
Link       : http://git.free-electrons.com/training-materials/commit/?id=d76bc148c77078df84ad151a7a66282ad3ed502c


commit d76bc148c77078df84ad151a7a66282ad3ed502c
Author: Alexandre Belloni <alexandre.belloni at free-electrons.com>
Date:   Thu Jul 24 17:02:23 2014 +0200

    sysdev: switch to an EABIhf toolchain
    This also imply switching to a recent buildroot release.
    Signed-off-by: Alexandre Belloni <alexandre.belloni at free-electrons.com>


 .../sysdev-application-debugging.tex               |    4 +-
 labs/sysdev-buildroot/sysdev-buildroot.tex         |   17 +++--
 labs/sysdev-real-time/sysdev-real-time.tex         |    4 +-
 labs/sysdev-thirdparty/sysdev-thirdparty.tex       |   67 ++++++++++++++++----
 labs/sysdev-toolchain/sysdev-toolchain.tex         |   32 ++++++----
 5 files changed, 89 insertions(+), 35 deletions(-)

diff --git a/labs/sysdev-application-debugging/sysdev-application-debugging.tex b/labs/sysdev-application-debugging/sysdev-application-debugging.tex
index 946dbf4..d967db8 100644
--- a/labs/sysdev-application-debugging/sysdev-application-debugging.tex
+++ b/labs/sysdev-application-debugging/sysdev-application-debugging.tex
@@ -132,8 +132,8 @@ your workstation. This is done by setting GDB \code{sysroot} variable
 (on one line):
-(gdb) set sysroot /usr/local/xtools/arm-unknown-linux-uclibcgnueabi/
+(gdb) set sysroot /usr/local/xtools/arm-unknown-linux-uclibcgnueabihf/
 And tell gdb to connect to the remote system:
diff --git a/labs/sysdev-buildroot/sysdev-buildroot.tex b/labs/sysdev-buildroot/sysdev-buildroot.tex
index 3f19403..15c01aa 100644
--- a/labs/sysdev-buildroot/sysdev-buildroot.tex
+++ b/labs/sysdev-buildroot/sysdev-buildroot.tex
@@ -12,7 +12,7 @@ kernel image.
 \section{Get Buildroot and explore the source code}
 The official Buildroot website is available at
-\url{http://buildroot.org/}. Download the latest stable 2013.08.x
+\url{http://buildroot.org/}. Download the latest stable 2014.05.x
 version which we have tested for this lab. Uncompress the tarball
 and go inside the Buildroot source directory.
@@ -66,18 +66,25 @@ make menuconfig
 Set the following options:
-\item \code{Target Architecture}: \code{ARM (little endian)}
-\item \code{Target Architecture Variant}: \code{cortex-A5}
+\item \code{Target options}
+  \begin{itemize}
+  \item \code{Target Architecture}: \code{ARM (little endian)}
+  \item \code{Target Architecture Variant}: \code{cortex-A5}
+  \item \code{Target ABI}: \code{EABIhf}
+  \item \code{Floating point strategy}: \code{VFPv4-D16}
+  \end{itemize}
 \item \code{Toolchain}
   \item \code{Toolchain type}: \code{External toolchain}
   \item \code{Toolchain}: \code{Custom toolchain}
   \item \code{Toolchain path}: use the toolchain you built:
-    \code{/usr/local/xtools/arm-unknown-linux-uclibcgnueabi}
+    \code{/usr/local/xtools/arm-unknown-linux-uclibcgnueabihf}
+  \item \code{External toolchain kernel headers series}: \code{3.10.x}
   \item \code{External toolchain C library}: \code{uClibc}
   \item We must tell Buildroot about our toolchain configuration, so:
     enable \code{Toolchain has large file support?}, \code{Toolchain has
-    RPC support?}, and \code{Toolchain has C++ support?}.
+    WCHAR support?}, \code{Toolchain has SSP support?} and
+    \code{Toolchain has C++ support?}.
     Buildroot will check these parameters anyway.
 \item \code{Target packages}
diff --git a/labs/sysdev-real-time/sysdev-real-time.tex b/labs/sysdev-real-time/sysdev-real-time.tex
index 4fb2193..7e83fe4 100644
--- a/labs/sysdev-real-time/sysdev-real-time.tex
+++ b/labs/sysdev-real-time/sysdev-real-time.tex
@@ -119,7 +119,7 @@ resolution of the \code{CLOCK_MONOTONIC} clock.
 Now compile this program:
-arm-none-linux-gnueabi-gcc -o rttest rttest.c -lrt
+arm-none-linux-gnueabihf-gcc -o rttest rttest.c -lrt
 Execute the program on the board. Is the clock resolution good or bad?
@@ -222,7 +222,7 @@ compile \code{rttest} for the Xenomai POSIX skin:
 cd $HOME/felabs/realtime/rttest/nfsroot/root
 export PATH=$HOME/felabs/realtime/rttest/buildroot-2014.05/output/host/usr/bin:$PATH
-arm-none-linux-gnueabi-gcc -o rttest rttest.c $(pkg-config --libs --cflags libxenomai_posix)
+arm-none-linux-gnueabihf-gcc -o rttest rttest.c $(pkg-config --libs --cflags libxenomai_posix)
diff --git a/labs/sysdev-thirdparty/sysdev-thirdparty.tex b/labs/sysdev-thirdparty/sysdev-thirdparty.tex
index fc26295..875e180 100644
--- a/labs/sysdev-thirdparty/sysdev-thirdparty.tex
+++ b/labs/sysdev-thirdparty/sysdev-thirdparty.tex
@@ -372,7 +372,7 @@ to do:
 configure:7130: checking for libasound headers version >= 1.0.27
-configure:7192: arm-linux-gnueabi-gcc -c -g -O2  conftest.c >&5
+configure:7192: arm-linux-gnueabihf-gcc -c -g -O2  conftest.c >&5
 conftest.c:15:28: fatal error: alsa/asoundlib.h: No such file or directory
@@ -433,9 +433,9 @@ Let's also specify the prefix, so that the library is compiled to be
 installed in \code{/usr} and not \code{/usr/local}:
- LDFLAGS=-L$HOME/felabs/sysdev/thirdparty/staging/usr/lib \
- CPPFLAGS=-I$HOME/felabs/sysdev/thirdparty/staging/usr/include \
- CC=arm-linux-gcc \
+LDFLAGS=-L$HOME/felabs/sysdev/thirdparty/staging/usr/lib \
+CPPFLAGS=-I$HOME/felabs/sysdev/thirdparty/staging/usr/include \
+CC=arm-linux-gcc \
 ./configure --host=arm-linux --prefix=/usr
@@ -451,10 +451,11 @@ just like we built alsa-lib. We will also need to disable the xmlto
 support that generates the documentation.
- LDFLAGS=-L$HOME/felabs/sysdev/thirdparty/staging/usr/lib \
- CPPFLAGS=-I$HOME/felabs/sysdev/thirdparty/staging/usr/include \
- CC=arm-linux-gcc \
-./configure --host=arm-linux --prefix=/usr --disable-alsamixer --disable-xmlto
+LDFLAGS=-L$HOME/felabs/sysdev/thirdparty/staging/usr/lib \
+CPPFLAGS=-I$HOME/felabs/sysdev/thirdparty/staging/usr/include \
+CC=arm-linux-gcc \
+./configure --host=arm-linux --prefix=/usr \
+--disable-alsamixer --disable-xmlto
 Then, run the compilation with make. Hopefully, it works!
@@ -557,9 +558,9 @@ arm-linux-strip target/usr/bin/a*
 arm-linux-strip target/usr/bin/speaker-test
 arm-linux-strip target/usr/sbin/alsactl
+mkdir -p target/usr/share/alsa/pcm
 cp -a staging/usr/share/alsa/alsa.conf* target/usr/share/alsa
 cp -a staging/usr/share/alsa/cards target/usr/share/alsa
-mkdir target/usr/share/alsa/pcm
 cp -a staging/usr/share/alsa/pcm/default.conf target/usr/share/alsa/pcm
@@ -615,12 +616,26 @@ is very easy, and almost identical to what we've seen with the
 alsa-utils. First, the configure step:
-LDFLAGS=-L$HOME/felabs/sysdev/thirdparty/staging/usr/lib \
-CPPFLAGS=-I$HOME/felabs/sysdev/thirdparty/staging/usr/include \
 CC=arm-linux-gcc \
 ./configure --host=arm-linux --prefix=/usr
+It will fail with:
+configure: error: Ogg >= 1.0 required !
+By running \code{./configure --help}, you will find the
+\code{--with-ogg-libraries} and \code{--with-ogg-includes} options.
+Use those:
+CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/usr \
+  --with-ogg-includes=$HOME/felabs/sysdev/thirdparty/staging/usr/include \
+  --with-ogg-libraries=$HOME/felabs/sysdev/thirdparty/staging/usr/lib
 Then, compile the library:
@@ -815,12 +830,38 @@ make
 It should fail rather quickly, complaining that the curl headers are
 missing. This is because the configure script, in curl's case, didn't
-actually test wether it was available or not, but just assumed it was.
+actually test whether it was available or not, but just assumed it was.
+It may also fail with the following cryptic message:
+if arm-linux-gcc -DSYSCONFDIR=\"/usr/etc\" -DLOCALEDIR=\"/usr/share/locale\"
+ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include -I../include -I../intl
+ -I/home/ubuntu/felabs/sysdev/thirdparty/staging/usr/include  -O2 -Wall
+ -ffast-math -fsigned-char -g -O2 -MT audio.o -MD -MP -MF ".deps/audio.Tpo"
+ -c -o audio.o audio.c; \
+	then mv -f ".deps/audio.Tpo" ".deps/audio.Po"; else rm -f ".deps/audio.Tpo"; exit 1; fi
+In file included from /usr/include/stdio.h:28:0,
+                 from audio.c:22:
+/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
+ #include <bits/predefs.h>
+                          ^
+compilation terminated.
+make[2]: *** [audio.o] Error 1
+make[2]: Leaving directory `/home/ubuntu/felabs/sysdev/thirdparty/vorbis-tools-1.4.0/ogg123'
+make[1]: *** [all-recursive] Error 1
+make[1]: Leaving directory `/home/ubuntu/felabs/sysdev/thirdparty/vorbis-tools-1.4.0'
+make: *** [all] Error 2
+You can notice that \code{/usr/include} is added to the include paths.
+Again, this is not what we want because it contains includes for the
+host, not the target. It is coming from the autodetected value for
 Add the \code{--without-curl} option to the configure invocation,
 restart the compilation.
-The compilation should then fail with an error related to libm. While
+The compilation may then fail with an error related to libm. While
 the code uses the function from this library, the generated Makefile
 doesn't give the right command line argument in order to link against
 the libm.
diff --git a/labs/sysdev-toolchain/sysdev-toolchain.tex b/labs/sysdev-toolchain/sysdev-toolchain.tex
index 560c4bb..16eb140 100644
--- a/labs/sysdev-toolchain/sysdev-toolchain.tex
+++ b/labs/sysdev-toolchain/sysdev-toolchain.tex
@@ -26,9 +26,16 @@ sudo apt-get install autoconf automake libtool libexpat1-dev \
 \section{Getting Crosstool-ng}
-Get the latest 1.19.x release of Crosstool-ng at
-\url{http://crosstool-ng.org}. Expand the archive right in the current
-directory, and enter the Crosstool-ng source directory.
+We will need a recent version of Crosstool-ng for this lab, including
+code that is not part of a release yet so we will use git to download
+git clone http://crosstool-ng.org/git/crosstool-ng
+cd crosstool-ng/
+git checkout 1a8ca5b41be6
+patch -p1 < ../0001-samples-add-arm-cortexa5-linux-uclibcgnueabihf.patch
 \section{Installing Crosstool-ng}
@@ -38,6 +45,7 @@ solution. As documented in
 \code{docs/2\ -\ Installing\ crosstool-NG.txt}, do:
 ./configure --enable-local
 make install
@@ -59,10 +67,11 @@ Crosstool-ng comes with a set of ready-made configuration files for
 various typical setups: Crosstool-ng calls them {\em samples}. They can be
 listed by using \code{./ct-ng list-samples}.
-We will use the arm-unknown-linux-uclibcgnueabi sample. It can be loaded by issuing:
+We will use the \code{arm-cortexa5-linux-uclibcgnueabihf} sample. It
+can be loaded by issuing:
-./ct-ng arm-unknown-linux-uclibcgnueabi
+./ct-ng arm-cortexa5-linux-uclibcgnueabihf
 Then, to refine the configuration, let's run the \code{menuconfig} interface:
@@ -85,7 +94,7 @@ In \code{Toolchain options}:
 \item Set \code{Tuple's alias} to \code{arm-linux}. This way, we will
   be able to use the compiler as \code{arm-linux-gcc} instead of
-  \code{arm-unknown-linux-uclibcgnueabi-gcc}, which is much longer to
+  \code{arm-unknown-linux-uclibcgnueabihf-gcc}, which is much longer to
@@ -94,12 +103,9 @@ In \code{Debug facilities}:
 \item Make sure that \code{gdb}, \code{strace} and \code{ltrace} are
 \item Remove the other options (\code{dmalloc} and \code{duma}).
-\item In \code{gdb} options:
-  \begin{itemize}
-  \item Make sure that the \code{Cross-gdb} and \code{Build a static gdbserver}
-	options are enabled; the other options are not needed.
-  \item Set \code{gdb version} to \code{7.4.1}.
-  \end{itemize}
+\item In \code{gdb} options, make sure that the \code{Cross-gdb} and
+      \code{Build a static gdbserver} options are enabled; the other
+      options are not needed.
 Explore the different other available options by traveling through the
@@ -159,7 +165,7 @@ One solution is to add the \code{-fpermissive} flag to the
 \section{Testing the toolchain}
 You can now test your toolchain by adding
-\code{/usr/local/xtools/arm-unknown-linux-uclibcgnueabi/bin/} to your
+\code{/usr/local/xtools/arm-unknown-linux-uclibcgnueabihf/bin/} to your
 \code{PATH} environment variable and compiling the simple
 \code{hello.c} program in your main lab directory with

More information about the training-materials-updates mailing list