Initial version

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@34 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-03-27 11:21:50 +00:00
parent e8c6b2052b
commit d6023a7ade
27 changed files with 592 additions and 0 deletions

BIN
www/codes_new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
www/codes_old.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

9
www/docs/Makefile Normal file
View File

@ -0,0 +1,9 @@
ACTION=@echo preprocessing $@; rm -f $@; fcpp -WWW -I.. -Uunix -H -C -V -LL >$@
SRC := $(wildcard *.t)
OBJS := $(SRC:%.t=%.html)
all: $(OBJS)
%.html : %.t
$(ACTION) $<

36
www/docs/index.t Normal file
View File

@ -0,0 +1,36 @@
#define _PAGE_ Useful data sheets
#include "head.t"
<p>All in PDF format.
<h2>General docs</h2>
<ul>
<li><a href="cpu_sh1_pb.pdf">Hitachi SH-1 Product Brief</a> 120 kB
<li><a href="sh1_2p.pdf">Hitachi SH-1 Programming Manual r4.0</a> 1600 kB
<li><a href="sh7032h.pdf">Hitachi SH-1 Hardware Manual r5.0</a> 2300 kB
<li><a href="flash_SST37VF512.pdf">SST SST37VF020 256kB Flash ROM</a> 172 kB
</ul>
<h2>Player specific</h2>
<ul>
<li><a href="SSD1801R0_4.pdf">Solomon SSD 1801 LCD controller</a> 584 kB (unconfirmed)
<li><a href="dsp_mas3507d_3pd.pdf">Micronas MAS 3507D MPEG Audio Decoder</a> 872 kB
<li><a href="dac_dac3550a_1ds.pdf">Micronas DAC 3550A Stereo Audio DAC</a> 592 kB
<li><a href="dram_41c16105.pdf">ISSI IS41LV16105 Fast Page DRAM</a> 148 kB
</ul>
<h2>Recorder specific</h2>
<ul>
<li><a href="ssd1815r1_5.pdf">Solomon SSD 1815 LCD controller</a> 864 kB
<li><a href="mas3587f_2pd.pdf">Micronas MAS 3587F MPEG Audio Encoder/Decoder</a> 1300 kB
<li><a href="dram_k4e151612d.pdf">Samsung K4E151612D EDO DRAM</a> 400 kB
</ul>
<ul>
<li><a href="dc2dc_LM2651.pdf">National LM2651 DC/DC converter</a> 200 kB
<li><a href="dc2dc_MC34063A.pdf">Fairchild MC34064A DC/DC converter</a> 45 kB
<li><a href="fet_FZT849.pdf">FZT824 High Current Transistor</a> 60 kB
<li><a href="rtc_tm41st84w.pdf">ST M41ST84W Real Time Clock</a> 180 kB
</ul>
#include "foot.t"

40
www/example/Makefile Normal file
View File

@ -0,0 +1,40 @@
HPATH = /usr/local/sh-gcc/bin
CC = $(HPATH)/sh-elf-gcc
LD = $(HPATH)/sh-elf-ld
AR = $(HPATH)/sh-elf-ar
AS = $(HPATH)/sh-elf-as
OC = $(HPATH)/sh-elf-objcopy
INCLUDES=-I.
CFLAGS = -Os -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES)
AFLAGS += -small -relax
OBJS= start.o main.o
%.o: %.s
$(CC) -o $@ $(CFLAGS) $(INCLUDES) $(DEFS) -c $<
all : archos.mod # archos.asm
main.o: main.c
archos.elf : $(OBJS) app.lds
$(CC) -nostdlib -o archos.elf $(OBJS) -lgcc -Tapp.lds -Wl,-Map,archos.map
archos.bin : archos.elf
$(OC) -O binary archos.elf archos.bin
archos.asm: archos.bin
sh2d -sh1 archos.bin > archos.asm
archos.mod : archos.bin
scramble archos.bin archos.mod
dist:
tar czvf dist.tar.gz Makefile main.c start.s app.lds
clean:
-rm -f *.x *.i *.o *.elf *.bin *.map *.mod *.bak *~

