Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: docs/cross_compiling_for_arm.md

Issue 1347153006: [Docs] Add wiki content to Markdown docs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <font color='darkred'><b><h2>Building V8 with SCons is no longer supported. See <a href='https://code.google.com/p/v8-wiki/wiki/BuildingWithGYP'>BuildingWithGYP </a>.</h2></b></font>
2
3 ---
4
5
6 # Using Sourcery G++ Lite
7
8 The Sourcery G++ Lite cross compiler suite is a free version of Sourcery G++ fro m [CodeSourcery](http://www.codesourcery.com). There is a page for the [GNU Tool chain for ARM Processors](http://www.codesourcery.com/sgpp/lite/arm). Determine the version you need for your host/target combination.
9
10 The following instructions uses [2009q1-203 for ARM GNU/Linux](http://www.codeso urcery.com/sgpp/lite/arm/portal/release858), and if using a different version pl ease change the URLs and `TOOL_PREFIX` below accordingly.
11
12 ## Installing on host and target
13
14 The simplest way of setting this up is to install the full Sourcery G++ Lite pac kage on both the host and target at the same location. This will ensure that all the libraries required are available on both sides. If you want to use the defa ult libraries on the host there is no need the install anything on the target.
15
16 The following script will install in `/opt/codesourcery`:
17
18 ```
19 #!/bin/sh
20
21 sudo mkdir /opt/codesourcery
22 cd /opt/codesourcery
23 sudo chown $USERNAME .
24 chmod g+ws .
25 umask 2
26 wget http://www.codesourcery.com/sgpp/lite/arm/portal/package4571/public/arm-non e-linux-gnueabi/arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
27 tar -xvf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
28 ```
29
30
31 ## Building using scons without snapshot
32
33 The simplest way to build is without snapshot, as that does no involve using the simulator to generate the snapshot. The following script will build the sample shell without snapshot for ARM v7.
34
35 ```
36 #!/bin/sh
37
38 export TOOL_PREFIX=/opt/codesourcery/arm-2009q1/bin/arm-none-linux-gnueabi
39 export CXX=$TOOL_PREFIX-g++
40 export AR=$TOOL_PREFIX-ar
41 export RANLIB=$TOOL_PREFIX-ranlib
42 export CC=$TOOL_PREFIX-gcc
43 export LD=$TOOL_PREFIX-ld
44
45 export CCFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=vfp"
46 export ARM_TARGET_LIB=/opt/codesourcery/arm-2009q1/arm-none-linux-gnueabi/libc
47
48 scons wordsize=32 snapshot=off arch=arm sample=shell
49 ```
50
51 If the processor is not Cortex A8 or does not have VFP enabled the `-mtune=corte x-a8` and `-mfpu=vfp` part of `CCFLAGS` needs to be changed accordingly. By defa ult the V8 SCons build adds `-mfloat-abi=softfp`.
52
53 If using the default libraries on the target just leave out the setting of `ARM_ TARGET_LIB` and if the target libraies are in a different location ARM\_TARGET\_ LIB` needs to be adjusted accordingly.
54
55 The default for Sourcery G++ Lite is ARM v5te with software floating point emula tion, so if testing building for ARM v5te the setting of `CCFLAGS` and `ARM_TARG ET_LIB` should be changed to:
56
57 ```
58 CCFLAGS=""
59 ARM_TARGET_LIB=/opt/codesourcery/arm-2009q1/arm-none-linux-gnueabi/libc
60
61 scons armeabi=soft ...
62 ```
63
64 Relying on defaults in the tool chain might lead to surprises, so for ARM v5te w ith software floating point emulation the following is more explicit:
65
66 ```
67 CCFLAGS="-march=armv5te"
68 ARM_TARGET_LIB=/opt/codesourcery/arm-2009q1/arm-none-linux-gnueabi/libc
69
70 scons armeabi=soft ...
71 ```
72
73 If the target has an VFP unit use the following:
74
75 ```
76 CCFLAGS="-mfpu=vfpv3"
77 ARM_TARGET_LIB=/opt/codesourcery/arm-2009q1/arm-none-linux-gnueabi/libc
78 ```
79
80 To allow G++ to use Thumb2 instructions and the VFP unit when compiling the C/C+ + code use:
81
82 ```
83 CCFLAGS="-mthumb -mfpu=vfpv3"
84 ARM_TARGET_LIB=/opt/codesourcery/arm-2009q1/arm-none-linux-gnueabi/libc/thumb2
85 ```
86
87 _Note:_ V8 will not use Thumb2 instructions in its generated code it always uses the full ARM instruction set.
88
89 For other ARM versions please check the Sourcery G++ Lite documentation.
90
91 As mentioned above the default for Sourcery G++ Lite used here is ARM v5te with software floating point emulation. However beware that this default might change between versions and that there is no unique defaults for ARM tool chains in ge neral, so always passing `-march` and possibly `-mfpu` is recommended. Passing ` -mfloat-abi` is not required as this is controlled by the SCons option `armeabi` .
92
93 ## Building using scons with snapshot
94
95 When building with snapshot the simulator is used to build the snapshot on the h ost and then building for the target with that snapshot. The following script wi ll accomplish that (using both Thumb2 and VFP instructions):
96
97 ```
98 #!/bin/sh
99
100 V8DIR=..
101
102 cd host
103
104 scons -Y$V8DIR simulator=arm snapshot=on
105 mv obj/release/snapshot.cc $V8DIR/src/snapshot.cc
106
107 cd ..
108
109 export TOOL_PREFIX=/opt/codesourcery/arm-2010.09-103/bin/arm-none-linux-gnueabi
110 export CXX=$TOOL_PREFIX-g++
111 export AR=$TOOL_PREFIX-ar
112 export RANLIB=$TOOL_PREFIX-ranlib
113 export CC=$TOOL_PREFIX-gcc
114 export LD=$TOOL_PREFIX-ld
115
116 export CCFLAGS="-mthumb -march=armv7-a -mfpu=vfpv3"
117 export ARM_TARGET_LIB=/opt/codesourcery/arm-2010.09-103/arm-none-linux-gnueabi/l ibc/thumb2
118
119 cd target
120
121 scons -Y$V8DIR wordsize=32 snapshot=nobuild arch=armsample=shell
122 rm $V8DIR/src/snapshot.cc
123
124 cd ..
125 ```
126
127 This script required the two subdirectories `host` and `target`. V8 is first bui ld for the host with the ARM simulator which supports running ARM code on the ho st. This is used to build a snapshot file which is then used for the actual cros s compilation of V8.
128
129 ## Building for target which supports unaligned access
130
131 The default when building V8 for an ARM target (either cross compiling or compil ing on an ARM machine) is to disable unaligned memory access. However in some si tuations (most noticeably handling of regular expressions) performance will be b etter if unaligned memory access is used on processors which supports it. To ena ble unaligned memory access set `unalignedaccesses` to `on` when building:
132
133 ```
134 scons unalignedaccesses=on ...
135 ```
136
137 When running in the simulator the default is to enable unaligned memory access, so to test in the simulator with unaligned memory access disabled set `unaligned accesses` to `off` when building:
138
139 ```
140 scons unalignedaccesses=off simulator=arm ...
141 ```
142
143 ## Using V8 with hardfp calling convention
144
145 By default V8 uses the softfp calling convention when calling C functions from g enerated code. However it is possible to use hardfp as well. To enable this set `armeabi` to `hardfp` when building:
146
147 ```
148 scons armeabi=hardfp ...
149 ```
150
151 Passing `armeabi=hardfp` to SCons will automatically set the compiler flag `-mfl oat-abi=hardfp`. If using snapshots remember to pass `armeabi=hardfp` when build ing V8 on the host for generating the snapshot as well.
OLDNEW
« docs/building_with_gyp.md ('K') | « docs/contributing.md ('k') | docs/d8_on_android.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698