Use LCD_WHITE macro - this is defined for both greyscale and colour LCDs
[Rockbox.git] / www / cross-gcc.t
blobde2907d11ce5c00139ac8ef9133cd5dfc66b2312
1 #define _PAGE_ Building the SH1 cross compiler
2 #include "head.t"
4 <p>
5 In this example I will assume that you are running Linux with the bash shell.
6 We will only build the C compiler along with the assembler, linker and stuff.
7 Note that the procedure is exactly the same if you are running cygwin on Windows.
9 <h2>Download the source code</h2>
10 <p>
11 You will need the following archives:
12 <ul>
13 <li>binutils-2.11.tar.gz (find it at your closest GNU FTP site)
14 <li>gcc-3.0.4.tar.gz (find it at your closest GNU FTP site)
15 <li>(optional) gdb-5.1.1.tar.gz (find it at your closest GNU FTP site)
16 </ul>
17 <p>
18  If you want to stay out of trouble, use the versions stated above. If you
19  want to live on the edge you can try building with the latest versions.
20  However, if you use binutils-2.13 or later you will not be able to build
21  Rockbox older that CVS 2002-09-08 if you don't add the .rodata.str1.4
22  section to the .rodata section in the linker script:
24 <pre>
25     .rodata :
26     {
27         *(.rodata)
28 <b>        *(.rodata.str1.4)</b>
29     } > DRAM
30 </pre>
32 <h2>Unpack the archives</h2>
33 <p>
34 <pre>
35  /home/linus> tar zxf binutils-2.11.tar.gz
36  /home/linus> tar zxf gcc-3.0.4.tar.gz
37  /home/linus> tar zxf gdb-5.1.1.tar.gz
38 </pre>
40 <h2>Create the directory tree</h2>
41 <p>
42 <pre>
43  /home/linus> mkdir build
44  /home/linus> cd build
45  /home/linus/build> mkdir binutils
46  /home/linus/build> mkdir gcc
47  /home/linus/build> mkdir gdb
48 </pre>
50 <h2>Choose location</h2>
51 <p>
52 Now is the time to decide where you want the tools to be installed. This is
53 the directory where all binaries, libraries, man pages and stuff end up when
54 you do "make install".
55 <p>
56 In this example I have chosen "/home/linus/sh1" as my installation directory, or <i>prefix</i> as it is called. Feel free to use any prefix, like
57 /usr/local/sh1 for example.
59 <h2>Build binutils</h2>
60 <p>
61 We will start with building the binutils (the assembler, linker and stuff).
62 This is pretty straightforward. We will be installing the whole tool chain
63 in the /home/linus/sh1 directory.
64 <pre>
65  /home/linus> cd build/binutils
66  /home/linus/build/binutils> ../../binutils-2.11/configure --target=sh-elf --prefix=/home/linus/sh1
67  /home/linus/build/binutils> make
68  /home/linus/build/binutils> make install
69 </pre>
71 <h2>Build GCC</h2>
72 <p>
73 Now you are ready to build GCC. To do this, you must have the newly built
74 binutils in the PATH.
75 <pre>
76  /home/linus> export PATH=/home/linus/sh1/bin:$PATH
77  /home/linus> cd build/gcc
78  /home/linus/gcc> ../../gcc-3.0.4/configure --target=sh-elf --prefix=/home/linus/sh1 --enable-languages=c
79  /home/linus/build/gcc> make
80  /home/linus/build/gcc> make install
81 </pre>
83 <h2>Build GDB</h2>
84 <p>
85 If you are planning to debug your code with GDB, you have to build it as well.
86 <pre>
87  /home/linus> export PATH=/home/linus/sh1/bin:$PATH
88  /home/linus> cd build/gdb
89  /home/linus/gdb> ../../gdb-5.1.1/configure --target=sh-elf --prefix=/home/linus/sh1
90  /home/linus/build/gdb> make
91  /home/linus/build/gdb> make install
92 </pre>
94 <h2>Done</h2>
95 <p>
96 If someone up there likes you, you now have a working tool chain for SH1.
97 To compile a file with gcc:
98 <pre>
99  /home/linus> sh-elf-gcc -c main.o main.c
100 </pre>
101 Good luck!
103 <i>Linus</i>
105 #include "foot.t"