diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-09-09 15:02:42 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-09-09 15:02:42 +0000 |
commit | 720cc4df1e13f1f36a3606eae9e4dae7a569f8f0 (patch) | |
tree | 712a07eace9fde21b1ef2f32136ac3f23d483b55 /www/sh-win | |
parent | d2aa7116d21637fcc0804a545426906f50f48b7e (diff) | |
download | rockbox-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')
-rw-r--r-- | www/sh-win/index.t | 347 |
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 |
4 | by <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 |
8 | NOTE: 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> |
11 | I have spent a long time figuring out how to compile SH1 code in windows (using | 11 | The GNU-SH Tool Chain for Windows |
12 | the sh-elf-gcc compiler) and when I finally compiled the first OS for my | 12 | </H2> |
13 | Jukebox I decided to write a little tutorial explaining the setup process. | 13 | <P></P> |
14 | |||
15 | <H2> | ||
16 | The GNU-SH Tool Chain for Windows | ||
17 | </H2> | ||
18 | <P> | ||
19 | This is actually all you need to download. It includes the binutils, gcc and | 14 | This is actually all you need to download. It includes the binutils, gcc and |
20 | newlib. Download the GNUSH Tool Chain for ELF format (13 MB). | 15 | newlib. 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"> |
23 | The 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 |
24 | http://www.kpit.com/download/downloadgnush.htm</a> (source code is also | 19 | also available there). Get the "GNUSH v0203 Tool Chain for ELF format". |
25 | available there). The new v0202 version now uses MinGW instead of Cygwin. | 20 | <H2> |
26 | 21 | Setting up the Compiler | |
27 | <H2> | 22 | </H2> |
28 | Setting up 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> |
31 | Install the GNUSH Tool Chain (nothing you really have to care about during the | 26 | <P> |
32 | installation process). After that you should add some paths to your PATH system | 27 | <H2>Compiling the latest Rockbox Source |
33 | environment variable. If you have Windows 95/98/Me you can do that by modifying | 28 | </H2> |
34 | your 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>. |
37 | Add 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> |
57 | Replace the beginning of the paths with the path-name you chose to installt the | 52 | <TD>build for old player target</TD> |
58 | tools in. Reboot. | 53 | </TR> |
59 | 54 | <TR> | |
60 | <P> | 55 | <TD>make -f win32.mak RECORDER=1 DISABLE_GAMES=1</TD> |
61 | In Windows 2000 it is a bit different. You can find the PATH-environment | 56 | <TD>build for recorder target, disable games</TD> |
62 | variable 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 DISABLE_GAMES = | |
69 | <P> | 64 | 1 </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> |
71 | not matter which one you edit) | 66 | </TR> |
72 | 67 | </TABLE> | |
73 | <P> | 68 | </P> |
74 | To 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 | ||
81 | v0101 [ELF]\Sh-elf\lib\gcc-lib\sh-elf\2.9-GNU-SH-v0101\;C:\Programs\kpit\GNU-SH | ||
82 | v0101 [ELF]\Other Utilities</code> | ||
83 | </TD> | ||
84 | </TR> | ||
85 | </TABLE> | ||
86 | |||
87 | <P> | ||
88 | Replace the program path with the path you chose for the program. You do not | ||
89 | have to reboot. | ||
90 | |||
91 | <H2> | ||
92 | An "empty" System | ||
93 | </H2> | ||
94 | <P> | ||
95 | First of all, I'll explain what to do to compile an "empty" system. It just | ||
96 | initializes and calls the <EM>main</EM> function, but does not do anything | ||
97 | else. You can add some code to the <EM>main</EM> function and simply recompile. | ||
98 | It is actually like this: You don't have to care about any of those files, | ||
99 | because you won't have to change much of them (except the main.cpp of | ||
100 | course!!). | ||
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"> // 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"> | ||
123 | void</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 | main, <FONT color="#009000">/* Power-on reset */</FONT> | ||
132 | <br> | ||
133 | stack, <FONT color="#009000">/* Power-on reset (stack pointer) | ||
134 | */</FONT> | ||
135 | <br> | ||
136 | main, <FONT color="#009000">/* Manual reset */</FONT> | ||
137 | <br> | ||
138 | 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> | ||
149 | We 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: | ||
171 | mov.l1f, r1 | ||
172 | mov.l3f, r3 | ||
173 | mov.l2f, r15 | ||
174 | jmp@r3 | ||
175 | ldcr1, vbr | ||
176 | nop | ||
177 | |||
178 | 1:.long_vectors | ||
179 | 2:.long_stack | ||
180 | 3:.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> | ||
191 | Then 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) | ||
202 | OUTPUT_FORMAT(elf32-sh) | ||
203 | SECTIONS | ||
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> | ||
233 | Last 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 | ||
235 | commands 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= | ||
246 | SET SOURCEFILES=main.c | ||
247 | SET OBJECTS=main.o start.o | ||
248 | |||
249 | sh-elf-as start.asm -o start.o -L -a | ||
250 | sh-elf-gcc -O2 -m1 -o main.o -c -nostdlib %INCLUDES% %SOURCEFILES% | ||
251 | sh-elf-ld -o main.out %OBJECTS% -Tlinker.cfg | ||
252 | padit main.out | ||
253 | scramble main.out archos.mod | ||
254 | |||
255 | PAUSE</pre> | ||
256 | </code> | ||
257 | </TD> | ||
258 | </TR> | ||
259 | </TABLE> | ||
260 | |||
261 | <P> | ||
262 | And that's it! I have prepared all those files in a .zip archive for you so you | ||
263 | don't have to copy'n'paste that much :). I have also prepared a package with | ||
264 | the 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> | ||
272 | I hope this tutorial helped you to compile an Archos firmware with windows. If | ||
273 | you have any questions, comments or corrections, please mail to <A href="mailto:edx@codeforce.d2g.com"> | ||
274 | edx@codeforce.d2g.com</A> | ||
275 | |||
276 | #include "foot.t" | 74 | #include "foot.t" |
277 | |||