[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>


>---------------------------------------------------------------

d76bc148c77078df84ad151a7a66282ad3ed502c
 .../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):
 
 \begin{verbatim}
-(gdb) set sysroot /usr/local/xtools/arm-unknown-linux-uclibcgnueabi/
-arm-unknown-linux-uclibcgnueabi/sysroot/
+(gdb) set sysroot /usr/local/xtools/arm-unknown-linux-uclibcgnueabihf/
+arm-unknown-linux-uclibcgnueabihf/sysroot/
 \end{verbatim}
 
 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:
 
 \begin{itemize}
-\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}
   \begin{itemize}
   \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.
   \end{itemize}
 \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:
 \begin{verbatim}
-arm-none-linux-gnueabi-gcc -o rttest rttest.c -lrt
+arm-none-linux-gnueabihf-gcc -o rttest rttest.c -lrt
 \end{verbatim}
 
 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:
 \begin{verbatim}
 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)
 \end{verbatim}
 \normalsize
 
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:
 \footnotesize
 \begin{verbatim}
 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
 \end{verbatim}
 \normalsize
@@ -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}:
 
 \begin{verbatim}
- 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
 \end{verbatim}
 
@@ -451,10 +451,11 @@ just like we built alsa-lib. We will also need to disable the xmlto
 support that generates the documentation.
 
 \begin{verbatim}
- 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
 \end{verbatim}
 
 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
 \end{verbatim}
 
@@ -615,12 +616,26 @@ is very easy, and almost identical to what we've seen with the
 alsa-utils. First, the configure step:
 
 \begin{verbatim}
-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
 \end{verbatim}
 
+It will fail with:
+
+\begin{verbatim}
+configure: error: Ogg >= 1.0 required !
+\end{verbatim}
+
+By running \code{./configure --help}, you will find the
+\code{--with-ogg-libraries} and \code{--with-ogg-includes} options.
+Use those:
+
+\begin{verbatim}
+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
+\end{verbatim}
+
 Then, compile the library:
 
 \begin{verbatim}
@@ -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:
+\begin{verbatim}
+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
+\end{verbatim}
+
+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
+\code{CURL_CFLAGS}.
 
 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
+it:
+
+\begin{verbatim}
+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
+\end{verbatim}
 
 \section{Installing Crosstool-ng}
 
@@ -38,6 +45,7 @@ solution. As documented in
 \code{docs/2\ -\ Installing\ crosstool-NG.txt}, do:
 
 \begin{verbatim}
+autoreconf
 ./configure --enable-local
 make
 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:
 
 \begin{verbatim}
-./ct-ng arm-unknown-linux-uclibcgnueabi
+./ct-ng arm-cortexa5-linux-uclibcgnueabihf
 \end{verbatim}
 
 Then, to refine the configuration, let's run the \code{menuconfig} interface:
@@ -85,7 +94,7 @@ In \code{Toolchain options}:
 \begin{itemize}
 \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
   type.
 \end{itemize}
 
@@ -94,12 +103,9 @@ In \code{Debug facilities}:
 \item Make sure that \code{gdb}, \code{strace} and \code{ltrace} are
       enabled.
 \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.
 \end{itemize}
 
 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
 \code{arm-linux-gcc}.



More information about the training-materials-updates mailing list