Initial revision

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-03-27 09:25:09 +00:00
parent f883986dd1
commit 554b95aad3
8 changed files with 844 additions and 0 deletions

44
www/Makefile Normal file
View File

@ -0,0 +1,44 @@
ACTION=@echo preprocessing $@; rm -f $@; fcpp -WWW -Uunix -H -C -V -LL >$@
SRC := $(wildcard *.t)
OBJS := $(SRC:%.t=%.html)
.SUFFIXES: .t .html
%.html : %.t
$(ACTION) $<
all: $(OBJS) descramble descramble.static.bz2 sh2d sh2d.static.bz2 \
scramble scramble.static.bz2
@(cd schematics; $(MAKE))
@(cd docs; $(MAKE))
@(cd mods; $(MAKE))
main.html: main.t activity.html
descramble: descramble.c
cc -Wall -ansi -O2 -s -o $@ $<
chmod a+r descramble
descramble.static.bz2: descramble.c
cc -static -O2 -s -o descramble.static $<
bzip2 -f descramble.static
chmod a+r descramble.static.bz2
scramble: scramble.c
cc -Wall -ansi -O2 -s -o $@ $<
chmod a+r scramble
scramble.static.bz2: scramble.c
cc -static -O2 -s -o scramble.static $<
bzip2 -f scramble.static
chmod a+r scramble.static.bz2
sh2d: sh2d.c
cc -O2 -s -o $@ $<
chmod a+r sh2d
sh2d.static.bz2: sh2d.c
cc -static -O2 -s -o sh2d.static $<
bzip2 -f sh2d.static
chmod a+r sh2d.static.bz2

12
www/activity.t Normal file
View File

@ -0,0 +1,12 @@
#define STATUS(_a_,_b_,_c_) \
<tr><td bgcolor="#dddddd">_a_</td><td bgcolor="#eeeeee">_b_</td><td bgcolor="#dddddd">_c_</td></tr>
<table>
<tr bgcolor="#cccccc"><th>Person</th><th>Activity</th><th>Current status</th></tr><tr>
STATUS(Björn,I2C driver and MAS serial port,Idle - trying to repair his Archos...)
STATUS(Linus,Serial port GDB stub to bring remote debugging to the archos,Works well; some details left)
STATUS(Alan,FAT-32 file system and handling,Can create files. Not safe yet ;->)
STATUS(Daniel,GUI simulator for X11,Partly working)
STATUS(Rob,Assembling a FAQ,Just began)
</tr></table>
<i><small>Updated __DATE__</small></i>

92
www/cross-gcc.t Normal file
View File

@ -0,0 +1,92 @@
#define _PAGE_ Building the SH1 cross compiler
#include "head.t"
<p>
In this example I will assume that you are running Linux with the bash shell.
We will only build the C compiler along with the assembler, linker and stuff.
<h2>Download the source code</h2>
<p>
You will need the following archives:
<ul>
<li>binutils-2.11.tar.gz (find it at your closest GNU FTP site)
<li>gcc-3.0.3.tar.gz (find it at your closest GNU FTP site)
<li>newlib-1.10.0.tar.gz (go to <a href="http://sources.redhat.com/newlib/">the newlib home page</a> for information)
<li>(optional) gdb-5.1.1.tar.gz (find it at your closest GNU FTP site)
</ul>
<h2>Unpack the archives</h2>
<p>
<pre>
/home/linus> tar zxf binutils-2.11.tar.gz
/home/linus> tar zxf gcc-3.0.3.tar.gz
/home/linus> tar zxf newlib-1.10.0.tar.gz
/home/linus> tar zxf gdb-5.1.1.tar.gz
</pre>
<h2>Create the directory tree</h2>
<p>
<pre>
/home/linus> mkdir build
/home/linus> cd build
/home/linus/build> mkdir binutils
/home/linus/build> mkdir gcc
/home/linus/build> mkdir gdb
</pre>
<h2>Create the newlib and libgloss links</h2>
<p>
The GCC configuration script finds the newlib and libgloss files if they are in the GCC tree. Let's create two soft links.
<pre>
/home/linus> cd gcc-3.0.3
/home/linus/gcc-3.0.3> ln -s ../newlib-1.10.0/newlib .
/home/linus/gcc-3.0.3> ln -s ../newlib-1.10.0/libgloss .
</pre>
<h2>Make up your mind</h2>
<p>
Now is the time to decide where you want the tools to be installed. This is
the directory where all binaries, libraries, man pages and stuff end up when
you do "make install".
<p>
In this example I have chosen "/home/linus/sh1" as my installation directory, or <i>prefix</i> as it is called. Feel free to use any prefix, like
/usr/local/sh1 for example.
<h2>Build binutils</h2>
<p>
We will start with building the binutils (the assembler, linker and stuff).
This is pretty straightforward. We will be installing the whole tool chain
in the /home/linus/sh1 directory.
<pre>
/home/linus> cd build/binutils
/home/linus/build/binutils> ../../binutils-2.11/configure --target=sh-elf --prefix=/home/linus/sh1
/home/linus/build/binutils> make
/home/linus/build/binutils> make install
</pre>
<h2>Build GCC</h2>
<p>
Now you are ready to build GCC. To do this, you must have the newly built
binutils in the PATH.
<pre>
/home/linus> export PATH=/home/linus/sh1/bin:$PATH
/home/linus> cd build/gcc
/home/linus/gcc> ../../gcc-3.0.3/configure --target=sh-elf --prefix=/home/linus/sh1 --with-newlib --enable-languages=c
/home/linus/build/binutils> make
/home/linus/build/binutils> make install
</pre>
<h2>Build GDB</h2>
<p>
If you are planning to debug your code with GDB, you have to build it as well.
<pre>
/home/linus> export PATH=/home/linus/sh1/bin:$PATH
/home/linus> cd build/gdb
/home/linus/gdb> ../../gdb-5.1.1/configure --target=sh-elf --prefix=/home/linus/sh1
/home/linus/build/binutils> make
/home/linus/build/binutils> make install
</pre>
<h2>Done</h2>
<p>
If someone up there likes you, you now have a working tool chain for SH1.
To compile a file with gcc:
<pre>
/home/linus> sh-elf-gcc -c main.o main.c
</pre>
Good luck!
<p>
<i>Linus</i>
#include "foot.t"

