summaryrefslogtreecommitdiff
path: root/www/sh-win/index.t
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-09-09 15:02:42 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-09-09 15:02:42 +0000
commit720cc4df1e13f1f36a3606eae9e4dae7a569f8f0 (patch)
tree712a07eace9fde21b1ef2f32136ac3f23d483b55 /www/sh-win/index.t
parentd2aa7116d21637fcc0804a545426906f50f48b7e (diff)
downloadrockbox-720cc4df1e13f1f36a3606eae9e4dae7a569f8f0.tar.gz
rockbox-720cc4df1e13f1f36a3606eae9e4dae7a569f8f0.zip
New sh-win instructions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2241 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'www/sh-win/index.t')
-rw-r--r--www/sh-win/index.t347
1 files changed, 72 insertions, 275 deletions
diff --git a/www/sh-win/index.t b/www/sh-win/index.t
index 9b387badb1..9b63d0ebe3 100644
--- a/www/sh-win/index.t
+++ b/www/sh-win/index.t
@@ -1,277 +1,74 @@
1#define _PAGE_ Setting up an SH-1 compiler for Windows 1#define _PAGE_ Setting up an SH-1 compiler for Windows #include "head.t"
2#include "head.t" 2<P>
3<P> 3 by <A href="mailto:edx@codeforce.d2g.com">Felix Arends</A>, 1/8/2002
4by <A href="mailto:edx@codeforce.d2g.com">Felix Arends</A>, 1/8/2002 4 <BR>
5<BR> 5</P>
6 6<P>
7<P> 7 I have spent a long time figuring out how to compile SH1 code in windows (using
8NOTE: THIS COMPILER DOES NOT YET WORK WITH WINDOWS XP!!! 8 the sh-elf-gcc compiler) and when I finally compiled the first OS for my
9 9 Jukebox I decided to write a little tutorial explaining the setup process.
10<P> 10 <H2>
11I have spent a long time figuring out how to compile SH1 code in windows (using 11 The GNU-SH Tool Chain for Windows
12the sh-elf-gcc compiler) and when I finally compiled the first OS for my 12 </H2>
13Jukebox I decided to write a little tutorial explaining the setup process. 13<P></P>
14
15<H2>
16The GNU-SH Tool Chain for Windows
17</H2>
18<P>
19This is actually all you need to download. It includes the binutils, gcc and 14This is actually all you need to download. It includes the binutils, gcc and
20newlib. Download the GNUSH Tool Chain for ELF format (13 MB). 15newlib. Download the GNUSH Tool Chain for ELF format (35 MB).
21 16<P>
22<P> 17 The GNUSH website can be found at <a href="http://www.kpit.com/download/downloadgnushv0203.htm">
23The GNUSH website can be found at <a href="http://www.kpit.com/download/downloadgnush.htm"> 18 http://www.kpit.com/download/downloadgnushv0203.htm</a> (source code is
24http://www.kpit.com/download/downloadgnush.htm</a> (source code is also 19 also available there). Get the "GNUSH v0203 Tool Chain for ELF format".
25available there). The new v0202 version now uses MinGW instead of Cygwin. 20 <H2>
26 21 Setting up&nbsp;the Compiler
27<H2> 22 </H2>
28Setting up&nbsp;the Compiler 23<P></P>
29</H2> 24<P>Install the GNUSH Tool Chain (nothing you really have to care about during the
30<P> 25 installation process).</P>
31Install the GNUSH Tool Chain (nothing you really have to care about during the 26<P>
32installation process). After that you should add some paths to your PATH system 27 <H2>Compiling the latest Rockbox Source
33environment variable. If you have Windows 95/98/Me you can do that by modifying 28 </H2>
34your autoexec.bat: 29<P>Use CVS to download the latest source code of Rockbox (the firmware and apps
35 30 modules). In addition, you need to copy a win32 compilation of scramble.exe
36<P> 31 into the apps dir. The pre-compiled scramble.exe can be downloaded <a href="scramble.exe">here</a>.
37Add the following line to your autoexec.bat: 32 From your start menu, open the "SH-ELF tool chain" batch file inside the GNU-SH
38 33 v0203 program folder. You should end up seeing a command prompt. Go to the apps
39<P> 34 directory and type:</P>
40<TABLE cellSpacing="1" cellPadding="1" width="100%" border="1"> 35<P>
41<TBODY> 36 <TABLE id="Table1" cellSpacing="1" cellPadding="1" width="100%" border="1">
42<TR> 37 <TR>
43<TD bgcolor="#a0d6e8"> 38 <TD>Command</TD>
44<code>SET PATH=%PATH%;C:\Programs\kpit\GNU-SH v0101 39 <TD>Description</TD>
45[ELF]\Sh-elf\bin\;C:\Programs\kpit\GNU-SH v0101 40 </TR>
46[ELF]\Sh-elf\lib\gcc-lib\sh-elf\2.9-GNU-SH-v0101\;C:\Programs\kpit\GNU-SH v0101 41 <TR>
47[ELF]\Other Utilities</code> 42 <TD>make -f win32.mak<BR>
48</TD> 43 make -f win32.mak RECORDER = 1</TD>
49</TR> 44 <TD vAlign="top">build for recorder target</TD>
50</TBODY> 45 </TR>
51</TABLE> 46 <TR>
52 47 <TD>make -f win32.mak PLAYER</TD>
53<P> 48 <TD>build for player target</TD>
54</CODE>(Note: This is just one single line) 49 </TR>
55 50 <TR>
56<P> 51 <TD>make -f win32.mak PLAYER_OLD</TD>
57Replace the beginning of the paths with the path-name you chose to installt the 52 <TD>build for old player target</TD>
58tools in. Reboot. 53 </TR>
59 54 <TR>
60<P> 55 <TD>make -f win32.mak RECORDER=1 DISABLE_GAMES=1</TD>
61In Windows 2000 it is a bit different. You can find the PATH-environment 56 <TD>build for recorder target, disable games</TD>
62variable if you right-click the "My Computer" icon on your desktop and choose 57 </TR>
63"Properties" in the popup-menu. Go to the "Advanced" tab and click 58 <TR>
64"Environment-Variables": 59 <TD vAlign="top">make -f win32.mak RECORDER=1 PROPFONTS=1</TD>
65 60 <TD>build for recorder target, enable propfonts</TD>
66<P align="center"> 61 </TR>
67<IMG src="enviro.jpg"> <IMG src="enviro2.jpg"> <IMG src="enviro3.jpg"> 62 <TR>
68 63 <TD vAlign="top">make -f win32.mak RECORDER=1 PROPFONTS=1&nbsp;DISABLE_GAMES =
69<P> 64 1&nbsp;</TD>
70(Note: There is also a PATH-variable in the "System variables" list, it does 65 <TD>build for recorder target, disable games, use propfonts</TD>
71not matter which one you edit) 66 </TR>
72 67 </TABLE>
73<P> 68</P>
74To the value the PATH-variable already has, add: 69<P>
75 70 I hope this tutorial helped you to compile an Archos firmware with windows. If
76<P> 71 you have any questions, comments or corrections, please mail to <A href="mailto:edx@go.cc">
77<TABLE cellSpacing="1" cellPadding="1" width="100%" border="1"> 72 edx@go.cc</A>
78<TR> 73</P>
79<TD bgcolor="#a0d6e8">
80<code>;C:\Programs\kpit\GNU-SH v0101 [ELF]\Sh-elf\bin\;C:\Programs\kpit\GNU-SH
81v0101 [ELF]\Sh-elf\lib\gcc-lib\sh-elf\2.9-GNU-SH-v0101\;C:\Programs\kpit\GNU-SH
82v0101 [ELF]\Other Utilities</code>
83</TD>
84</TR>
85</TABLE>
86
87<P>
88Replace the program path with the path you chose for the program. You do not
89have to reboot.
90
91<H2>
92An "empty" System
93</H2>
94<P>
95First of all, I'll explain what to do to compile an "empty" system. It just
96initializes and calls the <EM>main</EM> function, but does not do anything
97else. You can add some code to the <EM>main</EM> function and simply recompile.
98It is actually like this: You don't have to care about any of those files,
99because you won't have to change much of them (except the main.cpp of
100course!!).
101
102<P>
103<STRONG>main.cpp:
104<BR>
105</STRONG>
106<TABLE cellSpacing="1" cellPadding="1" width="550" border="1">
107<TR>
108<TD bgcolor="#a0d6e8">
109<P>
110<code><font color="#0000ff">int</font> __main(<font color="#0000ff">void</font>){}
111<BR>
112<BR>
113<font color="#0000ff">int</font> main(<font color="#0000ff">void</font>)
114<BR>
115{
116<BR>
117<font color="#009000">&nbsp;&nbsp;&nbsp; // add code here</font>
118<BR>
119}
120<BR>
121<BR>
122<FONT color="#0000ff">extern</FONT> <FONT color="#0000ff">const</FONT> <FONT color="#0000ff">
123void</FONT> stack(<FONT color="#0000ff">void</FONT>);
124<br>
125<br>
126<FONT color="#0000ff">const</FONT> <FONT color="#0000ff">void</FONT>* vectors[]
127__attribute__ ((section (".vectors"))) =
128<br>
129{
130<br>
131&nbsp;&nbsp;&nbsp; main, <FONT color="#009000">/* Power-on reset */</FONT>
132<br>
133&nbsp;&nbsp;&nbsp; stack, <FONT color="#009000">/* Power-on reset (stack pointer)
134*/</FONT>
135<br>
136&nbsp;&nbsp;&nbsp; main, <FONT color="#009000">/* Manual reset */</FONT>
137<br>
138&nbsp;&nbsp;&nbsp; stack <FONT color="#009000">/* Manual reset (stack pointer) */</FONT>
139<br>
140};
141<br>
142</code>
143
144</TD>
145</TR>
146</TABLE>
147
148<P>
149We need a start-up assembler code:
150
151<P>
152<STRONG>start.asm
153<br>
154</STRONG>
155<TABLE cellSpacing="1" cellPadding="1" width="550" border="1">
156<TR>
157<TD bgcolor="#a0d6e8">
158<code>
159<pre>! note: sh-1 has a "delay cycle" after every branch where you can
160! execute another instruction "for free".
161
162.file"start.asm"
163.section.text.start
164.extern_main
165.extern _vectors
166.extern _stack
167.global _start
168.align 2
169
170_start:
171mov.l1f, r1
172mov.l3f, r3
173mov.l2f, r15
174jmp@r3
175ldcr1, vbr
176nop
177
1781:.long_vectors
1792:.long_stack
1803:.long_main
181.type_start,@function</pre>
182</code>
183</TD>
184</TR>
185</TABLE>
186
187<P>
188(I took this code from Björn's LCDv2 source)
189
190<P>
191Then we need a linker configuration file:
192
193<P>
194<STRONG>linker.cfg</STRONG>
195<BR>
196<TABLE cellSpacing="1" cellPadding="1" width="550" border="1">
197<TR>
198<TD bgcolor="#a0d6e8">
199<P>
200<code>
201<pre>ENTRY(_start)
202OUTPUT_FORMAT(elf32-sh)
203SECTIONS
204{
205 .vectors 0x09000000 :
206 {
207 *(.vectors);
208 . = ALIGN(0x200);
209 *(.text.start)
210 *(.text)
211 *(.rodata)
212 }
213
214 .bss :
215 {
216 _stack = . + 0x1000;
217 }
218
219 .pad 0x0900C800 :
220 {
221 LONG(0);
222 }
223 }</pre>
224</code>
225</TD>
226</TR>
227</TABLE>
228
229<P>
230(This code comes from Börn's LCDv2 as well)
231
232<P>
233Last but not least, we need a batch file to link all this and output a usable
234.mod file (you don't really need a batch file if you want to enter all the
235commands over and over angain :])
236
237<P>
238<STRONG>make.bat</STRONG>
239<BR>
240<TABLE cellSpacing="1" cellPadding="1" width="550" border="1">
241<TR>
242<TD bgcolor="#a0d6e8">
243<P>
244<code>
245<pre>SET INCLUDES=
246SET SOURCEFILES=main.c
247SET OBJECTS=main.o start.o
248
249sh-elf-as start.asm -o start.o -L -a
250sh-elf-gcc -O2 -m1 -o main.o -c -nostdlib %INCLUDES% %SOURCEFILES%
251sh-elf-ld -o main.out %OBJECTS% -Tlinker.cfg
252padit main.out
253scramble main.out archos.mod
254
255PAUSE</pre>
256</code>
257</TD>
258</TR>
259</TABLE>
260
261<P>
262And that's it! I have prepared all those files in a .zip archive for you so you
263don't have to copy'n'paste that much :). I have also prepared a package with
264the LCDv2 code Björn wrote (ready to compile with Windows).
265
266<P>
267<a href="empty.zip">empty.zip</a>
268<BR>
269<a href="LCDv2Win.zip">LCDv2Win.zip</a>
270
271<P>
272I hope this tutorial helped you to compile an Archos firmware with windows. If
273you have any questions, comments or corrections, please mail to <A href="mailto:edx@codeforce.d2g.com">
274edx@codeforce.d2g.com</A>
275
276#include "foot.t" 74#include "foot.t"
277