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