4
www/foot.t Normal file
View File

@ -0,0 +1,4 @@
<hr size=1 align="left" width="10%">
<small><i>Page was last modified __DATE__</i> <a href=mailto:bjorn@haxx.se>Björn Stenberg</a></small>
</body>
</html>

25
www/head.t Normal file
View File

@ -0,0 +1,25 @@
#define BGCOLOR "#99ccff"
#define TITLE(_x) <h1>_x</h1>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
#ifdef _PAGE_
<title>Rockbox - _PAGE_</title>
#else
<title>Rockbox</title>
#endif
<meta name="author" content="Björn Stenberg, in Emacs">
#ifndef _PAGE_
<meta name="keywords" content="bjorn,stenberg,computer,programming,mtb,stockholm,software,sms,byta,bostad">
#endif
</head>
<body bgcolor=BGCOLOR text="black" link="blue" vlink="purple" alink="red">
#ifdef _LOGO_
_LOGO_
#else
<a href="/rockbox/"><img align="right" src="/rockbox/rockbox100.png" width=99 height=30></a>
TITLE(_PAGE_)
#endif

44
www/lock.t Normal file
View File

@ -0,0 +1,44 @@
#define _PAGE_ Unlocking a password protected harddisk
#include "head.t"
<p>During development of the Rockbox firmware, on several occations the harddisk has become locked, i.e. password protected. This results in the Archos displaying:
<pre>
Part. Error
Pls Chck HD
</pre>
<p>We are still not 100% sure why it happens. Theories range from
low-power conditions to accidental chip select failure.
It has also happened for normal users,
using the standard Archos-supplied firmware, although it's more frequent for
us developers.
<p>We do however know how to unlock the disk:
<h2>Windows/DOS unlock</h2>
<p>Note: This requires taking the Archos apart, which will void your warranty!
<ol>
<li>Grab
<a href="http://www.upsystems.com.ua/support/alexmina/atapwd.zip">atapwd</a>
(written by
<a href="http://www.upsystems.com.ua/support/alexmina/">Alex Mina</a>)
<li>Create a bootable DOS floppy disk, and put atapwd.exe on it
<li>Remove the harddisk from your Archos and plug it into a laptop (or a standard PC, using a 3.5" =&gt; 2.5" IDE adapter)
<li>Boot from the floppy and run atapwd.exe
<li>Select the locked harddrive and press enter for the menu
<li>For Fujitsu disks: Choose "unlock with user password", then "disable with user password". The password is empty, so just press enter at the prompt.
<li>For Toshiba disks, if the above doesn't work: Choose "unlock with master password", then "disable with master password". The password is all spaces.
<li>Your disk is now unlocked. Shut down the computer and remove the disk.
</ol>
<p>Big thanks to Magnus Andersson for discovering the Fujitsu (lack of) user password!
<h2>Linux unlock</h2>
<p>For those of us using Linux, we have written
<a href="mail/rockbox-archive-2002-03/att-0010/01-isd200.diff">an isd200 driver patch for unlocking the disk</a>.
This modified driver will automatically unlock the disk when you connect your Archos via USB, so you don't have to do anything special. Apply the patch to a 2.4.18 linux kernel tree.
#include "foot.t"

212
www/main.t Normal file
View File

