diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-03-27 11:21:50 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-03-27 11:21:50 +0000 |
commit | d6023a7adee17628e0ec4bad02e10199c1165bdb (patch) | |
tree | ff133f4507b5c388094401093c224fff22215395 /www/sh-win | |
parent | e8c6b2052b11d85b8836a0c07e493b9562dd11eb (diff) | |
download | rockbox-d6023a7adee17628e0ec4bad02e10199c1165bdb.tar.gz rockbox-d6023a7adee17628e0ec4bad02e10199c1165bdb.zip |
Initial version
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@34 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'www/sh-win')
-rw-r--r-- | www/sh-win/LCDv2Win.zip | bin | 0 -> 64119 bytes | |||
-rw-r--r-- | www/sh-win/Makefile | 9 | ||||
-rw-r--r-- | www/sh-win/empty.zip | bin | 0 -> 62684 bytes | |||
-rw-r--r-- | www/sh-win/enviro.jpg | bin | 0 -> 37913 bytes | |||
-rw-r--r-- | www/sh-win/enviro2.jpg | bin | 0 -> 36174 bytes | |||
-rw-r--r-- | www/sh-win/enviro3.jpg | bin | 0 -> 10242 bytes | |||
-rw-r--r-- | www/sh-win/index.t | 280 |
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 @@ | |||
1 | ACTION=@echo preprocessing $@; rm -f $@; fcpp -WWW -I.. -Uunix -H -C -V -LL >$@ | ||
2 | |||
3 | SRC := $(wildcard *.t) | ||
4 | OBJS := $(SRC:%.t=%.html) | ||
5 | |||
6 | all: $(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> | ||
4 | by <A href="mailto:edx@codeforce.d2g.com">Felix Arends</A>, 1/8/2002 | ||
5 | <BR> | ||
6 | |||
7 | <P> | ||
8 | NOTE: THIS COMPILER DOES NOT YET WORK WITH WINDOWS XP!!! | ||
9 | |||
10 | <P> | ||
11 | I have spent a long time figuring out how to compile SH1 code in windows (using | ||
12 | the sh-elf-gcc compiler) and when I finally compiled the first OS for my | ||
13 | Jukebox I decided to write a little tutorial explaining the setup process. | ||
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 | ||
20 | newlib. The complete GNUSH Tool Chain (currently v0101) is 117MB but for you it | ||
21 | is enough to download the GNUSH Tool Chain for ELF format (45 MB). | ||
22 | |||
23 | <P> | ||
24 | The GNUSH website can be found at <a href="http://www.kpit.com/download/downloadgnu.htm"> | ||
25 | http://www.kpit.com/download/downloadgnu.htm</a> (source code is also | ||
26 | available there) and the direct link to the file you need is <a href="http://www.kpit.com/download/elf.zip"> | ||
27 | http://www.kpit.com/download/elf.zip</a>. It uses the cygwin dll to emulate | ||
28 | a linux layer but you do not have to care about that. | ||
29 | |||
30 | <H2> | ||
31 | Setting up the Compiler | ||
32 | </H2> | ||
33 | <P> | ||
34 | Install the GNUSH Tool Chain (nothing you really have to care about during the | ||
35 | installation process). After that you should add some paths to your PATH system | ||
36 | environment variable. If you have Windows 95/98/Me you can do that by modifying | ||
37 | your autoexec.bat: | ||
38 | |||
39 | <P> | ||
40 | Add 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> | ||
60 | Replace the beginning of the paths with the path-name you chose to installt the | ||
61 | tools in. Reboot. | ||
62 | |||
63 | <P> | ||
64 | In Windows 2000 it is a bit different. You can find the PATH-environment | ||
65 | variable 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 | ||
74 | not matter which one you edit) | ||
75 | |||
76 | <P> | ||
77 | To 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 | ||
84 | v0101 [ELF]\Sh-elf\lib\gcc-lib\sh-elf\2.9-GNU-SH-v0101\;C:\Programs\kpit\GNU-SH | ||
85 | v0101 [ELF]\Other Utilities</code> | ||
86 | </TD> | ||
87 | </TR> | ||
88 | </TABLE> | ||
89 | |||
90 | <P> | ||
91 | Replace the program path with the path you chose for the program. You do not | ||
92 | have to reboot. | ||
93 | |||
94 | <H2> | ||
95 | An "empty" System | ||
96 | </H2> | ||
97 | <P> | ||
98 | First of all, I'll explain what to do to compile an "empty" system. It just | ||
99 | initializes and calls the <EM>main</EM> function, but does not do anything | ||
100 | else. You can add some code to the <EM>main</EM> function and simply recompile. | ||
101 | It is actually like this: You don't have to care about any of those files, | ||
102 | because you won't have to change much of them (except the main.cpp of | ||
103 | course!!). | ||
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"> // 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"> | ||
126 | void</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 | main, <FONT color="#009000">/* Power-on reset */</FONT> | ||
135 | <br> | ||
136 | stack, <FONT color="#009000">/* Power-on reset (stack pointer) | ||
137 | */</FONT> | ||
138 | <br> | ||
139 | main, <FONT color="#009000">/* Manual reset */</FONT> | ||
140 | <br> | ||
141 | 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> | ||
152 | We 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: | ||
174 | mov.l1f, r1 | ||
175 | mov.l3f, r3 | ||
176 | mov.l2f, r15 | ||
177 | jmp@r3 | ||
178 | ldcr1, vbr | ||
179 | nop | ||
180 | |||
181 | 1:.long_vectors | ||
182 | 2:.long_stack | ||
183 | 3:.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> | ||
194 | Then 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) | ||
205 | OUTPUT_FORMAT(elf32-sh) | ||
206 | SECTIONS | ||
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> | ||
236 | Last 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 | ||
238 | commands 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= | ||
249 | SET SOURCEFILES=main.c | ||
250 | SET OBJECTS=main.o start.o | ||
251 | |||
252 | sh-elf-as start.asm -o start.o -L -a | ||
253 | sh-elf-gcc -O2 -m1 -o main.o -c -nostdlib %INCLUDES% %SOURCEFILES% | ||
254 | sh-elf-ld -o main.out %OBJECTS% -Tlinker.cfg | ||
255 | padit main.out | ||
256 | scramble main.out archos.mod | ||
257 | |||
258 | PAUSE</pre> | ||
259 | </code> | ||
260 | </TD> | ||
261 | </TR> | ||
262 | </TABLE> | ||
263 | |||
264 | <P> | ||
265 | And that's it! I have prepared all those files in a .zip archive for you so you | ||
266 | don't have to copy'n'paste that much :). I have also prepared a package with | ||
267 | the 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> | ||
275 | I hope this tutorial helped you to compile an Archos firmware with windows. If | ||
276 | you have any questions, comments or corrections, please mail to <A href="mailto:edx@codeforce.d2g.com"> | ||
277 | edx@codeforce.d2g.com</A> | ||
278 | |||
279 | #include "foot.t" | ||
280 | |||