blob: 6579d36a72a6333bbaf0f6dcce151e5467eeafa7 [file] [log] [blame]
Micah Villmowdaa1c742012-09-27 22:14:10 +00001===================================================================
2How To Build On ARM
3===================================================================
4
Micah Villmowdaa1c742012-09-27 22:14:10 +00005Introduction
6============
7
8This document contains information about building/testing LLVM and
Renato Golin9e3c6782013-09-27 21:14:54 +00009Clang on an ARM machine.
10
11This document is *NOT* tailored to help you cross-compile LLVM/Clang
12to ARM on another architecture, for example an x86_64 machine. To find
13out more about cross-compiling, please check :doc:`HowToCrossCompileLLVM`.
Micah Villmowdaa1c742012-09-27 22:14:10 +000014
15Notes On Building LLVM/Clang on ARM
16=====================================
17Here are some notes on building/testing LLVM/Clang on ARM. Note that
18ARM encompasses a wide variety of CPUs; this advice is primarily based
19on the ARMv6 and ARMv7 architectures and may be inapplicable to older chips.
20
21#. If you are building LLVM/Clang on an ARM board with 1G of memory or less,
22 please use ``gold`` rather then GNU ``ld``.
23 Building LLVM/Clang with ``--enable-optimized``
Benjamin Kramer3b32b2f2013-10-29 17:53:27 +000024 is preferred since it consumes less memory. Otherwise, the building
Micah Villmowdaa1c742012-09-27 22:14:10 +000025 process will very likely fail due to insufficient memory. In any
26 case it is probably a good idea to set up a swap partition.
27
Renato Golin8e3c8582013-11-15 08:42:14 +000028#. If you want to run ``make check-all`` after building LLVM/Clang, to avoid
29 false alarms (e.g., ARCMT failure) please use at least the following
30 configuration:
Micah Villmowdaa1c742012-09-27 22:14:10 +000031
32 .. code-block:: bash
33
David Tweedfd2cf7f2012-10-26 12:09:47 +000034 $ ../$LLVM_SRC_DIR/configure --with-abi=aapcs-vfp
35
Renato Golin8e3c8582013-11-15 08:42:14 +000036#. The most popular Linaro/Ubuntu OS's for ARM boards, e.g., the
David Tweedfd2cf7f2012-10-26 12:09:47 +000037 Pandaboard, have become hard-float platforms. The following set
38 of configuration options appears to be a good choice for this
39 platform:
40
41 .. code-block:: bash
42
Jonathan Roelofscf1ba1d2015-04-29 20:06:41 +000043 ../$LLVM_SRC_DIR/configure --build=armv7l-unknown-linux-gnueabihf \
Renato Golin8b905112013-02-25 18:25:58 +000044 --host=armv7l-unknown-linux-gnueabihf \
45 --target=armv7l-unknown-linux-gnueabihf --with-cpu=cortex-a9 \
46 --with-float=hard --with-abi=aapcs-vfp --with-fpu=neon \
47 --enable-targets=arm --enable-optimized --enable-assertions
Renato Golin8e3c8582013-11-15 08:42:14 +000048
49#. ARM development boards can be unstable and you may experience that cores
50 are disappearing, caches being flushed on every big.LITTLE switch, and
51 other similar issues. To help ease the effect of this, set the Linux
52 scheduler to "performance" on **all** cores using this little script:
53
54 .. code-block:: bash
55
56 # The code below requires the package 'cpufrequtils' to be installed.
57 for ((cpu=0; cpu<`grep -c proc /proc/cpuinfo`; cpu++)); do
58 sudo cpufreq-set -c $cpu -g performance
59 done
60
61#. Running the build on SD cards is ok, but they are more prone to failures
62 than good quality USB sticks, and those are more prone to failures than
63 external hard-drives (those are also a lot faster). So, at least, you
64 should consider to buy a fast USB stick. On systems with a fast eMMC,
65 that's a good option too.
66
67#. Make sure you have a decent power supply (dozens of dollars worth) that can
68 provide *at least* 4 amperes, this is especially important if you use USB
69 devices with your board.