Subject: Re: how to run netbsd on sh3 evb?
To: =?big5?B?q2GqQA==?= <kshsueh@samlab.ee.ccu.edu.tw>
From: msaitoh <msaitoh@spa.is.uec.ac.jp>
List: port-sh3
Date: 02/06/2000 21:39:49
[I'm sorry for the lateness of this reply.]
> Hi ,
> I have a Hitachi sh3 7708EDK1.
> I am very interesting in testing the evb board.=20
> .
> .
> .
> Where can I get document to start?
Sorry, there is no document.
> Can I run Net BSD on it? How?
1) Make cross compiler (binutils, egcs)
1-1) get patches from
ftp://ftp.netbsd.org/pub/NetBSD/arch/sh3/crosskit/
1-2) get snapshot from
ftp://ftp.netbsd.org/pub/NetBSD/arch/sh3/snapshot/
1-3) make binutils
Extract binutils and patch.
Apply patch
./configure --target=sh-xxx-netbsdcoff
or
./configure --target=shel-xxx-netbsdcoff
or
./configure --target=sh-xxx-netbsdelf
or
./configure --target=shel-xxx-netbsdelf
(I recommend coff because latest snapshot is coff)
make
make install
1-4) extract the snapshot and copy the include files and libraries
into /usr/local/sh-*-netbsdcoff/include and
/usr/local/sh-*-netbsdcoff/lib.
1.5) make egcs
Do:
cd /usr/local/sh-*-netbsdcoff
ln -s include sys-include
(for limits.h)
Extract egcs and patch
Edit egcs-1.1.2-netbsdsh-19991220-2.dif appropriately
Apply patches
./configure --target=sh-xxx-netbsdcoff
or
./configure --target=shel-xxx-netbsdcoff
or
./configure --target=sh-xxx-netbsdelf
or
./configure --target=shel-xxx-netbsdelf
make
make install
cd /usr/local/lib/gcc-lib/sh-*-netbsdcoff/egcs-version/
rm lib*.a */lib*.a
1.6) make cross compile script
Copy usr/src/sys/arch/evbsh3/conf/build-sh into your PATH
Edit the script. You have to modify following entries
MACHINE
TARGET
2) edit kernel sources:
2.1) check your system
CPU type
byte order
internal and external clock frequency
the settings of the Bus State Controller (includes memory map)
2.2) edit config file
Add an option to specify CPU type
# if the system has SH3, enable one of the following
# options
options SH7708
options SH7708R
options SH7708S
options SH7709
options SH7709A
# if the system has SH4, enable following options
options SH7750
options SH4
(Note that -current doesn't work under SH4)
Set BSC value and any other values.
Example:
options PCLOCK=25000000 # 25.000MHz
options IOM_ROM_SIZE=0x00200000 # 1MB
options IOM_RAM_SIZE=0x01000000 # 16MB
options LED_ADDR=0xb8000000
options BSC_BCR1_VAL =0x0008
options BSC_BCR2_VAL =0x3fd0
options BSC_WCR1_VAL =0x3ff3
options BSC_WCR2_VAL =0xffdf
options BSC_MCR_VAL =0x0004
options BSC_SDMR_VAL =0xffffe088
options BSC_RTCSR_VAL =0xa508
options BSC_RTCNT_VAL =0xa500
options BSC_RTCOR_VAL =0xa582
options FRQCR_VAL =0x0122
options PFC_SCPCR_VAL =0x00aa
(NOTE: I'm now working to make IPL program. These values
will be set by the IPL)
2.3) If your system is little endian, edit evbsh3/include/endian.h
2.4) If the main memory of your system is started from area 2
(i.e. 0x0800000 in phys), edit
sh3/include/param.h
sh3/sh3/md_root.c
evbsh3/evbsh3/locore.s
evbsh3/evbsh3/machdep.c
evbsh3/include/param.h
evbsh3/include/sh3.h
(This problem will be fixed in near future)
2.5) make kernel
config
make depend
make
NOTE: If you want to make ROM image, add followng entry into
config file:
options ROMIMAGE
2.6) Burn ROM (or FLASH)
NOTE: the kernel is expected to locate at
0xa0010000 or 0x80010000 (ROM) or 0x8c010000 (RAM).
You have to write program to jump this address.
For example:
.text
.globl __start
__start:
.globl start
start:
mov.l Xstart, r0
jmp @r0
nop
Xstart: .long 0x80010000
----------------------------------------------------------
SAITOH Masanobu (msaitoh@spa.is.uec.ac.jp,
msaitoh@netbsd.org)
University of Electro-Communications