@ -0,0 +1,212 @@
#define _LOGO_ <img src="rockbox400.png" width=400 height=123>
#define _PAGE_ Open Source Jukebox Firmware
#include "head.t"
<p><small><a href="notes.html">research notes</a> &middot;
<a href="docs/">data sheets</a> &middot;
<a href="schematics/">schematics</a> &middot;
<a href="mods/">hardware mods</a> &middot;
<a href="http://bjorn.haxx.se/rockbox/mail.cgi">mail list archive</a> &middot;
<a href="#descrambler">descrambler</a> &middot;
<a href="#sh2d">sh2d disassembler</a> &middot;
<a href="/isd200/archos.html">archos internals</a> &middot;
<a href="http://sourceforge.net/projects/rockbox/">sourceforge project</a>
</small>
<h2>Purpose</h2>
<p>The purpose of this project is to write an Open Source replacement
firmware for the Archos Jukebox <i>6000</i>, <i>Studio</i> and <i>Recorder</i> MP3 players.
<p>The main emphasis and first target is the Jukebox 6000.
#if 0
<h2>Warning</h2>
<p>All firmware mods on this page are still <i><b>highly experimental</b></i>.
Try them on your own risk. If you are not 100% sure of what you are doing, keep cool.
#endif
<h2>Activity</h2>
#include "activity.html"
<h2>News</h2>
<p><i>2002-03-25</i>: New section for
<a href="mods/">hardware modifications</a>.
First out is the long awaited
<a href="mods/serialport.html">serial port mod</a>.
<p><i>2002-03-25</i>: New instructions for
<a href="cross-gcc.html">how to build an SH-1 cross-compiler</a>.
<p><i>2002-03-14</i>: New linux patch and instructions for
<a href="lock.html">unlocking the archos harddisk</a> if you have the "Part. Error" problem.
<p><i>2002-03-08</i>: Uploaded a simple example, showing
<a href="example/">how to build a program for the Archos</a>.
<p><i>2002-03-05</i>: The
<a href="lock.html">harddisk password lock problem is solved</a>!
Development can now resume at full speed!
<p><i>2002-01-29</i>: If you have feature requests or suggestions,
please submit them to our
<a href="http://sourceforge.net/projects/rockbox/">Sourceforge page</a>.
<p><i>2002-01-19</i>: Cool logo submitted by Thomas Saeys.
<p><i>2002-01-16</i>: The project now has a proper name: Rockbox.
Logos are welcome! :-)
<br>Also, Felix Arends wrote a quick <a href="sh-win/">tutorial</a>
for how to get sh-gcc running under windows.
<p><i>2002-01-09</i>: Nicolas Sauzede
<a href="mail/rockbox-archive-2002-01/0096.shtml">found out</a>
how to
<a href="mail/rockbox-archive-2002-01/0099.shtml">display icons and custom characters</a> on the Jukebox LCD.
<p><i>2002-01-08</i>: The two LCD charsets have been
<a href="notes.html#charsets">mapped and drawn</a>.
<p><i>2002-01-07</i>:
<a href="mail/rockbox-archive-2002-01/0026.shtml">Jukebox LCD code</a>.
I have written a small test program that scrolls some text on the display.
You need
<a href="mail/rockbox-archive-2002-01/att-0026/01-archos.mod.gz">this file</a>
for units with ROM earlier than 4.50 and
<a href="mail/rockbox-archive-2002-01/att-0050/02-archos.mod.gz">this file</a>
for all others. (The files are gzipped, you need to unzip them before they will work.)
<p><i>2001-12-29</i>: Recorder LCD code. Gary Czvitkovicz knew the Recorder LCD controller since before and wrote some
<a href="mail/rockbox-archive-2001-12/att-0145/01-ajbr_lcd.zip">code</a>
that writes text on the Recorder screen.
<p><i>2001-12-13</i>: First program
<a href="mail/rockbox-archive-2001-12/0070.shtml">released</a>!
A 550 bytes long
<a href="mail/rockbox-archive-2001-12/att-0070/01-archos.mod">archos.mod</a>
that performs the amazing magic of flashing the red LED. :-)
<p><i>2001-12-11</i>: Checksum algorithm solved, thanks to Andy Choi. A new "scramble" utility is available.
<p><i>2001-12-09</i>: Working my way through the setup code. The <a href="notes.html">notes</a> are being updated continously.
<p><i>2001-12-08</i>: Analyzed the exception vector table. See <a href="notes.html">the notes</a>. Also, a <a href="mail.cgi">mailing list archive</a> is up.
<p><i>2001-12-07</i>:
I just wrote this web page to announce descramble.c.
I've disassembled one firmware version and looked a bit on the code, but no real analysis yet.
Summary: Lots of dreams, very little reality. :-)
<p>I've set up a mailing list: rockbox@cool.haxx.se.
To subscribe, send a message to <a href="mailto:majordomo@cool.haxx.se">majordomo@cool.haxx.se</a> with the words "subscribe rockbox" in the body.
<h2>About the hardware</h2>
<p>I wrote a <a href="/isd200/archos.html">"dissection" page</a> some months ago,
showing the inside of the Archos and listing the main components.
I have also collected a couple of <a href="docs/">data sheets</a>.
<h2>About the software</h2>
<p>The player has one version of the firmware burnt into flash ROM.
The first thing this version does after boot is to look for a file called
"archos.mod" in the root directory of the harddisk.
If it exists, it is loaded into RAM and started.
This is how firmware upgrades are loaded.
<h3>File format</h3>
<p>The archos.mod file is scrambled, but luckily not using encryption.
<p>Each data byte is inverted and ROLed 1 bit.
The data is then spread over four memory segments. The two least significant bits of the address is used as segment number and the rest as offset in the segment. So, basically:
<ul>
<li>segment number = address % 4
<li>segment offset = address / 4
<li>segment length = imgsize / 4
</ul>
<p>A 6-byte header is added to the beginning of the scrambled image:
<ul>
<li>32 bit length (big-endian)
<li>16 bit checksum
</ul>
<a name="descrambler">
<p>I've written a small utility to descramble firmware files:
<ul>
<li><a href="descramble.c">descramble.c</a> - 1835 bytes - The source code (pure ANSI C, should work everywhere). GPL licensed.
<li><a href="descramble">descramble</a> - 4280 bytes - Dynamically linked i386 linux executable
<li><a href="descramble.static.bz2">descramble.static.bz2</a> - 176015 bytes - bzip2 compressed statically linked i386 linux executable
<li><a href="descramble.exe">descramble.exe</a> - 45056 bytes - win32 executable
</ul>
<a name="scrambler">
<p>...and one to scramble files:
<ul>
<li><a href="scramble.c">scramble.c</a> - 2242 bytes - The source code (pure ANSI C, should work everywhere). GPL licensed.
<li><a href="scramble">scramble</a> - 4376 bytes - Dynamically linked i386 linux executable
<li><a href="scramble.static.bz2">scramble.static.bz2</a> - 176117 bytes - bzip2 compressed statically linked i386 linux executable
<li><a href="scramble.exe">scramble.exe</a> - 93385 bytes - win32 executable
</ul>
<h2>So?</h2>
<p>We now have the possiblity to actually research how the Archos works
and create our own software for it.
There is of course a long way still to go before we can start playing
around with fancy mp3 features.
<a name="sh2d">
<h3>Disassembler</h3>
<p>I found a nice public domain SH-1/SH-2 disassembler written by Bart Trzynadlowski, called <a href="http://saturndev.emuvibes.com/Files/sh2d020.zip">sh2d</a>:
<p><b>Update:</b> I've added address lookup and register name translation to the disassembler (2001-12-09)
<ul>
<li><a href="sh2d.c">sh2d.c</a> - 28 kB - Source code
<li><a href="sh2d">sh2d</a> - 15 kB - Dynamically linked i386 linux executable
<li><a href="sh2d.static.bz2">sh2d.static.bz2</a> - 170 kB - bzip2 compressed statically linked i386 linux executable
<li><a href="sh2d.exe">sh2d.exe</a> - 40 kB - win32 executable (original version; no lookup)
</ul>
<h3>Compiler</h3>
<p>GCC supports the SH processor. Just
<a href="cross-gcc.html">cook yourself a cross-compiler</a>
(sh-elf-gcc) and voila, instant SH-1 code.
<p>There are also
<a href="http://www.sh-linux.org/rpm/RPMS/i386/RedHat7.1/">
pre-cooked RH7.1 RPMs</a> available from sh-linux.org
<h2>Dreams</h2>
<p>Ok, forget about reality, what could we do with this?
<ul>
<li>All those simple mp3-play features we sometimes miss:
<ul>
<li>No pause between songs
<li>Mid-song resume
<li>Mid-playlist resume
<li>No-scan playlists
<li>Unlimited playlist size
<li>Autobuild playlists (such as "all songs in this directory tree")
<li>Auto-continue play in the next directory
<li>Current folder and all sub-folder random play
<li>Full disk random play
<li>REAL random (if press back it goes to the previous song that was played)
<li>Multi song queue (folder queue)
</ul>
<li>Faster scroll speed
<li>Archos Recorder support. Most of the hardware is the same, but the display and some other things differ.
<li>All kinds of cool features done from the wire remote control, including controlling your Archos from your car radio (req hw mod)
<li>Ogg Vorbis support [unverified: the MAS is somewhat programmable, but enough?]
<li>Support for megabass switch (req hw mod) [unverified: I just saw the DAC docs shows how to do it switchable. we need a free port pin to be able to switch]
<li>Player control via USB [unverified]
<li>Memory expansion? [doubtful: the current DRAM chip only has 10 address lines. we'd have to pull off one heck of a hw mod to expand that]
</ul>
#include "foot.t"

411
www/notes.t Normal file
View File

@ -0,0 +1,411 @@
#define _PAGE_ Jukebox notes
#include "head.t"
<h2>Exception vectors</h2>
<p>The first 0x200 bytes of the image appears to be the exception vector table.
The vectors are explained on pages 54 and 70-71 in the SH-1 Hardware Manual,
<p>Here's the vector table for v5.03a:
<table border=1><tr>
<th>Vector</th><th>Address</th><th>Description/interrupt source</th>
<tr><td> 0</td><td>09000200</td><td>Power-on reset PC</td></tr>
<tr><td> 1</td><td>0903f2bc</td><td>Power-on reset SP</td></tr>
<tr><td> 2</td><td>09000200</td><td>Manual reset PC</td></tr>
<tr><td> 3</td><td>0903f2bc</td><td>Manual reset SP</td></tr>
<tr><td> 11</td><td>09000cac</td><td>NMI</td></tr>
<tr><td> 64</td><td>0900c060</td><td>IRQ0</td></tr>
<tr><td> 70</td><td>09004934</td><td>IRQ6</td></tr>
<tr><td> 78</td><td>09004a38</td><td>DMAC3 DEI3</td></tr>
<tr><td> 80</td><td>0900dfd0</td><td>ITU0 IMIA0</td></tr>
<tr><td> 88</td><td>0900df60</td><td>ITU2 IMIA2</td></tr>
<tr><td> 90</td><td>0900df60</td><td>ITU2 OVI2</td></tr>
<tr><td>104</td><td>09004918</td><td>SCI1 ERI1</td></tr>
<tr><td>105</td><td>090049e0</td><td>SCI1 Rxl1</td></tr>
<tr><td>109</td><td>09010270</td><td>A/D ITI</td></tr>
</table>
<p>From the use of address 0x0903f2bc as stack pointer, we can deduce
that the DRAM is located at address 0x09000000.
This is backed by the HW manual p102, which says that DRAM can only be at put on CS1, which is either 0x01000000 (8-bit) or 0x09000000 (16-bit).
<p>The vector table also corresponds with the fact that there is code at address 0x200 of the image file. 0x200 is thus the starting point for all code.
<h2>Port pins</h2>
<p><table><tr valign="top"><td>
<p>Port A pin function configuration summary:
<table border=1>
<tr><th>Pin</th><th>Function</th><th>Input/output</th><th>Initial value</th><th>Used for</th></tr>
<tr><td>PA0</td><td>i/o</td><td>Input</td><td></td><td>DC adapter detect</td></tr>
<tr><td>PA1</td><td>/RAS</td><td>Output</td><td></td><td>DRAM</td></tr>
<tr><td>PA2</td><td>/CS6</td><td>Output</td><td></td><td>IDE</td></tr>
<tr><td>PA3</td><td>/WAIT</td></tr>
<tr><td>PA4</td><td>/WR</td><td>Output</td><td></td><td>DRAM+Flash</td></tr>
<tr><td>PA5</td><td>i/o</td><td>Input</td><td></td><td>Key: ON</td></tr>
<tr><td>PA6</td><td>/RD</td><td>Output</td><td></td><td>IDE</td></tr>
<tr><td>PA7</td><td>i/o</td><td>Output</td><td>0</td></tr>
<tr><td>PA8</td><td>i/o</td><td>Output</td><td>0</td></tr>
<tr><td>PA9</td><td>i/o</td><td>Output</td><td>1</td></tr>
<tr><td>PA10</td><td>i/o</td><td>Output</td></tr>
<tr><td>PA11</td><td>i/o</td><td>Input</td><td></td><td>Key: STOP</td></tr>
<tr><td>PA12</td><td>/IRQ0</td></tr>
<tr><td>PA13</td><td>i/o</td></tr>
<tr><td>PA14</td><td>i/o</td></tr>
<tr><td>PA15</td><td>i/o</td><td>Input</td><td></td><td>USB cable detect</td></tr>
</table>
</td><td>
<p>Port B pin function configuration summary:
<table border=1>
<tr><th>Pin</th><th>Function</th><th>Input/output</th><th>Initial value</th><th>Used for</th></tr>
<tr><td>PB0</td><td>i/o</td><td>Output</td><td></td><td>LCD</td></tr>
<tr><td>PB1</td><td>i/o</td><td>Output</td><td></td><td>LCD</td></tr>
<tr><td>PB2</td><td>i/o</td><td>Output</td><td></td><td>LCD</td></tr>
<tr><td>PB3</td><td>i/o</td><td>Output</td><td></td><td>LCD</td></tr>
<tr><td>PB4</td><td>i/o</td><td>Input</td></tr>
<tr><td>PB5</td><td>i/o</td><td>Output</td><td>1</td><td>I²C data</td></tr>
<tr><td>PB6</td><td>i/o</td><td>Output</td><td>0</td></tr>
<tr><td>PB7</td><td>i/o</td><td>Output</td><td></td><td>I²C clock</td></tr>
<tr><td>PB8</td><td>i/o</td></tr>
<tr><td>PB9</td><td>TxD0</td><td>Output</td><td></td><td>MPEG</td></tr>
<tr><td>PB10</td><td>RxD1</td><td>Input</td></td><td></td><td>Remote</td></tr>
<tr><td>PB11</td><td>TxD1</td><td>Output</td><td></td><td>Remote?</td></tr>
<tr><td>PB12</td><td>SCK0</td><td>Output</td><td></td><td>MPEG</td></tr>
<tr><td>PB13</td><td>i/o</td></tr>
<tr><td>PB14</td><td>/IRQ6</td><td>Input</td></tr>
<tr><td>PB15</td><td>i/o</td><td>Input</td></tr>
</table>
</td></tr></table>
<p>Port C pin function configuration summary:
<table border=1>
<tr><th>Pin</th><th>Function</th><th>Input/output</th><th>Used for</th></tr>
<tr><td>PC0</td><td>i/o</td><td>Input</td><td>Key: - / PREV</td></tr>
<tr><td>PC1</td><td>i/o</td><td>Input</td><td>Key: MENU</td></tr>
<tr><td>PC2</td><td>i/o</td><td>Input</td><td>Key: + / NEXT</td></tr>
<tr><td>PC3</td><td>i/o</td><td>Input</td><td>Key: PLAY</td></tr>
<tr><td>PC4</td><td>i/o</td><td>Input</td></tr>
<tr><td>PC5</td><td>i/o</td><td>Input</td></tr>
<tr><td>PC6</td><td>i/o</td><td>Input</td></tr>
<tr><td>PC7</td><td>i/o</td><td>Input</td></tr>
</table>
<h2>Labels</h2>
<p>Note: Everything is about v5.03a.
<ul>
<li>0x0200: Start point
<li>0x383d: Text: "Archos Jukebox hard drive is not bootable! Please insert a bootable floppy and press any key to try again" :-)
<li>0xc390: Address of "Update" string shown early on LCD.
<li>0xc8c0: Start of setup code
<li>0xc8c8: DRAM setup
<li>0xc4a0: Serial port 1 setup
<li>0xc40a: Port configuration setup
<li>0xe3bc: Character set conversion table
<li>0xfcd0: ITU setup
<li>0xc52a: Memory area #6 setup
<li>0x114b0: Start of menu strings
</ul>
<h2>Setup</h2>
<p>The startup code at 0x200 (0x09000200) naturally begins with setting up the system.
<h3>Vector Base Register</h3>
<p>The first thing the code does is setting the VBR, Vector Base Register,
and thus move the exception vector table from the internal ROM at address 0
to the DRAM at address 0x09000000:
<pre>
0x00000200: mov.l @(0x02C,pc),r1 ; 0x0000022C (0x09000000)
0x00000202: ldc r1,vbr
</pre>
<h3>Stack</h3>
<p>The next instruction loads r15 with the contents of 0x228, which is 0x0903f2bc. This is the stack pointer, which is used all over the code.
<pre>
0x00000204: mov.l @(0x024,pc),r15 ; 0x00000228 (0x0903F2BC)
</pre>
<p>After that the code jumps to the hardware setup at 0xc8c0.
<pre>
0x00000206: mov.l @(0x01C,pc),r0 ; 0x00000220 (0x0900C8C0)
0x00000208: jsr @r0
</pre>
<h3>DRAM controller</h3>
<p>First up is DRAM setup, at 0xc8c8. It sets the memory controller registers:
<pre>
0x0000C8C8: mov.l @(0x068,pc),r2 ; 0x0000C930 (0x05FFFFA8)
0x0000C8CA: mov.w @(0x05A,pc),r1 ; 0x0000C924 (0x1E00)
0x0000C8CC: mov.l @(0x068,pc),r7 ; 0x0000C934 (0x0F0001C0)
0x0000C8CE: mov.w r1,@r2 ; 0x1e00 -> DCR
0x0000C8D0: mov.l @(0x068,pc),r2 ; 0x0000C938 (0x05FFFFAC)
0x0000C8D2: mov.w @(0x054,pc),r1 ; 0x0000C926 (0x5AB0)
0x0000C8D4: mov.w r1,@r2 ; 0x5ab0 -> RCR
0x0000C8D6: mov.l @(0x068,pc),r2 ; 0x0000C93C (0x05FFFFB2)
0x0000C8D8: mov.w @(0x050,pc),r1 ; 0x0000C928 (0x9605)
0x0000C8DA: mov.w r1,@r2 ; 0x9505 -> RTCOR
0x0000C8DC: mov.l @(0x064,pc),r2 ; 0x0000C940 (0x05FFFFAE)
0x0000C8DE: mov.w @(0x04C,pc),r1 ; 0x0000C92A (0xA518)
0x0000C8E0: mov.w r1,@r2 ; 0xa518 -> RTCSR
</pre>
<h3>Serial port 0</h3>
<p>Code starting at 0x483c.
<p>As C code:
<table border><tr><td bgcolor="#a0d6e8">
<pre>
void setup_sci0(void)
{
/* set PB12 to output */
PBIOR |= 0x1000;
&nbsp;
/* Disable serial port */
SCR0 = 0x00;
&nbsp;
/* Syncronous, 8N1, no prescale */
SMR0 = 0x80;
&nbsp;
/* Set baudrate 1Mbit/s */
BRR0 = 0x03;
&nbsp;
/* use SCK as serial clock output */
SCR0 = 0x01;
&nbsp;
/* Clear FER and PER */
SSR0 &= 0xe7;
&nbsp;
/* Set interrupt D priority to 0 */
IPRD &= 0x0ff0;
&nbsp;
/* set IRQ6 and IRQ7 to edge detect */
ICR |= 0x03;
&nbsp;
/* set PB15 and PB14 to inputs */
PBIOR &= 0x7fff;
PBIOR &= 0xbfff;
&nbsp;
/* set IRQ6 prio 8 and IRQ7 prio 0 */
IPRB = ( IPRB & 0xff00 ) | 0x80;
&nbsp;
/* Enable Tx (only!) */
SCR0 = 0x20;
}
</pre>
</td></tr></table>
<h3>Serial port 1</h3>
<p>Code starting at 0x47a0.
<p>As C code:
<table border><tr><td bgcolor="#a0d6e8">
<pre>
&#35;define SYSCLOCK 12000000
&#35;define PRIORITY 8
&nbsp;
void setup_sci1(int baudrate)
{
/* Disable serial port */
SCR1 = 0;
&nbsp;
/* Set PB11 to Tx and PB10 to Rx */
PBCR1 = (PBCR1 & 0xff0f) | 0xa0;
&nbsp;
/* Asynchronous, 8N1, no prescaler */
SMR1 = 0;
&nbsp;
/* Set baudrate */
BRR1 = SYSCLOCK / (baudrate * 32) - 1;
&nbsp;
/* Clear FER and PER */
SSR1 &= 0xe7;
&nbsp;
/* Set interrupt priority to 8 */
IPRE = (IPRE & 0x0fff) | (PRIORITY << 12);
&nbsp;
/* Enable Rx, Tx and Rx interrupt */
SCR1 = 0x70;
}
</pre>
</td></tr></table>
<h3>Pin configuration</h3>
<p>Starting at 0xc40a:
<p><tt>CASCR = 0xafff</tt>: Column Address Strobe Pin Control Register. Set bits CASH MD1 and CASL MD1.
<h4>Port A</h4>
<br><tt>PACR1 = 0x0102</tt>: Set pin functions
<br><tt>PACR2 = 0xbb98</tt>: Set pin functions
<br><tt>PAIOR &= 0xfffe</tt>: PA0 is input
<br><tt>PAIOR &= 0xffdf</tt>: PA5 is input
<br><tt>PADR &= 0xff7f</tt>: Set pin PA7 low
<br><tt>PAIOR |= 0x80</tt>: PA7 is output
<br><tt>PAIOR |= 0x100</tt>: PA8 is output
<br><tt>PADR |= 0x200</tt>: Set pin PA9 high
<br><tt>PAIOR |= 0x200</tt>: PA9 is output
<br><tt>PAIOR |= 0x400</tt>: PA10 is output
<br><tt>PAIOR &= 0xf7ff</tt>: PA11 is input
<br><tt>PAIOR &= 0xbfff</tt>: PA14 is input
<br><tt>PAIOR = 0x7fff</tt>: PA15 is input
<br><tt>PADR &= 0xfeff</tt>: Set pin PA8 low
<h4>Port B</h4>
<br><tt>PBCR1 = 0x12a8</tt>: Set pin functions
<br><tt>PBCR2 = 0x0000</tt>: Set pin functions
<br><tt>PBDR &= 0xffef</tt>: Set pin PB4 low
<br><tt>PBIOR &= 0xffef</tt>: PB4 is input
<br><tt>PBIOR |= 0x20</tt>: PB5 is output
<br><tt>PBIOR |= 0x40</tt>: PA6 is output
<br><tt>PBDR &= 0xffbf</tt>: Set pin PB6 low
<br><tt>PBDR |= 0x20</tt>: Set pin PB5 high
<h3>ITU (Integrated Timer Pulse Unit)</h3>
<p>Starting at 0xfcd0:
<p><tt>TSNC &= 0xfe</tt>: The timer counter for channel 0 (TCNT0) operates independently of other channels
<br><tt>TMDR &= 0xfe</tt>: Channel 0 operates in normal (not PWM) mode
<br><tt>GRA0 = 0x1d4c</tt>:
<br><tt>TCR0 &= 0x67; TCR0 |= 0x23</tt>: TCNT is cleared by general register A (GRA) compare match or input capture. Counter clock = f/8
<br><tt>TIOR0 = 0x88</tt>: Compare disabled
<br><tt>TIER0 = 0xf9</tt>: Enable interrupt requests by IMFA (IMIA)
<br><tt>IPRC &= 0xff0f; IPRC |= 0x30</tt>: Set ITU0 interrupt priority level 3.
<br><tt>TSTR |= 0x01</tt>: Start TCNT0
<h3>Memory area #6 ?</h3>
<p>From 0xc52a:
<p><tt>PADR |= 0x0200</tt>: Set PA13 high
<br><tt>WCR1 = 0x40ff</tt>: Enable /WAIT support for memory area 6. Hmmm, what's on CS6?
<br><tt>WCR1 &= 0xfdfd</tt>: Turn off RW5 (was off already) and WW1 (enable short address output cycle).
<br><tt>WCR3 &= 0xe7ff</tt>: Turn off A6LW1 and A6LW0; 1 wait state for CS6.
<br><tt>ICR |= 0x80</tt>: Interrupt is requested on falling edge of IRQ0 input
<h2>Remote control</h2>
<p>Tjerk Schuringa reports:
"Finally got that extra bit going on my bitpattern generator. So far I fed only
simple characters to my jukebox, and this is the result:
<pre>
START D0 1 2 3 4 5 6 7 STOP FUNCTION
0 0 0 0 0 0 1 1 1 1 VOL- (the one I got already)
0 0 0 0 1 0 1 1 VOL+ (figures)
0 0 0 1 0 0 1 1 +
0 0 1 0 0 0 1 1 -
0 1 0 0 0 0 1 1 STOP
1 0 0 0 0 0 1 1 PLAY
</pre>
<p>I also found that "repeat" functions (keep a button depressed) needs to be
faster than 0.5 s. If it is around 1 second or more it is interpreted as a
seperate keypress. So far I did not get the "fast forward" function because the
fastest I can get is 0.5 s.
<p>Very important: the baudrate is indeed 9600 baud! These pulses are fed to the
second ring on the headphone jack, and (if I understood correctly) go to RxD1
of the SH1."
<h2>LCD display</h2>
<p>The Recorder uses a Shing Yih Technology G112064-30 graphic LCD display with 112x64 pixels. The controller is a Solomon SSD1815Z.
<p>It's not yet known what display/controller the Jukebox has, but I'd be surprised if it doesn't use a similar controller.
<p>Starting at 0xE050, the code flicks PB2 and PB3 a great deal and then some with PB1 and PB0. Which gives us the following connections:
<table border><tr><th>CPU pin</th><th>LCD pin</th></tr>
<tr><td>PB0</td><td>DC</td></tr>
<tr><td>PB1</td><td>CS1</td></tr>
<tr><td>PB2</td><td>SCK</td></tr>
<tr><td>PB3</td><td>SDA</td></tr>
</table>
<p>The Recorder apparently has the connections this way (according to Gary Czvitkovicz):
<table border><tr><th>CPU pin</th><th>LCD pin</th></tr>
<tr><td>PB0</td><td>SDA</td></tr>
<tr><td>PB1</td><td>SCK</td></tr>
<tr><td>PB2</td><td>DC</td></tr>
<tr><td>PB3</td><td>CS1</td></tr>
</table>
<a name="charsets"><p>The charsets:
<p><table border=0><tr>
<td><img src="codes_old.png" width=272 height=272><br>
<small>Old LCD charset (before v4.50)</small></td>
<td><img src="codes_new.png" width=272 height=272><br>
<small>New LCD charset (after v4.50)</small></td></tr></table>
<h3>Code</h3>
<p>This C snippet write a byte to the Jukebox LCD controller.
The 'data' flag inticates if the byte is a command byte or a data byte.
<table border><tr><td bgcolor="#a0d6e8">
<pre>
&#35;define DC 1
&#35;define CS1 2
&#35;define SDA 4
&#35;define SCK 8
&nbsp;
void lcd_write(int byte, int data)
{
int i;
char on,off;
&nbsp;
PBDR &= ~CS1; /* enable lcd chip select */
&nbsp;
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;
}
&nbsp;
PBDR |= CS1; /* disable lcd chip select */
}
</pre>
</td></tr></table>
<h2>Firmware size</h2>
<p>Joachim Schiffer found out that firmware files have to be at least 51200
bytes to be loaded by newer firmware ROMs.
So my "first program" only works on players with older firmware in ROM
(my has 3.18). Joachim posted a
<a href="mail/jukebox-archive-2001-12/att-0087/01-AJBREC.ajz">padded version</a> that works everywhere.
#include "foot.t"