7
www/example/README Normal file
View File

@ -0,0 +1,7 @@
Rockbox example build
---------------------
These files are meant to show how to build a simple program for the Archos.
Note that the display code only works on older machines (<4.50) so don't
look too hard on that.

23
www/example/app.lds Normal file
View File

@ -0,0 +1,23 @@
ENTRY(_start)
OUTPUT_FORMAT(elf32-sh)
SECTIONS
{
.vectors 0x09000000 :
{
*(.vectors);
. = ALIGN(0x200);
*(.text.start)
*(.text)
*(.rodata)
}
.bss :
{
_stack = . + 0x1000;
}
.pad 0x0900C800 :
{
LONG(0);
}
}

102
www/example/main.c Normal file
View File

@ -0,0 +1,102 @@
#define PBDR (*((volatile unsigned short *)0x05FFFFC2))
#define DC 1
#define CS1 2
#define SDA 4
#define SCK 8
static const unsigned char ascii2lcd[] = {
0x00,0x01,0x02,0x03,0x00,0x84,0x85,0x89,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xec,0xe3,0xe2,0xe1,0xe0,0xdf,0x15,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x24,0x25,0x26,0x37,0x06,0x29,0x2a,0x2b,
0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x32,0x33,
0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,
0x3c,0x3d,0x3e,0x3f,0x40,0x41,0x42,0x43,
0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,
0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,
0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,
0x5c,0x5d,0x5e,0xa9,0x33,0xce,0x00,0x15,
0x00,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,
0x6c,0x6d,0x6e,0x6f,0x70,0x71,0x72,0x73,
0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x7b,
0x7c,0x7d,0x7e,0x24,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
0x45,0x45,0x45,0x45,0x45,0x45,0x24,0x47,
0x49,0x49,0x49,0x49,0x4d,0x4d,0x4d,0x4d,
0x48,0x52,0x53,0x53,0x53,0x53,0x53,0x24,
0x24,0x59,0x59,0x59,0x59,0x5d,0x24,0x24,
0x65,0x65,0x65,0x65,0x65,0x65,0x24,0x67,
0x69,0x69,0x69,0x69,0x6d,0x6d,0x6d,0x6d,
0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24,
0x24,0x79,0x79,0x79,0x79,0x7d,0x24,0x7d
};
void lcd_write(int byte, int data)
{
int i;
char on,off;
PBDR &= ~CS1; /* enable lcd chip select */
if ( data ) {
on=~(SDA|SCK);
off=SCK|DC;
}
else {
on=~(SDA|SCK|DC);
off=SCK;
}
/* clock out each bit, MSB first */
for (i=0x80;i;i>>=1)
{
PBDR &= on;
if (i & byte)
PBDR |= SDA;
PBDR |= off;
}
PBDR |= CS1; /* disable lcd chip select */
}
void lcd_printxy( char x, char y, unsigned char* string, int len )
{
int i;
lcd_write(0xb0+y*16+x,0);
for (i=0; string[i] && i<len; i++)
lcd_write(ascii2lcd[string[i]],1);
}
int main(void)
{
lcd_printxy(0,0,"Open Source",11);
/* simple scroll */
while (1) {
int i,j;
char* string = " Jukebox Jukebox ";
for ( i=0; i<11; i++ ) {
lcd_printxy(0,1,string+i,11);
for (j=0; j<600000; j++);
PBDR ^= 0x40; /* toggle LED (PB6) */
}
}
}
extern const void stack(void);
const void* vectors[] __attribute__ ((section (".vectors"))) =
{
main, /* Power-on reset */
stack, /* Power-on reset (stack pointer) */
main, /* Manual reset */
stack /* Manual reset (stack pointer) */
};

23
www/example/start.s Normal file
View File

@ -0,0 +1,23 @@
! note: sh-1 has a "delay cycle" after every branch where you can
! execute another instruction "for free".
.file "start.s"
.section .text.start
.extern _main
.extern _vectors
.extern _stack
.global _start
.align 2
_start:
mov.l 1f, r1
mov.l 3f, r3
mov.l 2f, r15
jmp @r3
ldc r1, vbr
nop
1: .long _vectors
2: .long _stack
3: .long _main
.type _start,@function

41
www/index.cgi Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/perl
# A very simple load balancing script:
# If more than $nlim hits in under $tlim seconds, redirect to $mirror.
#
# 2002-01-24 Björn Stenberg <bjorn@haxx.se>
# redirect is triggered by more than:
$nlim = 10; # accesses in...
$tlim = 10; # seconds
$mirror = "http://rockbox.sourceforge.net/bjorn.haxx.se/rockbox/";
open FILE, "+<.load" or die "Can't open .load: $!";
flock FILE, LOCK_EX;
@a = <FILE>;
if ( scalar @a > $nlim ) {
$first = shift @a;
}
else {
$first = $a[0];
}
$now = time();
@a = ( @a, "$now\n" );
truncate FILE, 0;
seek FILE, 0, 0;
for ( @a ) {
print FILE $_;
}
flock FILE, LOCK_UN;
close FILE;
$diff = $now - $first;
if ( $diff < $tlim ) {
print "Location: $mirror\n\n";
}
else {
print "Content-Type: text/html\n\n";
open FILE, "<main.html" or die "Can't open main.html: $!\n";
print <FILE>;
close FILE;
}

BIN
www/rockbox100.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
www/rockbox400.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

9
www/schematics/Makefile Normal file
View File

@ -0,0 +1,9 @@
ACTION=@echo preprocessing $@; rm -f $@; fcpp -WWW -I.. -Uunix -H -C -V -LL >$@
SRC := $(wildcard *.t)
OBJS := $(SRC:%.t=%.html)
all: $(OBJS)
%.html : %.t
$(ACTION) $<

Binary file not shown.

Binary file not shown.

13
www/schematics/index.t Normal file
View File

@ -0,0 +1,13 @@
#define _PAGE_ Schematics
#include "head.t"
<p><a href="6k_schematic.pdf">Jukebox 6000</a> R3
<p><a href="rec_main.pdf">Jukebox Recorder</a> main board, rev2
<br><a href="rec_interface.pdf">Jukebox Recorder</a> interface board, rev2.1
<p><a href="remoclone_schem.pdf">Remoclone schematics</a>
<br><a href="PCB_composite_print.pdf">Remoclone PCB composite print</a>
<br><a href="PCB_final_print.pdf">Remoclone PCB final print</a>
#include "foot.t"

Binary file not shown.

BIN
www/schematics/rec_main.pdf Normal file

Binary file not shown.

Binary file not shown.

BIN
www/sh-win/LCDv2Win.zip Normal file

Binary file not shown.

9
www/sh-win/Makefile Normal file
View File

@ -0,0 +1,9 @@
ACTION=@echo preprocessing $@; rm -f $@; fcpp -WWW -I.. -Uunix -H -C -V -LL >$@
SRC := $(wildcard *.t)
OBJS := $(SRC:%.t=%.html)
all: $(OBJS)
%.html : %.t
$(ACTION) $<

BIN
www/sh-win/empty.zip Normal file

Binary file not shown.

BIN
www/sh-win/enviro.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
www/sh-win/enviro2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
www/sh-win/enviro3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

280
www/sh-win/index.t Normal file
View File

@ -0,0 +1,280 @@
#define _PAGE_ Setting up an SH-1 compiler for Windows
#include "head.t"
<P>
by <A href="mailto:edx@codeforce.d2g.com">Felix Arends</A>, 1/8/2002
<BR>
<P>
NOTE: THIS COMPILER DOES NOT YET WORK WITH WINDOWS XP!!!
<P>
I have spent a long time figuring out how to compile SH1 code in windows (using
the sh-elf-gcc compiler) and when I finally compiled the first OS for my
Jukebox I decided to write a little tutorial explaining the setup process.
<H2>
The GNU-SH Tool Chain for Windows
</H2>
<P>
This is actually all you need to download. It includes the binutils, gcc and
newlib. The complete GNUSH Tool Chain (currently v0101) is 117MB but for you it
is enough to download the GNUSH Tool Chain for ELF format (45 MB).
<P>
The GNUSH website can be found at <a href="http://www.kpit.com/download/downloadgnu.htm">
http://www.kpit.com/download/downloadgnu.htm</a> (source code is also
available there) and the direct link to the file you need is <a href="http://www.kpit.com/download/elf.zip">
http://www.kpit.com/download/elf.zip</a>. It uses the cygwin dll to emulate
a linux layer but you do not have to care about that.
<H2>
Setting up&nbsp;the Compiler
</H2>
<P>
Install the GNUSH Tool Chain (nothing you really have to care about during the
installation process). After that you should add some paths to your PATH system
environment variable. If you have Windows 95/98/Me you can do that by modifying
your autoexec.bat:
<P>
Add the following line to your autoexec.bat:
<P>
<TABLE cellSpacing="1" cellPadding="1" width="100%" border="1">
<TBODY>
<TR>
<TD bgcolor="#a0d6e8">
<code>SET PATH=%PATH%;C:\Programs\kpit\GNU-SH v0101
[ELF]\Sh-elf\bin\;C:\Programs\kpit\GNU-SH v0101
[ELF]\Sh-elf\lib\gcc-lib\sh-elf\2.9-GNU-SH-v0101\;C:\Programs\kpit\GNU-SH v0101
[ELF]\Other Utilities</code>
</TD>
</TR>
</TBODY>
</TABLE>
<P>
</CODE>(Note: This is just one single line)
<P>
Replace the beginning of the paths with the path-name you chose to installt the
tools in. Reboot.
<P>
In Windows 2000 it is a bit different. You can find the PATH-environment
variable if you right-click the "My Computer" icon on your desktop and choose
"Properties" in the popup-menu. Go to the "Advanced" tab and click
"Environment-Variables":
<P align="center">
<IMG src="enviro.jpg"> <IMG src="enviro2.jpg"> <IMG src="enviro3.jpg">
<P>
(Note: There is also a PATH-variable in the "System variables" list, it does
not matter which one you edit)
<P>
To the value the PATH-variable already has, add:
<P>
<TABLE cellSpacing="1" cellPadding="1" width="100%" border="1">
<TR>
<TD bgcolor="#a0d6e8">
<code>;C:\Programs\kpit\GNU-SH v0101 [ELF]\Sh-elf\bin\;C:\Programs\kpit\GNU-SH
v0101 [ELF]\Sh-elf\lib\gcc-lib\sh-elf\2.9-GNU-SH-v0101\;C:\Programs\kpit\GNU-SH
v0101 [ELF]\Other Utilities</code>
</TD>
</TR>
</TABLE>
<P>
Replace the program path with the path you chose for the program. You do not
have to reboot.
<H2>
An "empty" System
</H2>
<P>
First of all, I'll explain what to do to compile an "empty" system. It just
initializes and calls the <EM>main</EM> function, but does not do anything
else. You can add some code to the <EM>main</EM> function and simply recompile.
It is actually like this: You don't have to care about any of those files,
because you won't have to change much of them (except the main.cpp of
course!!).
<P>
<STRONG>main.cpp:
<BR>
</STRONG>
<TABLE cellSpacing="1" cellPadding="1" width="550" border="1">
<TR>
<TD bgcolor="#a0d6e8">
<P>
<code><font color="#0000ff">int</font> __main(<font color="#0000ff">void</font>){}
<BR>
<BR>
<font color="#0000ff">int</font> main(<font color="#0000ff">void</font>)
<BR>
{
<BR>
<font color="#009000">&nbsp;&nbsp;&nbsp; // add code here</font>
<BR>
}
<BR>
<BR>
<FONT color="#0000ff">extern</FONT> <FONT color="#0000ff">const</FONT> <FONT color="#0000ff">
void</FONT> stack(<FONT color="#0000ff">void</FONT>);
<br>
<br>
<FONT color="#0000ff">const</FONT> <FONT color="#0000ff">void</FONT>* vectors[]
__attribute__ ((section (".vectors"))) =
<br>
{
<br>
&nbsp;&nbsp;&nbsp; main, <FONT color="#009000">/* Power-on reset */</FONT>
<br>
&nbsp;&nbsp;&nbsp; stack, <FONT color="#009000">/* Power-on reset (stack pointer)
*/</FONT>
<br>
&nbsp;&nbsp;&nbsp; main, <FONT color="#009000">/* Manual reset */</FONT>
<br>
&nbsp;&nbsp;&nbsp; stack <FONT color="#009000">/* Manual reset (stack pointer) */</FONT>
<br>
};
<br>
</code>
</TD>
</TR>
</TABLE>
<P>
We need a start-up assembler code:
<P>
<STRONG>start.asm
<br>
</STRONG>
<TABLE cellSpacing="1" cellPadding="1" width="550" border="1">
<TR>
<TD bgcolor="#a0d6e8">
<code>
<pre>! note: sh-1 has a "delay cycle" after every branch where you can
! execute another instruction "for free".
.file"start.asm"
.section.text.start
.extern_main
.extern _vectors
.extern _stack
.global _start
.align 2
_start:
mov.l1f, r1
mov.l3f, r3
mov.l2f, r15
jmp@r3
ldcr1, vbr
nop
1:.long_vectors
2:.long_stack
3:.long_main
.type_start,@function</pre>
</code>
</TD>
</TR>
</TABLE>
<P>
(I took this code from Björn's LCDv2 source)
<P>
Then we need a linker configuration file:
<P>
<STRONG>linker.cfg</STRONG>
<BR>
<TABLE cellSpacing="1" cellPadding="1" width="550" border="1">
<TR>
<TD bgcolor="#a0d6e8">
<P>
<code>
<pre>ENTRY(_start)
OUTPUT_FORMAT(elf32-sh)
SECTIONS
{
.vectors 0x09000000 :
{
*(.vectors);
. = ALIGN(0x200);
*(.text.start)
*(.text)
*(.rodata)
}
.bss :
{
_stack = . + 0x1000;
}
.pad 0x0900C800 :
{
LONG(0);
}
}</pre>
</code>
</TD>
</TR>
</TABLE>
<P>
(This code comes from Börn's LCDv2 as well)
<P>
Last but not least, we need a batch file to link all this and output a usable
.mod file (you don't really need a batch file if you want to enter all the
commands over and over angain :])
<P>
<STRONG>make.bat</STRONG>
<BR>
<TABLE cellSpacing="1" cellPadding="1" width="550" border="1">
<TR>
<TD bgcolor="#a0d6e8">
<P>
<code>
<pre>SET INCLUDES=
SET SOURCEFILES=main.c
SET OBJECTS=main.o start.o
sh-elf-as start.asm -o start.o -L -a
sh-elf-gcc -O2 -m1 -o main.o -c -nostdlib %INCLUDES% %SOURCEFILES%
sh-elf-ld -o main.out %OBJECTS% -Tlinker.cfg
padit main.out
scramble main.out archos.mod
PAUSE</pre>
</code>
</TD>
</TR>
</TABLE>
<P>
And that's it! I have prepared all those files in a .zip archive for you so you
don't have to copy'n'paste that much :). I have also prepared a package with
the LCDv2 code Björn wrote (ready to compile with Windows).
<P>
<a href="LCDv2Win.zip">empty.zip</a>
<BR>
<a href="LCDv2Win.zip">LCDv2Win.zip</a>
<P>
I hope this tutorial helped you to compile an Archos firmware with windows. If
you have any questions, comments or corrections, please mail to <A href="mailto:edx@codeforce.d2g.com">
edx@codeforce.d2g.com</A>
#include "foot.t"