forked from len0rd/rockbox
[1/4] Remove SH support and all archos targets
This removes all code specific to SH targets Change-Id: I7980523785d2596e65c06430f4638eec74a06061
This commit is contained in:
parent
17f7cc92c2
commit
092c340a20
384 changed files with 648 additions and 43225 deletions
|
|
@ -10,11 +10,11 @@ LDFLAGS := -g
|
|||
|
||||
.PHONY: rbspeexenc uclpack
|
||||
|
||||
CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \
|
||||
CLEANALL := scramble descramble iriver bmp2rb rdf2binary convbdf \
|
||||
generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat lngdump \
|
||||
telechips gigabeats creative hmac-sha1 rbspeexenc mkzenboot mk500boot convttf
|
||||
|
||||
all: scramble descramble sh2d rdf2binary mkboot mkzenboot convbdf codepages \
|
||||
all: scramble descramble rdf2binary mkboot mkzenboot convbdf codepages \
|
||||
uclpack rbspeexenc voicefont mk500boot
|
||||
|
||||
scramble: scramble.o iriver.o mi4.o gigabeat.o gigabeats.o telechips.o \
|
||||
|
|
@ -36,8 +36,6 @@ iaudio_bl_flash.o: iaudio_bl_flash.c iaudio_bl_flash.h
|
|||
iaudio_bl_flash.c iaudio_bl_flash.h: iaudio_bl_flash.bmp bmp2rb
|
||||
$(SILENT)./bmp2rb -f 7 -h . $< >iaudio_bl_flash.c
|
||||
|
||||
sh2d: sh2d.c
|
||||
|
||||
bmp2rb: bmp2rb.c
|
||||
$(SILENT)$(CC) -DAPPLICATION_NAME=\"$@\" $(CFLAGS) $+ -o $@
|
||||
|
||||
|
|
@ -78,10 +76,6 @@ convbdf: convbdf.c
|
|||
codepages: codepages.c codepage_tables.c
|
||||
$(SILENT)$(CC) $(CFLAGS) $+ -o $@
|
||||
|
||||
player_unifont: player_unifont.c ../firmware/drivers/lcd-charset-player.c
|
||||
$(SILENT)$(CC) -DARCHOS_PLAYER -D__PCTOOL__ -I../firmware/export $+ \
|
||||
-o $@
|
||||
|
||||
uclpack:
|
||||
$(SILENT)$(MAKE) -C ucl
|
||||
|
||||
|
|
|
|||
|
|
@ -20,23 +20,27 @@ $releasenotes="/wiki/ReleaseNotes315";
|
|||
%builds = (
|
||||
'archosfmrecorder' => {
|
||||
name => 'Archos FM Recorder',
|
||||
status => 3,
|
||||
status => 0,
|
||||
ram => 2,
|
||||
release => '3.15',
|
||||
},
|
||||
'archosondiofm' => {
|
||||
name => 'Archos Ondio FM',
|
||||
status => 3,
|
||||
status => 0,
|
||||
ram => 2,
|
||||
release => '3.15',
|
||||
},
|
||||
'archosondiosp' => {
|
||||
name => 'Archos Ondio SP',
|
||||
status => 3,
|
||||
status => 0,
|
||||
ram => 2,
|
||||
release => '3.15',
|
||||
},
|
||||
'archosplayer' => {
|
||||
name => 'Archos Player/Studio',
|
||||
status => 3,
|
||||
status => 0,
|
||||
ram => 2,
|
||||
release => '3.15',
|
||||
},
|
||||
'archosrecorder' => {
|
||||
name => 'Archos Recorder v1',
|
||||
|
|
@ -46,9 +50,10 @@ $releasenotes="/wiki/ReleaseNotes315";
|
|||
},
|
||||
'archosrecorderv2' => {
|
||||
name => 'Archos Recorder v2',
|
||||
status => 3,
|
||||
status => 0,
|
||||
ram => 2,
|
||||
manual => "archosfmrecorder",
|
||||
release => '3.15',
|
||||
},
|
||||
'cowond2' => {
|
||||
name => 'Cowon D2',
|
||||
|
|
|
|||
|
|
@ -691,15 +691,9 @@ sub runone {
|
|||
|
||||
if(!$exe) {
|
||||
# not specified, guess!
|
||||
if($target =~ /(recorder|ondio)/i) {
|
||||
$exe = "ajbrec.ajz";
|
||||
}
|
||||
elsif($target =~ /iriver/i) {
|
||||
if($target =~ /iriver/i) {
|
||||
$exe = "rockbox.iriver";
|
||||
}
|
||||
else {
|
||||
$exe = "archos.mod";
|
||||
}
|
||||
}
|
||||
elsif(($exe =~ /rockboxui/)) {
|
||||
# simulator, exclude the exe file
|
||||
|
|
|
|||
234
tools/configure
vendored
234
tools/configure
vendored
|
|
@ -496,14 +496,6 @@ EOF
|
|||
# the gcc version should most likely match what versions we build with
|
||||
# rockboxdev.sh
|
||||
#
|
||||
shcc () {
|
||||
prefixtools sh-elf-
|
||||
GCCOPTS="$CCOPTS -m1"
|
||||
GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
|
||||
endian="big"
|
||||
gccchoice="4.0.3"
|
||||
}
|
||||
|
||||
calmrisccc () {
|
||||
prefixtools calmrisc16-unknown-elf-
|
||||
GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
|
||||
|
|
@ -927,12 +919,6 @@ whichadvanced () {
|
|||
printf "Enter your developer options (press only enter when done)\n\
|
||||
(D)EBUG, (L)ogf, Boot(c)hart, (S)imulator, (P)rofiling, (V)oice, (W)in32 crosscompile,\n\
|
||||
Win(6)4 crosscompile, (T)est plugins, S(m)all C lib, Logf to Ser(i)al port:"
|
||||
if [ "$modelname" = "archosplayer" ]; then
|
||||
printf ", Use (A)TA poweroff"
|
||||
fi
|
||||
if [ "$t_model" = "ondio" ]; then
|
||||
printf ", (B)acklight MOD"
|
||||
fi
|
||||
if [ "$modelname" = "iaudiom5" ]; then
|
||||
printf ", (F)M radio MOD"
|
||||
fi
|
||||
|
|
@ -998,18 +984,6 @@ Win(6)4 crosscompile, (T)est plugins, S(m)all C lib, Logf to Ser(i)al port:"
|
|||
echo "Voice build selected"
|
||||
voice="yes"
|
||||
;;
|
||||
[Aa])
|
||||
if [ "$modelname" = "archosplayer" ]; then
|
||||
have_ata_poweroff="#define HAVE_ATA_POWER_OFF"
|
||||
echo "ATA power off enabled"
|
||||
fi
|
||||
;;
|
||||
[Bb])
|
||||
if [ "$t_model" = "ondio" ]; then
|
||||
have_backlight="#define HAVE_BACKLIGHT"
|
||||
echo "Backlight functions enabled"
|
||||
fi
|
||||
;;
|
||||
[Ff])
|
||||
if [ "$modelname" = "iaudiom5" ]; then
|
||||
have_fmradio_in="#define HAVE_FMRADIO_IN"
|
||||
|
|
@ -1076,7 +1050,6 @@ Win(6)4 crosscompile, (T)est plugins, S(m)all C lib, Logf to Ser(i)al port:"
|
|||
if [ "yes" = "$simulator" ]; then
|
||||
debug="-DDEBUG"
|
||||
extradefines="$extradefines -DSIMULATOR -DHAVE_TEST_PLUGINS"
|
||||
archosrom=""
|
||||
flash=""
|
||||
fi
|
||||
if [ "yes" = "$profile" ]; then
|
||||
|
|
@ -1572,13 +1545,13 @@ if [ "$ARG_TARGET" ]; then
|
|||
else
|
||||
echo "Enter target platform:"
|
||||
cat <<EOF
|
||||
==Archos== ==iriver== ==Apple iPod==
|
||||
0) Player/Studio 10) H120/H140 20) Color/Photo
|
||||
1) Recorder 11) H320/H340 21) Nano 1G
|
||||
2) FM Recorder 12) iHP-100/110/115 22) Video
|
||||
3) Recorder v2 13) iFP-790 23) 3G
|
||||
4) Ondio SP 14) H10 20Gb 24) 4G Grayscale
|
||||
5) Ondio FM 15) H10 5/6Gb 25) Mini 1G
|
||||
==iriver== ==Apple iPod==
|
||||
10) H120/H140 20) Color/Photo
|
||||
11) H320/H340 21) Nano 1G
|
||||
12) iHP-100/110/115 22) Video
|
||||
13) iFP-790 23) 3G
|
||||
14) H10 20Gb 24) 4G Grayscale
|
||||
15) H10 5/6Gb 25) Mini 1G
|
||||
26) Mini 2G
|
||||
==Toshiba== 27) 1G, 2G
|
||||
==Cowon/iAudio== 40) Gigabeat F/X 28) Nano 2G
|
||||
|
|
@ -1641,7 +1614,6 @@ fi
|
|||
toolset="rdf2binary convbdf codepages"
|
||||
|
||||
# Toolsets for some target families:
|
||||
archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
|
||||
iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
|
||||
iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
|
||||
ipodbitmaptools="$toolset scramble bmp2rb"
|
||||
|
|
@ -1673,8 +1645,6 @@ fi
|
|||
# $output)
|
||||
# appextra: passed to the APPEXTRA variable in the Makefiles.
|
||||
# TODO: add proper explanation
|
||||
# archosrom: used only for Archos targets that build a special flashable .ucl
|
||||
# image.
|
||||
# flash: name of output for flashing, for targets where there's a special
|
||||
# file output for this.
|
||||
# plugins: set to 'yes' to build the plugins. Early development builds can
|
||||
|
|
@ -1691,140 +1661,6 @@ fi
|
|||
|
||||
case $buildfor in
|
||||
|
||||
0|archosplayer)
|
||||
target_id=1
|
||||
modelname="archosplayer"
|
||||
target="ARCHOS_PLAYER"
|
||||
shcc
|
||||
tool="$rootdir/tools/scramble"
|
||||
output="archos.mod"
|
||||
appextra="player:gui"
|
||||
#archosrom="$pwd/rombox.ucl"
|
||||
flash="$pwd/rockbox.ucl"
|
||||
plugins="yes"
|
||||
swcodec=""
|
||||
|
||||
# toolset is the tools within the tools directory that we build for
|
||||
# this particular target.
|
||||
toolset="$toolset scramble descramble sh2d player_unifont uclpack"
|
||||
|
||||
# Note: the convbdf is present in the toolset just because: 1) the
|
||||
# firmware/Makefile assumes it is present always, and 2) we will need it when we
|
||||
# build the player simulator
|
||||
|
||||
t_cpu="sh"
|
||||
t_manufacturer="archos"
|
||||
t_model="player"
|
||||
;;
|
||||
|
||||
1|archosrecorder)
|
||||
target_id=2
|
||||
modelname="archosrecorder"
|
||||
target="ARCHOS_RECORDER"
|
||||
shcc
|
||||
tool="$rootdir/tools/scramble"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
|
||||
output="ajbrec.ajz"
|
||||
appextra="recorder:gui:radio"
|
||||
#archosrom="$pwd/rombox.ucl"
|
||||
flash="$pwd/rockbox.ucl"
|
||||
plugins="yes"
|
||||
swcodec=""
|
||||
# toolset is the tools within the tools directory that we build for
|
||||
# this particular target.
|
||||
toolset=$archosbitmaptools
|
||||
t_cpu="sh"
|
||||
t_manufacturer="archos"
|
||||
t_model="recorder"
|
||||
;;
|
||||
|
||||
2|archosfmrecorder)
|
||||
target_id=3
|
||||
modelname="archosfmrecorder"
|
||||
target="ARCHOS_FMRECORDER"
|
||||
shcc
|
||||
tool="$rootdir/tools/scramble -fm"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
|
||||
output="ajbrec.ajz"
|
||||
appextra="recorder:gui:radio"
|
||||
#archosrom="$pwd/rombox.ucl"
|
||||
flash="$pwd/rockbox.ucl"
|
||||
plugins="yes"
|
||||
swcodec=""
|
||||
# toolset is the tools within the tools directory that we build for
|
||||
# this particular target.
|
||||
toolset=$archosbitmaptools
|
||||
t_cpu="sh"
|
||||
t_manufacturer="archos"
|
||||
t_model="fm_v2"
|
||||
;;
|
||||
|
||||
3|archosrecorderv2)
|
||||
target_id=4
|
||||
modelname="archosrecorderv2"
|
||||
target="ARCHOS_RECORDERV2"
|
||||
shcc
|
||||
tool="$rootdir/tools/scramble -v2"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
|
||||
output="ajbrec.ajz"
|
||||
appextra="recorder:gui:radio"
|
||||
#archosrom="$pwd/rombox.ucl"
|
||||
flash="$pwd/rockbox.ucl"
|
||||
plugins="yes"
|
||||
swcodec=""
|
||||
# toolset is the tools within the tools directory that we build for
|
||||
# this particular target.
|
||||
toolset=$archosbitmaptools
|
||||
t_cpu="sh"
|
||||
t_manufacturer="archos"
|
||||
t_model="fm_v2"
|
||||
;;
|
||||
|
||||
4|archosondiosp)
|
||||
target_id=7
|
||||
modelname="archosondiosp"
|
||||
target="ARCHOS_ONDIOSP"
|
||||
shcc
|
||||
tool="$rootdir/tools/scramble -osp"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
|
||||
output="ajbrec.ajz"
|
||||
appextra="recorder:gui:radio"
|
||||
#archosrom="$pwd/rombox.ucl"
|
||||
flash="$pwd/rockbox.ucl"
|
||||
plugins="yes"
|
||||
swcodec=""
|
||||
# toolset is the tools within the tools directory that we build for
|
||||
# this particular target.
|
||||
toolset=$archosbitmaptools
|
||||
t_cpu="sh"
|
||||
t_manufacturer="archos"
|
||||
t_model="ondio"
|
||||
;;
|
||||
|
||||
5|archosondiofm)
|
||||
target_id=8
|
||||
modelname="archosondiofm"
|
||||
target="ARCHOS_ONDIOFM"
|
||||
shcc
|
||||
tool="$rootdir/tools/scramble -ofm"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
|
||||
output="ajbrec.ajz"
|
||||
appextra="recorder:gui:radio"
|
||||
#archosrom="$pwd/rombox.ucl"
|
||||
flash="$pwd/rockbox.ucl"
|
||||
plugins="yes"
|
||||
swcodec=""
|
||||
toolset=$archosbitmaptools
|
||||
t_cpu="sh"
|
||||
t_manufacturer="archos"
|
||||
t_model="ondio"
|
||||
;;
|
||||
|
||||
10|iriverh120)
|
||||
target_id=9
|
||||
modelname="iriverh120"
|
||||
|
|
@ -4529,21 +4365,14 @@ fi
|
|||
echo "sansa eraser build selected"
|
||||
;;
|
||||
[Bb])
|
||||
if test $t_manufacturer = "archos"; then
|
||||
# Archos SH-based players do this somewhat differently for
|
||||
# some reason
|
||||
appsdir='$(ROOTDIR)/flash/bootbox'
|
||||
apps="bootbox"
|
||||
else
|
||||
appsdir='$(ROOTDIR)/bootloader'
|
||||
apps="bootloader"
|
||||
flash=""
|
||||
if test -n "$boottool"; then
|
||||
tool="$boottool"
|
||||
fi
|
||||
if test -n "$bootoutput"; then
|
||||
output=$bootoutput
|
||||
fi
|
||||
appsdir='$(ROOTDIR)/bootloader'
|
||||
apps="bootloader"
|
||||
flash=""
|
||||
if test -n "$boottool"; then
|
||||
tool="$boottool"
|
||||
fi
|
||||
if test -n "$bootoutput"; then
|
||||
output=$bootoutput
|
||||
fi
|
||||
extradefines="$extradefines -DBOOTLOADER -ffunction-sections -fdata-sections"
|
||||
bootloader="1"
|
||||
|
|
@ -4557,7 +4386,6 @@ fi
|
|||
debug="-DDEBUG"
|
||||
simulator="yes"
|
||||
extradefines="$extradefines -DSIMULATOR -DHAVE_TEST_PLUGINS"
|
||||
archosrom=""
|
||||
flash=""
|
||||
echo "Simulator build selected"
|
||||
;;
|
||||
|
|
@ -4588,7 +4416,6 @@ fi
|
|||
extradefines="$extradefines -DDEBUG"
|
||||
appsdir='$(ROOTDIR)/tools/checkwps';
|
||||
output='checkwps.'${modelname};
|
||||
archosrom='';
|
||||
echo "CheckWPS build selected"
|
||||
;;
|
||||
[Dd])
|
||||
|
|
@ -4596,7 +4423,6 @@ fi
|
|||
simcc "database-sdl"
|
||||
toolset='';
|
||||
appsdir='$(ROOTDIR)/tools/database';
|
||||
archosrom='';
|
||||
|
||||
case $uname in
|
||||
CYGWIN*|MINGW*)
|
||||
|
|
@ -4620,7 +4446,6 @@ fi
|
|||
GCCOPTS='';
|
||||
extradefines="$extradefines -DDEBUG"
|
||||
output='warble.'${modelname};
|
||||
archosrom='';
|
||||
echo "Warble build selected"
|
||||
;;
|
||||
*)
|
||||
|
|
@ -4636,9 +4461,6 @@ fi
|
|||
esac
|
||||
# to be able running "make manual" from non-manual configuration
|
||||
case $modelname in
|
||||
archosrecorderv2)
|
||||
manualdev="archosfmrecorder"
|
||||
;;
|
||||
iriverh1??)
|
||||
manualdev="iriverh100"
|
||||
;;
|
||||
|
|
@ -4766,30 +4588,15 @@ echo "Using $LD $ldver"
|
|||
makever=`make --version | head -1`
|
||||
echo "Detected make $makever"
|
||||
|
||||
# check the compiler for SH platforms
|
||||
if test "$CC" = "sh-elf-gcc"; then
|
||||
if test "$gccnum" -lt "400"; then
|
||||
echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
|
||||
echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
|
||||
else
|
||||
# figure out patch status
|
||||
gccpatch=`$CC --version`;
|
||||
|
||||
if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
|
||||
echo "gcc $gccver is rockbox patched"
|
||||
# then convert -O to -Os to get smaller binaries!
|
||||
GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
|
||||
else
|
||||
echo "WARNING: You use an unpatched gcc compiler: $gccver"
|
||||
echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$CC" = "m68k-elf-gcc"; then
|
||||
# convert -O to -Os to get smaller binaries!
|
||||
GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
|
||||
fi
|
||||
if test "$CC" = "mipsel-elf-gcc"; then
|
||||
# convert -O to -Os to get smaller binaries!
|
||||
GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
|
||||
fi
|
||||
|
||||
|
||||
if [ "$ARG_CCACHE" = "1" ]; then
|
||||
echo "Enable ccache for building"
|
||||
|
|
@ -5025,7 +4832,6 @@ export DOCSDIR=${rootdir}/docs
|
|||
export MANUALDIR=${rootdir}/manual
|
||||
export DEBUG=${debug}
|
||||
export MODELNAME=${modelname}
|
||||
export ARCHOSROM=${archosrom}
|
||||
export FLASHFILE=${flash}
|
||||
export TARGET_ID=${target_id}
|
||||
export TARGET=-D${target}
|
||||
|
|
|
|||
|
|
@ -700,7 +700,6 @@ fi
|
|||
|
||||
if [ -z "$RBDEV_TARGET" ]; then
|
||||
echo "Select target arch:"
|
||||
echo "s - sh (Archos models)"
|
||||
echo "m - m68k (iriver h1x0/h3x0, iaudio m3/m5/x5 and mpio hd200)"
|
||||
echo "a - arm (ipods, iriver H10, Sansa, D2, Gigabeat, etc)"
|
||||
echo "i - mips (Jz47xx and ATJ-based players)"
|
||||
|
|
@ -724,15 +723,6 @@ do
|
|||
export MAKEFLAGS=`echo $MAKEFLAGS| sed 's/ -r / /'` # We don't want -r
|
||||
echo ""
|
||||
case $arch in
|
||||
[Ss])
|
||||
# For binutils 2.16.1 builtin rules conflict on some systems with a
|
||||
# default rule for Objective C. Disable the builtin make rules. See
|
||||
# http://sourceware.org/ml/binutils/2005-12/msg00259.html
|
||||
export MAKEFLAGS="-r $MAKEFLAGS"
|
||||
build "binutils" "sh-elf" "2.16.1" "binutils-2.16.1-texinfo-fix.diff" "--disable-werror"
|
||||
build "gcc" "sh-elf" "4.0.3" "gcc-4.0.3-rockbox-1.diff"
|
||||
;;
|
||||
|
||||
[Ii])
|
||||
build "binutils" "mipsel-elf" "2.26.1" "" "--disable-werror"
|
||||
build "gcc" "mipsel-elf" "4.9.4" "" "" "gmp mpfr mpc"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ DEFINES = -DROCKBOX -DMEMORYSIZE=$(MEMORYSIZE) $(TARGET) \
|
|||
$(EXTRA_DEFINES) # <-- -DSIMULATOR or not
|
||||
INCLUDES = -I$(BUILDDIR) -I$(BUILDDIR)/lang $(TARGET_INC)
|
||||
|
||||
CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS)
|
||||
CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS)
|
||||
PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix
|
||||
ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files
|
||||
CORE_LDOPTS = $(GLOBAL_LDOPTS) # linker ops specifically for core build
|
||||
|
|
@ -24,9 +24,6 @@ TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \
|
|||
$(TOOLSDIR)/uclpack $(TOOLSDIR)/mkboot $(TOOLSDIR)/iaudio_bl_flash.c \
|
||||
$(TOOLSDIR)/iaudio_bl_flash.h
|
||||
|
||||
ifeq ($(MODELNAME),archosplayer)
|
||||
TOOLS += $(TOOLSDIR)/player_unifont
|
||||
endif
|
||||
|
||||
ifeq (,$(PREFIX))
|
||||
ifdef APP_TYPE
|
||||
|
|
@ -110,8 +107,6 @@ ifneq (,$(findstring bootloader,$(APPSDIR)))
|
|||
else
|
||||
include $(APPSDIR)/bootloader.make
|
||||
endif
|
||||
else ifneq (,$(findstring bootbox,$(APPSDIR)))
|
||||
include $(APPSDIR)/bootbox.make
|
||||
else ifneq (,$(findstring checkwps,$(APP_TYPE)))
|
||||
include $(APPSDIR)/checkwps.make
|
||||
include $(ROOTDIR)/lib/skin_parser/skin_parser.make
|
||||
|
|
@ -182,7 +177,7 @@ OBJ := $(OBJ:.S=.o)
|
|||
OBJ += $(BMP:.bmp=.o)
|
||||
OBJ := $(call full_path_subst,$(ROOTDIR)/%,$(BUILDDIR)/%,$(OBJ))
|
||||
|
||||
build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(ARCHOSROM) $(RBINFO)
|
||||
build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(RBINFO)
|
||||
|
||||
$(RBINFO): $(BUILDDIR)/$(BINARY)
|
||||
$(SILENT)echo Creating $(@F)
|
||||
|
|
@ -215,7 +210,7 @@ clean::
|
|||
rockbox-manual*.zip sysfont.h rockbox-info.txt voicefontids \
|
||||
*.wav *.mp3 *.voice $(CLEANOBJS) \
|
||||
$(LINKRAM) $(LINKROM) rockbox.elf rockbox.map rockbox.bin \
|
||||
make.dep rombox.elf rombox.map rombox.bin rombox.ucl romstart.txt \
|
||||
make.dep rombox.elf rombox.map rombox.bin romstart.txt \
|
||||
$(BINARY) $(FLASHFILE) uisimulator bootloader flash $(BOOTLINK) \
|
||||
rockbox.apk lang_enum.h rbversion.h
|
||||
|
||||
|
|
@ -273,37 +268,8 @@ $(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf
|
|||
$(BUILDDIR)/rombox.bin : $(BUILDDIR)/rombox.elf
|
||||
$(call PRINTS,OC $(@F))$(call objcopy,$<,$@)
|
||||
|
||||
#
|
||||
# If there's a flashfile defined for this target (rockbox.ucl for Archos
|
||||
# models) Then check if the mkfirmware script fails, as then it is (likely)
|
||||
# because the image is too big and we need to create a compressed image
|
||||
# instead.
|
||||
#
|
||||
$(BUILDDIR)/$(BINARY) : $(BUILDDIR)/rockbox.bin $(FLASHFILE)
|
||||
$(call PRINTS,SCRAMBLE $(notdir $@))($(MKFIRMWARE) $< $@; \
|
||||
stat=$$?; \
|
||||
if test -n "$(FLASHFILE)"; then \
|
||||
if test "$$stat" -ne 0; then \
|
||||
echo "Image too big, making a compressed version!"; \
|
||||
$(MAKE) -C $(FIRMDIR)/decompressor OBJDIR=$(BUILDDIR)/firmware/decompressor; \
|
||||
$(MKFIRMWARE) $(BUILDDIR)/firmware/decompressor/compressed.bin $@; \
|
||||
fi \
|
||||
fi )
|
||||
|
||||
# archos
|
||||
$(BUILDDIR)/rockbox.ucl: $(BUILDDIR)/rockbox.bin
|
||||
$(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --best --2e -b1048576 $< $@ >/dev/null
|
||||
|
||||
MAXINFILE = $(BUILDDIR)/temp.txt
|
||||
MAXOUTFILE = $(BUILDDIR)/romstart.txt
|
||||
|
||||
$(BUILDDIR)/rombox.ucl: $(BUILDDIR)/rombox.bin $(MAXOUTFILE)
|
||||
$(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --none $< $@ >/dev/null; \
|
||||
perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $<; \
|
||||
if test $$? -ne 0; then \
|
||||
echo "removing UCL file again, making it a fake one"; \
|
||||
echo "fake" > $@; \
|
||||
fi
|
||||
$(call PRINTS,SCRAMBLE $(notdir $@)) $(MKFIRMWARE) $< $@
|
||||
|
||||
$(MAXOUTFILE):
|
||||
$(call PRINTS,Creating $(@F))
|
||||
|
|
@ -343,7 +309,7 @@ endif
|
|||
mapzip:
|
||||
$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
|
||||
|
||||
elfzip:
|
||||
elfzip:
|
||||
$(SILENT)find . -name "*.elf" | xargs zip rockbox-elfs.zip
|
||||
|
||||
fullzip:
|
||||
|
|
|
|||
157
tools/scramble.c
157
tools/scramble.c
|
|
@ -36,24 +36,6 @@ static int iaudio_encode(char *iname, char *oname, char *idstring);
|
|||
static int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc);
|
||||
static int ccpmp_encode(char *iname, char *oname);
|
||||
|
||||
enum
|
||||
{
|
||||
ARCHOS_PLAYER, /* and V1 recorder */
|
||||
ARCHOS_V2RECORDER,
|
||||
ARCHOS_FMRECORDER,
|
||||
ARCHOS_ONDIO_SP,
|
||||
ARCHOS_ONDIO_FM
|
||||
};
|
||||
|
||||
static unsigned int size_limit[] =
|
||||
{
|
||||
0x32000, /* ARCHOS_PLAYER */
|
||||
0x64000, /* ARCHOS_V2RECORDER */
|
||||
0x64000, /* ARCHOS_FMRECORDER */
|
||||
0x64000, /* ARCHOS_ONDIO_SP */
|
||||
0x64000 /* ARCHOS_ONDIO_FM */
|
||||
};
|
||||
|
||||
void short2le(unsigned short val, unsigned char* addr)
|
||||
{
|
||||
addr[0] = val & 0xFF;
|
||||
|
|
@ -91,14 +73,9 @@ void short2be(unsigned short val, unsigned char* addr)
|
|||
|
||||
void usage(void)
|
||||
{
|
||||
printf("usage: scramble [options] <input file> <output file> [xor string]\n");
|
||||
printf("usage: scramble [options] <input file> <output file>\n");
|
||||
printf("options:\n"
|
||||
"\t-fm Archos FM recorder format\n"
|
||||
"\t-v2 Archos V2 recorder format\n"
|
||||
"\t-ofm Archos Ondio FM recorder format\n"
|
||||
"\t-osp Archos Ondio SP format\n"
|
||||
"\t-neo SSI Neo format\n"
|
||||
"\t-mm=X Archos Multimedia format (X values: A=JBMM, B=AV1xx, C=AV3xx)\n"
|
||||
"\t-iriver iRiver format\n"
|
||||
"\t-iaudiox5 iAudio X5 format\n"
|
||||
"\t-iaudiox5v iAudio X5V format\n"
|
||||
|
|
@ -131,87 +108,38 @@ void usage(void)
|
|||
"\t ip6g, rk27, clzp, zxf2, zxf3, fuz+, e370, e360,\n"
|
||||
"\t zxfi, zmoz, zen, zenv, ypz5, zxfs, e450, e460,\n"
|
||||
"\t e470, e580, a10, a20, a860, s750, e350, xdx3)\n");
|
||||
printf("\nNo option results in Archos standard player/recorder format.\n");
|
||||
printf("\nNo option results in nothing being done.\n");
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
unsigned long length,i,slen=0;
|
||||
unsigned long length,i;
|
||||
unsigned char *inbuf,*outbuf;
|
||||
unsigned short crc=0;
|
||||
unsigned long chksum=0; /* 32 bit checksum */
|
||||
unsigned char header[24];
|
||||
char *iname = argv[1];
|
||||
char *oname = argv[2];
|
||||
char *xorstring=NULL;
|
||||
int headerlen = 6;
|
||||
FILE* file;
|
||||
int version=0;
|
||||
unsigned long modelnum;
|
||||
char modelname[5];
|
||||
int model_id;
|
||||
enum { none, scramble, xor, tcc_sum, tcc_crc, rkw, add } method = scramble;
|
||||
enum { none, tcc_sum, tcc_crc, rkw, add } method = none;
|
||||
bool creative_enable_ciff;
|
||||
|
||||
model_id = ARCHOS_PLAYER;
|
||||
|
||||
if (argc < 3) {
|
||||
usage();
|
||||
}
|
||||
|
||||
if(!strcmp(argv[1], "-fm")) {
|
||||
headerlen = 24;
|
||||
iname = argv[2];
|
||||
oname = argv[3];
|
||||
version = 4;
|
||||
model_id = ARCHOS_FMRECORDER;
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1], "-v2")) {
|
||||
headerlen = 24;
|
||||
iname = argv[2];
|
||||
oname = argv[3];
|
||||
version = 2;
|
||||
model_id = ARCHOS_V2RECORDER;
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1], "-ofm")) {
|
||||
headerlen = 24;
|
||||
iname = argv[2];
|
||||
oname = argv[3];
|
||||
version = 8;
|
||||
model_id = ARCHOS_ONDIO_FM;
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1], "-osp")) {
|
||||
headerlen = 24;
|
||||
iname = argv[2];
|
||||
oname = argv[3];
|
||||
version = 16;
|
||||
model_id = ARCHOS_ONDIO_SP;
|
||||
}
|
||||
|
||||
else if(!strcmp(argv[1], "-neo")) {
|
||||
headerlen = 17;
|
||||
iname = argv[2];
|
||||
oname = argv[3];
|
||||
method = none;
|
||||
}
|
||||
else if(!strncmp(argv[1], "-mm=", 4)) {
|
||||
headerlen = 16;
|
||||
iname = argv[2];
|
||||
oname = argv[3];
|
||||
method = xor;
|
||||
version = argv[1][4];
|
||||
if (argc > 4)
|
||||
xorstring = argv[4];
|
||||
else {
|
||||
printf("Multimedia needs an xor string\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if(!strncmp(argv[1], "-tcc=", 4)) {
|
||||
headerlen = 0;
|
||||
iname = argv[2];
|
||||
|
|
@ -554,20 +482,10 @@ int main (int argc, char** argv)
|
|||
length = ftell(file);
|
||||
length = (length + 3) & ~3; /* Round up to nearest 4 byte boundary */
|
||||
|
||||
if ((method == scramble) &&
|
||||
((length + headerlen) >= size_limit[model_id])) {
|
||||
printf("error: firmware image is %ld bytes while max size is %u!\n",
|
||||
length + headerlen,
|
||||
size_limit[model_id]);
|
||||
fclose(file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fseek(file,0,SEEK_SET);
|
||||
inbuf = malloc(length);
|
||||
if (method == xor)
|
||||
outbuf = malloc(length*2);
|
||||
else if(method == add)
|
||||
if(method == add)
|
||||
outbuf = malloc(length + 8);
|
||||
else
|
||||
outbuf = malloc(length);
|
||||
|
|
@ -597,32 +515,13 @@ int main (int argc, char** argv)
|
|||
chksum += inbuf[i];
|
||||
}
|
||||
break;
|
||||
case scramble:
|
||||
slen = length/4;
|
||||
for (i = 0; i < length; i++) {
|
||||
unsigned long addr = (i >> 2) + ((i % 4) * slen);
|
||||
unsigned char data = inbuf[i];
|
||||
data = ~((data << 1) | ((data >> 7) & 1)); /* poor man's ROL */
|
||||
outbuf[addr] = data;
|
||||
}
|
||||
break;
|
||||
|
||||
case xor:
|
||||
/* "compress" */
|
||||
slen = 0;
|
||||
for (i=0; i<length; i++) {
|
||||
if (!(i&7))
|
||||
outbuf[slen++] = 0xff; /* all data is uncompressed */
|
||||
outbuf[slen++] = inbuf[i];
|
||||
}
|
||||
break;
|
||||
case none:
|
||||
default:
|
||||
/* dummy case just to silence picky compilers */
|
||||
break;
|
||||
}
|
||||
|
||||
if((method == none) || (method == scramble) || (method == xor)) {
|
||||
if(method == none) {
|
||||
/* calculate checksum */
|
||||
for (i=0;i<length;i++)
|
||||
crc += inbuf[i];
|
||||
|
|
@ -650,50 +549,6 @@ int main (int argc, char** argv)
|
|||
telechips_encode_crc(outbuf, length);
|
||||
break;
|
||||
|
||||
case scramble:
|
||||
if (headerlen == 6) {
|
||||
int2be(length, header);
|
||||
header[4] = (crc >> 8) & 0xff;
|
||||
header[5] = crc & 0xff;
|
||||
}
|
||||
else {
|
||||
header[0] =
|
||||
header[1] =
|
||||
header[2] =
|
||||
header[3] = 0xff; /* ??? */
|
||||
|
||||
header[6] = (crc >> 8) & 0xff;
|
||||
header[7] = crc & 0xff;
|
||||
|
||||
header[11] = version;
|
||||
|
||||
header[15] = headerlen; /* really? */
|
||||
|
||||
int2be(length, &header[20]);
|
||||
}
|
||||
break;
|
||||
|
||||
case xor:
|
||||
{
|
||||
int xorlen = strlen(xorstring);
|
||||
|
||||
/* xor data */
|
||||
for (i=0; i<slen; i++)
|
||||
outbuf[i] ^= xorstring[i & (xorlen-1)];
|
||||
|
||||
/* calculate checksum */
|
||||
for (i=0; i<slen; i++)
|
||||
crc += outbuf[i];
|
||||
|
||||
header[0] = header[2] = 'Z';
|
||||
header[1] = header[3] = version;
|
||||
int2le(length, &header[4]);
|
||||
int2le(slen, &header[8]);
|
||||
int2le(crc, &header[12]);
|
||||
length = slen;
|
||||
break;
|
||||
}
|
||||
|
||||
#define MY_FIRMWARE_TYPE "Rockbox"
|
||||
#define MY_HEADER_VERSION 1
|
||||
default:
|
||||
|
|
|
|||
573
tools/sh2d.c
573
tools/sh2d.c
|
|
@ -1,573 +0,0 @@
|
|||
/*
|
||||
* sh2d
|
||||
* Bart Trzynadlowski, July 24, 2000
|
||||
* Public domain
|
||||
*
|
||||
* Some changes by Björn Stenberg <bjorn@haxx.se>
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define VERSION "0.2"
|
||||
|
||||
#define ZERO_F 0 /* 0 format */
|
||||
#define N_F 1 /* n format */
|
||||
#define M_F 2 /* m format */
|
||||
#define NM_F 3 /* nm format */
|
||||
#define MD_F 4 /* md format */
|
||||
#define ND4_F 5 /* nd4 format */
|
||||
#define NMD_F 6 /* nmd format */
|
||||
#define D_F 7 /* d format */
|
||||
#define D12_F 8 /* d12 format */
|
||||
#define ND8_F 9 /* nd8 format */
|
||||
#define I_F 10 /* i format */
|
||||
#define NI_F 11 /* ni format */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int format;
|
||||
const char *mnem;
|
||||
unsigned short mask; /* mask used to obtain opcode bits */
|
||||
unsigned short bits; /* opcode bits */
|
||||
int dat; /* specific data for situation */
|
||||
int sh2; /* SH-2 specific */
|
||||
} i_descr;
|
||||
|
||||
/* register name lookup added by bjorn@haxx.se 2001-12-09 */
|
||||
char* regname[] =
|
||||
{
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
"","","","","","","","","","","","","","","","", /* 0 */
|
||||
"","","","","","","","","","","","","","","","", /* 10 */
|
||||
"","","","","","","","","","","","","","","","", /* 20 */
|
||||
"","","","","","","","","","","","","","","","", /* 30 */
|
||||
"","","","","","","","","","","","","","","","", /* 40 */
|
||||
"","","","","","","","","","","","","","","","", /* 50 */
|
||||
"","","","","","","","","","","","","","","","", /* 60 */
|
||||
"","","","","","","","","","","","","","","","", /* 70 */
|
||||
"","","","","","","","","","","","","","","","", /* 80 */
|
||||
"","","","","","","","","","","","","","","","", /* 90 */
|
||||
"","","","","","","","","","","","","","","","", /* a0 */
|
||||
"","","","","","","","","","","","","","","","", /* b0 */
|
||||
|
||||
"SMR0","BRR0","SCR0","TDR0","SSR0","RDR0","","", /* c0 */
|
||||
"SMR1","BRR1","SCR1","TDR1","SSR1","RDR1","","", /* c8 */
|
||||
"","","","","","","","","","","","","","","","", /* d0 */
|
||||
"ADDRAH","ADDRAL","ADDRBH","ADDRBL", /* e0 */
|
||||
"ADDRCH","ADDRCL","ADDRDH","ADDRDL", /* e4 */
|
||||
"ADCSR","ADCR","","","","","","", /* e8 */
|
||||
"","","","","","","","","","","","","","","","", /* f0 */
|
||||
"TSTR","TSNC","TMDR","TFCR","TCR0","TIOR0","TIER0","TSR0", /* 100 */
|
||||
"TCNT0","!","GRA0","!","GRB0","!","TCR1","TIORL", /* 108 */
|
||||
"TIERI","TSR1","TCNT1","!","GRA1","!","GRB1","!", /* 110 */
|
||||
"TCR2","TIOR2","TIER2","TSR2","TCNT2","!","GRA2","!", /* 118 */
|
||||
"GRB2","!","TCR3","TIOR3","TIER3","TSR3","TCNT3","!", /* 120 */
|
||||
"GRA3","!","GRB3","!","BRA3","!","BRB3","!", /* 128 */
|
||||
"","TOCR","TCR4","TIOR4","TIER4","TSR4","TCNT4","!", /* 130 */
|
||||
"GRA4","!","GRB4","!","BRA4","!","BRB4","!", /* 138 */
|
||||
"SAR0","!","!","!","DAR0","!","!","!", /* 140 */
|
||||
"DMAOR","!","TCR0","!","","","CHCR0","!", /* 148 */
|
||||
"SAR1","!","!","!","DAR1","!","!","!", /* 150 */
|
||||
"","","TCR1","!","","","CHCR1","!", /* 158 */
|
||||
"SAR2","!","!","!","DAR2","!","!","!", /* 160 */
|
||||
"","","TCR2","!","","","CHCR2","!", /* 168 */
|
||||
"SAR3","!","!","!","DAR3","!","!","!", /* 170 */
|
||||
"","","TCR3","!","","","CHCR3","!", /* 178 */
|
||||
"","","","","IPRA","!","IPRB","!", /* 180 */
|
||||
"IPRC","!","IPRD","!","IPRE","!","ICR","!", /* 188 */
|
||||
"BARH","!","BARL","!","BAMRH","!","BAMRL","!", /* 190 */
|
||||
"BBR","!","","","","","","", /* 198 */
|
||||
"BCR","!","WCR1","!","WCR2","!","WCR3","!", /* 1a0 */
|
||||
"DCR","!","PCR","!","RCR","!","RTCSR","!", /* 1a8 */
|
||||
"RTCNT","!","RTCOR","!","","","","", /* 1b0 */
|
||||
"TCSR","TCNT","","RSTCSR","SBYCR","","","", /* 1b8 */
|
||||
"PADR","!","PBDR","!","PAIOR","!","PBIOR","!", /* 1c0 */
|
||||
"PACR1","!","PACR2","!","PBCR1","!","PBCR2","!", /* 1c8 */
|
||||
"PCDR","!","","","","","","","","","","","","","","", /* 1d0 */
|
||||
"","","","","","","","","","","","","","","CASCR","!", /* 1e0 */
|
||||
"TPMR","TPCR","NDERB","NDERA","NDRB","NDRA","NDRB","NDRA", /* 1f0 */
|
||||
"","","","","","","",""
|
||||
};
|
||||
|
||||
i_descr tab[] =
|
||||
{
|
||||
{ ZERO_F, "clrt", 0xffff, 0x8, 0, 0 },
|
||||
{ ZERO_F, "clrmac", 0xffff, 0x28, 0, 0 },
|
||||
{ ZERO_F, "div0u", 0xffff, 0x19, 0, 0 },
|
||||
{ ZERO_F, "nop", 0xffff, 0x9, 0, 0 },
|
||||
{ ZERO_F, "rte", 0xffff, 0x2b, 0, 0 },
|
||||
{ ZERO_F, "rts", 0xffff, 0xb, 0, 0 },
|
||||
{ ZERO_F, "sett", 0xffff, 0x18, 0, 0 },
|
||||
{ ZERO_F, "sleep", 0xffff, 0x1b, 0, 0 },
|
||||
{ N_F, "cmp/pl\tr%d", 0xf0ff, 0x4015, 0, 0 },
|
||||
{ N_F, "cmp/pz\tr%d", 0xf0ff, 0x4011, 0, 0 },
|
||||
{ N_F, "dt\tr%d", 0xf0ff, 0x4010, 0, 1 },
|
||||
{ N_F, "movt\tr%d", 0xf0ff, 0x0029, 0, 0 },
|
||||
{ N_F, "rotl\tr%d", 0xf0ff, 0x4004, 0, 0 },
|
||||
{ N_F, "rotr\tr%d", 0xf0ff, 0x4005, 0, 0 },
|
||||
{ N_F, "rotcl\tr%d", 0xf0ff, 0x4024, 0, 0 },
|
||||
{ N_F, "rotcr\tr%d", 0xf0ff, 0x4025, 0, 0 },
|
||||
{ N_F, "shal\tr%d", 0xf0ff, 0x4020, 0, 0 },
|
||||
{ N_F, "shar\tr%d", 0xf0ff, 0x4021, 0, 0 },
|
||||
{ N_F, "shll\tr%d", 0xf0ff, 0x4000, 0, 0 },
|
||||
{ N_F, "shlr\tr%d", 0xf0ff, 0x4001, 0, 0 },
|
||||
{ N_F, "shll2\tr%d", 0xf0ff, 0x4008, 0, 0 },
|
||||
{ N_F, "shlr2\tr%d", 0xf0ff, 0x4009, 0, 0 },
|
||||
{ N_F, "shll8\tr%d", 0xf0ff, 0x4018, 0, 0 },
|
||||
{ N_F, "shlr8\tr%d", 0xf0ff, 0x4019, 0, 0 },
|
||||
{ N_F, "shll16\tr%d", 0xf0ff, 0x4028, 0, 0 },
|
||||
{ N_F, "shlr16\tr%d", 0xf0ff, 0x4029, 0, 0 },
|
||||
{ N_F, "stc\tsr,r%d", 0xf0ff, 0x0002, 0, 0 },
|
||||
{ N_F, "stc\tgbr,r%d", 0xf0ff, 0x0012, 0, 0 },
|
||||
{ N_F, "stc\tvbr,r%d", 0xf0ff, 0x0022, 0, 0 },
|
||||
{ N_F, "sts\tmach,r%d", 0xf0ff, 0x000a, 0, 0 },
|
||||
{ N_F, "sts\tmacl,r%d", 0xf0ff, 0x001a, 0, 0 },
|
||||
{ N_F, "sts\tpr,r%d", 0xf0ff, 0x002a, 0, 0 },
|
||||
{ N_F, "tas.b\t@r%d", 0xf0ff, 0x401b, 0, 0 },
|
||||
{ N_F, "stc.l\tsr,@-r%d", 0xf0ff, 0x4003, 0, 0 },
|
||||
{ N_F, "stc.l\tgbr,@-r%d", 0xf0ff, 0x4013, 0, 0 },
|
||||
{ N_F, "stc.l\tvbr,@-r%d", 0xf0ff, 0x4023, 0, 0 },
|
||||
{ N_F, "sts.l\tmach,@-r%d", 0xf0ff, 0x4002, 0, 0 },
|
||||
{ N_F, "sts.l\tmacl,@-r%d", 0xf0ff, 0x4012, 0, 0 },
|
||||
{ N_F, "sts.l\tpr,@-r%d", 0xf0ff, 0x4022, 0, 0 },
|
||||
{ M_F, "ldc\tr%d,sr", 0xf0ff, 0x400e, 0, 0 },
|
||||
{ M_F, "ldc\tr%d,gbr", 0xf0ff, 0x401e, 0, 0 },
|
||||
{ M_F, "ldc\tr%d,vbr", 0xf0ff, 0x402e, 0, 0 },
|
||||
{ M_F, "lds\tr%d,mach", 0xf0ff, 0x400a, 0, 0 },
|
||||
{ M_F, "lds\tr%d,macl", 0xf0ff, 0x401a, 0, 0 },
|
||||
{ M_F, "lds\tr%d,pr", 0xf0ff, 0x402a, 0, 0 },
|
||||
{ M_F, "jmp\t@r%d", 0xf0ff, 0x402b, 0, 0 },
|
||||
{ M_F, "jsr\t@r%d", 0xf0ff, 0x400b, 0, 0 },
|
||||
{ M_F, "ldc.l\t@r%d+,sr", 0xf0ff, 0x4007, 0, 0 },
|
||||
{ M_F, "ldc.l\t@r%d+,gbr", 0xf0ff, 0x4017, 0, 0 },
|
||||
{ M_F, "ldc.l\t@r%d+,vbr", 0xf0ff, 0x4027, 0, 0 },
|
||||
{ M_F, "lds.l\t@r%d+,mach", 0xf0ff, 0x4006, 0, 0 },
|
||||
{ M_F, "lds.l\t@r%d+,macl", 0xf0ff, 0x4016, 0, 0 },
|
||||
{ M_F, "lds.l\t@r%d+,pr", 0xf0ff, 0x4026, 0, 0 },
|
||||
{ M_F, "braf\tr%d", 0xf0ff, 0x0023, 0, 1 },
|
||||
{ M_F, "bsrf\tr%d", 0xf0ff, 0x0003, 0, 1 },
|
||||
{ NM_F, "add\tr%d,r%d", 0xf00f, 0x300c, 0, 0 },
|
||||
{ NM_F, "addc\tr%d,r%d", 0xf00f, 0x300e, 0, 0 },
|
||||
{ NM_F, "addv\tr%d,r%d", 0xf00f, 0x300f, 0, 0 },
|
||||
{ NM_F, "and\tr%d,r%d", 0xf00f, 0x2009, 0, 0 },
|
||||
{ NM_F, "cmp/eq\tr%d,r%d", 0xf00f, 0x3000, 0, 0 },
|
||||
{ NM_F, "cmp/hs\tr%d,r%d", 0xf00f, 0x3002, 0, 0 },
|
||||
{ NM_F, "cmp/ge\tr%d,r%d", 0xf00f, 0x3003, 0, 0 },
|
||||
{ NM_F, "cmp/hi\tr%d,r%d", 0xf00f, 0x3006, 0, 0 },
|
||||
{ NM_F, "cmp/gt\tr%d,r%d", 0xf00f, 0x3007, 0, 0 },
|
||||
{ NM_F, "cmp/str\tr%d,r%d", 0xf00f, 0x200c, 0, 0 },
|
||||
{ NM_F, "div1\tr%d,r%d", 0xf00f, 0x3004, 0, 0 },
|
||||
{ NM_F, "div0s\tr%d,r%d", 0xf00f, 0x2007, 0, 0 },
|
||||
{ NM_F, "dmuls.l\tr%d,r%d", 0xf00f, 0x300d, 0, 1 },
|
||||
{ NM_F, "dmulu.l\tr%d,r%d", 0xf00f, 0x3005, 0, 1 },
|
||||
{ NM_F, "exts.b\tr%d,r%d", 0xf00f, 0x600e, 0, 0 },
|
||||
{ NM_F, "exts.w\tr%d,r%d", 0xf00f, 0x600f, 0, 0 },
|
||||
{ NM_F, "extu.b\tr%d,r%d", 0xf00f, 0x600c, 0, 0 },
|
||||
{ NM_F, "extu.w\tr%d,r%d", 0xf00f, 0x600d, 0, 0 },
|
||||
{ NM_F, "mov\tr%d,r%d", 0xf00f, 0x6003, 0, 0 },
|
||||
{ NM_F, "mul.l\tr%d,r%d", 0xf00f, 0x0007, 0, 1 },
|
||||
{ NM_F, "muls.w\tr%d,r%d", 0xf00f, 0x200f, 0, 0 },
|
||||
{ NM_F, "mulu.w\tr%d,r%d", 0xf00f, 0x200e, 0, 0 },
|
||||
{ NM_F, "neg\tr%d,r%d", 0xf00f, 0x600b, 0, 0 },
|
||||
{ NM_F, "negc\tr%d,r%d", 0xf00f, 0x600a, 0, 0 },
|
||||
{ NM_F, "not\tr%d,r%d", 0xf00f, 0x6007, 0, 0 },
|
||||
{ NM_F, "or\tr%d,r%d", 0xf00f, 0x200b, 0, 0 },
|
||||
{ NM_F, "sub\tr%d,r%d", 0xf00f, 0x3008, 0, 0 },
|
||||
{ NM_F, "subc\tr%d,r%d", 0xf00f, 0x300a, 0, 0 },
|
||||
{ NM_F, "subv\tr%d,r%d", 0xf00f, 0x300b, 0, 0 },
|
||||
{ NM_F, "swap.b\tr%d,r%d", 0xf00f, 0x6008, 0, 0 },
|
||||
{ NM_F, "swap.w\tr%d,r%d", 0xf00f, 0x6009, 0, 0 },
|
||||
{ NM_F, "tst\tr%d,r%d", 0xf00f, 0x2008, 0, 0 },
|
||||
{ NM_F, "xor\tr%d,r%d", 0xf00f, 0x200a, 0, 0 },
|
||||
{ NM_F, "xtrct\tr%d,r%d", 0xf00f, 0x200d, 0, 0 },
|
||||
{ NM_F, "mov.b\tr%d,@r%d", 0xf00f, 0x2000, 0, 0 },
|
||||
{ NM_F, "mov.w\tr%d,@r%d", 0xf00f, 0x2001, 0, 0 },
|
||||
{ NM_F, "mov.l\tr%d,@r%d", 0xf00f, 0x2002, 0, 0 },
|
||||
{ NM_F, "mov.b\t@r%d,r%d", 0xf00f, 0x6000, 0, 0 },
|
||||
{ NM_F, "mov.w\t@r%d,r%d", 0xf00f, 0x6001, 0, 0 },
|
||||
{ NM_F, "mov.l\t@r%d,r%d", 0xf00f, 0x6002, 0, 0 },
|
||||
{ NM_F, "mac.l\t@r%d+,@r%d+", 0xf00f, 0x000f, 0, 1 },
|
||||
{ NM_F, "mac.w\t@r%d+,@r%d+", 0xf00f, 0x400f, 0, 0 },
|
||||
{ NM_F, "mov.b\t@r%d+,r%d", 0xf00f, 0x6004, 0, 0 },
|
||||
{ NM_F, "mov.w\t@r%d+,r%d", 0xf00f, 0x6005, 0, 0 },
|
||||
{ NM_F, "mov.l\t@r%d+,r%d", 0xf00f, 0x6006, 0, 0 },
|
||||
{ NM_F, "mov.b\tr%d,@-r%d", 0xf00f, 0x2004, 0, 0 },
|
||||
{ NM_F, "mov.w\tr%d,@-r%d", 0xf00f, 0x2005, 0, 0 },
|
||||
{ NM_F, "mov.l\tr%d,@-r%d", 0xf00f, 0x2006, 0, 0 },
|
||||
{ NM_F, "mov.b\tr%d,@(r0,r%d)", 0xf00f, 0x0004, 0, 0 },
|
||||
{ NM_F, "mov.w\tr%d,@(r0,r%d)", 0xf00f, 0x0005, 0, 0 },
|
||||
{ NM_F, "mov.l\tr%d,@(r0,r%d)", 0xf00f, 0x0006, 0, 0 },
|
||||
{ NM_F, "mov.b\t@(r0,r%d),r%d", 0xf00f, 0x000c, 0, 0 },
|
||||
{ NM_F, "mov.w\t@(r0,r%d),r%d", 0xf00f, 0x000d, 0, 0 },
|
||||
{ NM_F, "mov.l\t@(r0,r%d),r%d", 0xf00f, 0x000e, 0, 0 },
|
||||
{ MD_F, "mov.b\t@(0x%03X,r%d), r0", 0xff00, 0x8400, 0, 0 },
|
||||
{ MD_F, "mov.w\t@(0x%03X,r%d), r0", 0xff00, 0x8500, 0, 0 },
|
||||
{ ND4_F, "mov.b\tr0,@(0x%03X,r%d)", 0xff00, 0x8000, 0, 0 },
|
||||
{ ND4_F, "mov.w\tr0,@(0x%03X,r%d)", 0xff00, 0x8100, 0, 0 },
|
||||
{ NMD_F, "mov.l\tr%d,@(0x%03X,r%d)", 0xf000, 0x1000, 0,0 },
|
||||
{ NMD_F, "mov.l\t@(0x%03X,r%d),r%d", 0xf000, 0x5000, 0,0 },
|
||||
{ D_F, "mov.b\tr0,@(0x%03X,gbr)", 0xff00, 0xc000, 1, 0 },
|
||||
{ D_F, "mov.w\tr0,@(0x%03X,gbr)", 0xff00, 0xc100, 2, 0 },
|
||||
{ D_F, "mov.l\tr0,@(0x%03X,gbr)", 0xff00, 0xc200, 4, 0 },
|
||||
{ D_F, "mov.b\t@(0x%03X,gbr),r0", 0xff00, 0xc400, 1, 0 },
|
||||
{ D_F, "mov.w\t@(0x%03X,gbr),r0", 0xff00, 0xc500, 2, 0 },
|
||||
{ D_F, "mov.l\t@(0x%03X,gbr),r0", 0xff00, 0xc600, 4, 0 },
|
||||
{ D_F, "mova\t@(0x%03X,pc),r0", 0xff00, 0xc700, 4, 0 },
|
||||
{ D_F, "bf\t0x%08X", 0xff00, 0x8b00, 5, 0 },
|
||||
{ D_F, "bf/s\t0x%08X", 0xff00, 0x8f00, 5, 1 },
|
||||
{ D_F, "bt\t0x%08X", 0xff00, 0x8900, 5, 0 },
|
||||
{ D_F, "bt/s\t0x%08X", 0xff00, 0x8d00, 5, 1 },
|
||||
{ D12_F, "bra\t0x%08X", 0xf000, 0xa000, 0, 0 },
|
||||
{ D12_F, "bsr\t0x%08X", 0xf000, 0xb000, 0, 0 },
|
||||
{ ND8_F, "mov.w\t@(0x%03X,pc),r%d", 0xf000, 0x9000, 2, 0 },
|
||||
{ ND8_F, "mov.l\t@(0x%03X,pc),r%d", 0xf000, 0xd000, 4, 0 },
|
||||
{ I_F, "and.b\t#0x%02X,@(r0,gbr)", 0xff00, 0xcd00, 0,0 },
|
||||
{ I_F, "or.b\t#0x%02X,@(r0,gbr)", 0xff00, 0xcf00, 0,0 },
|
||||
{ I_F, "tst.b\t#0x%02X,@(r0,gbr)", 0xff00, 0xcc00, 0,0 },
|
||||
{ I_F, "xor.b\t#0x%02X,@(r0,gbr)", 0xff00, 0xce00, 0,0 },
|
||||
{ I_F, "and\t#0x%02X,r0", 0xff00, 0xc900, 0, 0 },
|
||||
{ I_F, "cmp/eq\t#0x%02X,r0", 0xff00, 0x8800, 0, 0 },
|
||||
{ I_F, "or\t#0x%02X,r0", 0xff00, 0xcb00, 0, 0 },
|
||||
{ I_F, "tst\t#0x%02X,r0", 0xff00, 0xc800, 0, 0 },
|
||||
{ I_F, "xor\t#0x%02X,r0", 0xff00, 0xca00, 0, 0 },
|
||||
{ I_F, "trapa\t#0x%X", 0xff00, 0xc300, 0, 0 },
|
||||
{ NI_F, "add\t#0x%02X,r%d", 0xf000, 0x7000, 0, 0 },
|
||||
{ NI_F, "mov\t#0x%02X,r%d", 0xf000, 0xe000, 0, 0 },
|
||||
{ 0, NULL, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
int FindOption(char *option, int p, int h, int u, int argc, char **argv)
|
||||
{
|
||||
static int t[] = { 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int i;
|
||||
char *c;
|
||||
|
||||
if (argc > 128)
|
||||
argc = 128; /* maximum this function can handle is 128 */
|
||||
|
||||
/*
|
||||
* if p = 1 and h = 0 will find option and return decimal value of
|
||||
* argv[i+1], if h = 1 will read it as hex.
|
||||
* if p = 0 then it will return index of option in argv[], 0 not found
|
||||
* if u = 1 will return index of first occurance of untouched option
|
||||
*/
|
||||
|
||||
if (u) /* find first untouched element */
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (!t[i]) /* 0 indicates untouched */
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (p) /* find option and return integer value following it */
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], option) == 0) /* found */
|
||||
{
|
||||
if (i >= argc) /* bounds! */
|
||||
return 0;
|
||||
t[i + 1] = t[i] = 1; /* touched */
|
||||
if (!h)
|
||||
return atoi(argv[i + 1]);
|
||||
else
|
||||
return strtoul(argv[i + 1], &c, 16);
|
||||
}
|
||||
}
|
||||
return 0; /* no match */
|
||||
}
|
||||
else /* find option and return position */
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], option) == 0)
|
||||
{
|
||||
t[i] = 1;
|
||||
return i; /* found! return position */
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* SH2Disasm(): SH-1/SH-2 disassembler routine. If mode = 0 then SH-2 mode,
|
||||
* otherwise SH-1 mode
|
||||
*/
|
||||
|
||||
void SH2Disasm(unsigned v_addr, unsigned char *p_addr, int mode, char *m_addr)
|
||||
{
|
||||
int i;
|
||||
unsigned short op;
|
||||
|
||||
op = (unsigned short) (*p_addr << 8) | *(p_addr + 1);
|
||||
printf("0x%08X: 0x%04X\t", v_addr, op);
|
||||
|
||||
if (m_addr[0]==ND8_F)
|
||||
{
|
||||
if (m_addr[2]==-1)
|
||||
{
|
||||
unsigned int tmp = (op << 16) | ((unsigned int) (p_addr [2] << 8) | p_addr[3]);
|
||||
printf(".long\t0x%08X\t; 0x%08X",tmp,v_addr - (unsigned)m_addr[1]);
|
||||
}
|
||||
else
|
||||
printf(".short\t0x%08X\t; 0x%08X",op,v_addr - (unsigned)m_addr[1]);
|
||||
}
|
||||
else if (m_addr[0] != -1)
|
||||
{
|
||||
for (i = 0; tab[i].mnem != NULL; i++) /* 0 format */
|
||||
{
|
||||
if ((op & tab[i].mask) == tab[i].bits)
|
||||
{
|
||||
if (tab[i].sh2 && mode) /* if SH-1 mode, no SH-2 */
|
||||
printf("???");
|
||||
else if (tab[i].format == ZERO_F)
|
||||
printf("%s", tab[i].mnem);
|
||||
else if (tab[i].format == N_F)
|
||||
printf(tab[i].mnem, (op >> 8) & 0xf);
|
||||
else if (tab[i].format == M_F)
|
||||
printf(tab[i].mnem, (op >> 8) & 0xf);
|
||||
else if (tab[i].format == NM_F)
|
||||
printf(tab[i].mnem, (op >> 4) & 0xf,
|
||||
(op >> 8) & 0xf);
|
||||
else if (tab[i].format == MD_F)
|
||||
{
|
||||
if (op & 0x100)
|
||||
printf(tab[i].mnem, (op & 0xf) * 2,
|
||||
(op >> 4) & 0xf);
|
||||
else
|
||||
printf(tab[i].mnem, op & 0xf,
|
||||
(op >> 4) & 0xf);
|
||||
}
|
||||
else if (tab[i].format == ND4_F)
|
||||
{
|
||||
if (op & 0x100)
|
||||
printf(tab[i].mnem, (op & 0xf) * 2,
|
||||
(op >> 4) & 0xf);
|
||||
else
|
||||
printf(tab[i].mnem, (op & 0xf),
|
||||
(op >> 4) & 0xf);
|
||||
}
|
||||
else if (tab[i].format == NMD_F)
|
||||
{
|
||||
if ((op & 0xf000) == 0x1000)
|
||||
printf(tab[i].mnem, (op >> 4) & 0xf,
|
||||
(op & 0xf) * 4,
|
||||
(op >> 8) & 0xf);
|
||||
else
|
||||
printf(tab[i].mnem, (op & 0xf) * 4,
|
||||
(op >> 4) & 0xf,
|
||||
(op >> 8) & 0xf);
|
||||
}
|
||||
else if (tab[i].format == D_F)
|
||||
{
|
||||
if (tab[i].dat <= 4)
|
||||
{
|
||||
if ((op & 0xff00) == 0xc700)
|
||||
{
|
||||
printf(tab[i].mnem,
|
||||
(op & 0xff) *
|
||||
tab[i].dat + 4);
|
||||
printf("\t; 0x%08X",
|
||||
(op & 0xff) *
|
||||
tab[i].dat + 4 +
|
||||
v_addr);
|
||||
}
|
||||
else
|
||||
printf(tab[i].mnem,
|
||||
(op & 0xff) *
|
||||
tab[i].dat);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (op & 0x80) /* sign extend */
|
||||
printf(tab[i].mnem,
|
||||
(((op & 0xff) +
|
||||
0xffffff00) * 2) +
|
||||
|
||||
v_addr + 4);
|
||||
else
|
||||
printf(tab[i].mnem,
|
||||
((op & 0xff) * 2) +
|
||||
v_addr + 4);
|
||||
}
|
||||
}
|
||||
else if (tab[i].format == D12_F)
|
||||
{
|
||||
if (op & 0x800) /* sign extend */
|
||||
printf(tab[i].mnem,
|
||||
((op & 0xfff) + 0xfffff000) * 2
|
||||
+ v_addr + 4);
|
||||
else
|
||||
printf(tab[i].mnem, (op & 0xfff) * 2 +
|
||||
v_addr + 4);
|
||||
}
|
||||
else if (tab[i].format == ND8_F)
|
||||
{
|
||||
int imm = (op & 0xff) * tab[i].dat + 4;
|
||||
if ((op & 0xf000) == 0x9000) /* .W */
|
||||
{
|
||||
int dat = (unsigned short) (*(imm + p_addr) << 8) | *(imm + p_addr + 1);
|
||||
m_addr[imm+0] = ND8_F; /* this couldn't be an instruction so mark it ! */
|
||||
m_addr[imm+1] = imm;
|
||||
printf(tab[i].mnem,
|
||||
imm,
|
||||
(op >> 8) & 0xf);
|
||||
printf("\t; 0x%08X (0x%04X)",
|
||||
imm + v_addr, dat);
|
||||
}
|
||||
else /* .L */
|
||||
{
|
||||
unsigned char *b_addr = (unsigned char *)((intptr_t)p_addr & ~3);
|
||||
int dat = (unsigned int) (*(imm + b_addr) << 24) | (*(imm + b_addr + 1) << 16)
|
||||
| (*(imm + b_addr + 2) << 8) | *(imm + b_addr + 3) ;
|
||||
/* SH-1 register name lookup */
|
||||
char* str = "";
|
||||
if ( (dat & 0xfffffe00) == 0x05fffe00 )
|
||||
str = regname[dat & 0x1ff];
|
||||
m_addr[imm+(b_addr-p_addr)+0] = ND8_F; /* this couldn't be an instruction so mark it ! */
|
||||
m_addr[imm+(b_addr-p_addr)+1] = imm;
|
||||
m_addr[imm+(b_addr-p_addr)+2] = -1;
|
||||
printf(tab[i].mnem,
|
||||
imm,
|
||||
(op >> 8) & 0xf);
|
||||
printf("\t; 0x%08X (0x%08X) %s",
|
||||
imm + (v_addr & 0xfffffffc), dat, str);
|
||||
}
|
||||
}
|
||||
else if (tab[i].format == I_F)
|
||||
printf(tab[i].mnem, op & 0xff);
|
||||
else if (tab[i].format == NI_F)
|
||||
printf(tab[i].mnem, op & 0xff, (op >> 8) &
|
||||
0xf);
|
||||
else
|
||||
printf("???");
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
printf("???");
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void ShowHelp()
|
||||
{
|
||||
printf("sh2d Version %s by Bart Trzynadlowski: A Free SH-1/SH-2 "
|
||||
"Disassembler\n", VERSION);
|
||||
printf("Usage: sh2d <file> [options]\n");
|
||||
printf("Options: -?,-h Show this help text\n");
|
||||
printf(" -s # Start offset (hexadecimal)\n");
|
||||
printf(" -l # Number of bytes (decimal)\n");
|
||||
printf(" -o # Set origin (hexadecimal)\n");
|
||||
printf(" -sh1 SH-1 disassembly only\n");
|
||||
printf(" -sh2 SH-2 disassembly (default)\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *fp;
|
||||
long fsize, file, mode;
|
||||
unsigned start, len, calc_len = 0, org, do_org, i, j = 0;
|
||||
char *buffer;
|
||||
char *mark;
|
||||
|
||||
if (argc == 1) /* show help */
|
||||
ShowHelp();
|
||||
if (FindOption("-?", 0, 0, 0, argc, argv) ||
|
||||
FindOption("-h", 0, 0, 0, argc, argv))
|
||||
ShowHelp();
|
||||
|
||||
if (FindOption("-sh1", 0, 0, 0, argc, argv))
|
||||
mode = 1; /* SH-1 mode */
|
||||
else
|
||||
mode = 0; /* SH-2 mode */
|
||||
if (FindOption("-sh2", 0, 0, 0, argc, argv))
|
||||
mode = 0; /* SH-2 mode */
|
||||
|
||||
start = FindOption("-s", 1, 1, 0, argc, argv);
|
||||
org = FindOption("-o", 1, 1, 0, argc, argv);
|
||||
if (!(len = FindOption("-l", 1, 0, 0, argc, argv)))
|
||||
{
|
||||
if (FindOption("-l", 0, 0, 0, argc, argv))
|
||||
return 0; /* -l was actually specified w/ 0 */
|
||||
calc_len = 1; /* no -l, calculate length */
|
||||
}
|
||||
|
||||
if (FindOption("-o", 0, 0, 0, argc, argv))
|
||||
do_org = 1; /* -o was actually 0 */
|
||||
else
|
||||
do_org = 0; /* there was no -o, ignore the org variable */
|
||||
|
||||
if (!(file = FindOption(NULL, 0, 0, 1, argc, argv)))
|
||||
{
|
||||
fprintf(stderr, "sh2d: No input file specified. Try "
|
||||
"\"sh2d -h\" for usage instructions\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((fp = fopen(argv[file], "rb")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "sh2d: Failed to open file: %s\n",
|
||||
argv[file]);
|
||||
exit(1);
|
||||
}
|
||||
fseek(fp, 0, SEEK_END);
|
||||
fsize = ftell(fp);
|
||||
rewind(fp);
|
||||
if ((buffer = (char *) calloc(fsize * 2, sizeof(unsigned short)))
|
||||
== NULL)
|
||||
{
|
||||
fprintf(stderr, "sh2d: Not enough memory to load input "
|
||||
"file: %s, %lu bytes\n", argv[file], fsize);
|
||||
exit(1);
|
||||
}
|
||||
fread(buffer, sizeof(unsigned char), fsize, fp);
|
||||
fclose(fp);
|
||||
|
||||
if (calc_len)
|
||||
len = fsize - start;
|
||||
|
||||
mark = buffer + fsize;
|
||||
|
||||
for (i = start; i < (unsigned) fsize && j < len; i += 2)
|
||||
{
|
||||
if (do_org)
|
||||
{
|
||||
SH2Disasm(org, (unsigned char*)&buffer[i], mode, &mark[i]);
|
||||
org += 2;
|
||||
}
|
||||
else
|
||||
SH2Disasm(i, (unsigned char *)&buffer[i], mode, &mark[i]);
|
||||
j += 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
diff -ru gcc-4.0.3-orig/gcc/config/sh/sh.h gcc-4.0.3/gcc/config/sh/sh.h
|
||||
--- gcc-4.0.3-orig/gcc/config/sh/sh.h 2006-03-06 23:40:49.000000000 +0100
|
||||
+++ gcc-4.0.3/gcc/config/sh/sh.h 2006-04-28 03:03:18.000000000 +0200
|
||||
@@ -2809,12 +2809,15 @@
|
||||
#define CASE_VECTOR_MODE ((! optimize || TARGET_BIGTABLE) ? SImode : HImode)
|
||||
|
||||
#define CASE_VECTOR_SHORTEN_MODE(MIN_OFFSET, MAX_OFFSET, BODY) \
|
||||
-((MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 127 \
|
||||
+((MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 126 \
|
||||
? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, QImode) \
|
||||
- : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 255 \
|
||||
+ : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 254 \
|
||||
? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 1, QImode) \
|
||||
: (MIN_OFFSET) >= -32768 && (MAX_OFFSET) <= 32767 ? HImode \
|
||||
: SImode)
|
||||
+/* Note: The maximum range for byte-sized offsets was reduced by 1 to work
|
||||
+ around a bug in final.c I don't know how to fix properly (jump table
|
||||
+ length calculation should take alignment into account). -- Jens Arnold */
|
||||
|
||||
/* Define as C expression which evaluates to nonzero if the tablejump
|
||||
instruction expects the table to contain offsets from the address of the
|
||||
diff -ru gcc-4.0.3-orig/gcc/version.c gcc-4.0.3/gcc/version.c
|
||||
--- gcc-4.0.3-orig/gcc/version.c 2006-03-09 21:46:18.000000000 +0100
|
||||
+++ gcc-4.0.3/gcc/version.c 2006-04-29 23:52:22.000000000 +0200
|
||||
@@ -5,7 +5,7 @@
|
||||
please modify this string to indicate that, e.g. by putting your
|
||||
organization's name in parentheses at the end of the string. */
|
||||
|
||||
-const char version_string[] = "4.0.3";
|
||||
+const char version_string[] = "4.0.3 (rockbox patch #1)";
|
||||
|
||||
/* This is the location of the online document giving instructions for
|
||||
reporting bugs. If you distribute a modified version of GCC,
|
||||
diff -ru gcc-4.0.3-orig/gcc/config.gcc gcc-4.0.3/gcc/config.gcc
|
||||
--- gcc-4.0.3-orig/gcc/config.gcc So Mrz 7 23:08:24 2010
|
||||
+++ gcc-4.0.3/gcc/config.gcc Mo Mrz 8 01:36:54 2010
|
||||
@@ -1867,7 +1867,7 @@
|
||||
sh2*) sh_cpu_target=sh2 ;;
|
||||
*) sh_cpu_target=sh1 ;;
|
||||
esac
|
||||
- sh_cpu_default="`echo $with_cpu|sed s/^m/sh/|tr A-Z_ a-z-`"
|
||||
+ sh_cpu_default="`echo $with_cpu|sed s/^m/sh/|tr [A-Z]_ [a-z]-`"
|
||||
case $sh_cpu_default in
|
||||
sh5-64media-nofpu | sh5-64media | \
|
||||
sh5-32media-nofpu | sh5-32media | sh5-compact-nofpu | sh5-compact | \
|
||||
@@ -1889,9 +1889,9 @@
|
||||
*) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
|
||||
esac
|
||||
fi
|
||||
- target_cpu_default=SELECT_`echo ${sh_cpu_default}|tr a-z- A-Z_`
|
||||
+ target_cpu_default=SELECT_`echo ${sh_cpu_default}|tr [a-z]- [A-Z]_`
|
||||
tm_defines=${tm_defines}' SH_MULTILIB_CPU_DEFAULT=\"'`echo $sh_cpu_default|sed s/sh/m/`'\"'
|
||||
- sh_multilibs=`echo $sh_multilibs,$sh_cpu_default | sed -e 's/[ ,/][ ,]*/ /g' -e 's/ $//' -e s/^m/sh/ -e 's/ m/ sh/g' | tr A-Z_ a-z-`
|
||||
+ sh_multilibs=`echo $sh_multilibs,$sh_cpu_default | sed -e 's/[ ,/][ ,]*/ /g' -e 's/ $//' -e s/^m/sh/ -e 's/ m/ sh/g' | tr [A-Z]_ [a-z]-`
|
||||
for sh_multilib in ${sh_multilibs}; do
|
||||
case ${sh_multilib} in
|
||||
sh1 | sh2 | sh2e | sh3 | sh3e | \
|
||||
@@ -1902,7 +1902,7 @@
|
||||
sh5-32media | sh5-32media-nofpu | \
|
||||
sh5-compact | sh5-compact-nofpu)
|
||||
tmake_file="${tmake_file} sh/t-mlib-${sh_multilib}"
|
||||
- tm_defines="$tm_defines SUPPORT_`echo $sh_multilib|tr a-z- A-Z_`"
|
||||
+ tm_defines="$tm_defines SUPPORT_`echo $sh_multilib|tr [a-z]- [A-Z]_`"
|
||||
;;
|
||||
*)
|
||||
echo "with_multilib_list=${sh_multilib} not supported."
|
||||
@@ -2631,7 +2631,7 @@
|
||||
|
||||
sh[123456ble]-*-* | sh-*-*)
|
||||
supported_defaults="cpu"
|
||||
- case "`echo $with_cpu | tr A-Z_ a-z- | sed s/sh/m/`" in
|
||||
+ case "`echo $with_cpu | tr [A-Z]_ [a-z]- | sed s/sh/m/`" in
|
||||
"" | m1 | m2 | m2e | m3 | m3e | m4 | m4-single | m4-single-only | m4-nofpu )
|
||||
# OK
|
||||
;;
|
||||
|
|
@ -40,10 +40,6 @@ $(TOOLSDIR)/convttf: $(TOOLSDIR)/convttf.c
|
|||
$(SILENT)$(HOSTCC) $(TOOLSFLAGS) -lm -O2 -Wall -g $+ -o $@ \
|
||||
`freetype-config --libs` `freetype-config --cflags`
|
||||
|
||||
$(TOOLSDIR)/player_unifont: $(TOOLSDIR)/player_unifont.c $(ROOTDIR)/firmware/drivers/lcd-charset-player.c
|
||||
$(call PRINTS,CC $(@F))
|
||||
$(SILENT)$(HOSTCC) $(TOOLSFLAGS) -DARCHOS_PLAYER -D__PCTOOL__ -I$(ROOTDIR)/firmware/export -I. $+ -o $@
|
||||
|
||||
# implicit rule for simple tools
|
||||
$(TOOLSDIR)/%: $(TOOLSDIR)/%.c
|
||||
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$@))
|
||||
|
|
|
|||
|
|
@ -41,35 +41,6 @@
|
|||
(((unsigned)(x)<<24) & 0xff000000))
|
||||
#endif
|
||||
|
||||
/* bitswap audio bytes, LSB becomes MSB and vice versa */
|
||||
int BitswapAudio (unsigned char* pDest, unsigned char* pSrc, size_t len)
|
||||
{
|
||||
static const unsigned char Lookup[256] =
|
||||
{
|
||||
0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
|
||||
0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8,
|
||||
0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4,
|
||||
0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC,
|
||||
0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2,
|
||||
0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA,
|
||||
0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6,
|
||||
0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE,
|
||||
0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1,
|
||||
0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9,
|
||||
0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5,
|
||||
0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD,
|
||||
0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3,
|
||||
0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB,
|
||||
0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7,
|
||||
0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF,
|
||||
};
|
||||
|
||||
while (len--)
|
||||
*pDest++ = Lookup[*pSrc++];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsigned int version)
|
||||
{
|
||||
|
||||
|
|
@ -91,14 +62,6 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi
|
|||
char mp3filename2[1024];
|
||||
char* mp3filename;
|
||||
FILE* pMp3File;
|
||||
int do_bitswap_audio = 0;
|
||||
|
||||
|
||||
/* We bitswap the voice file only SH based archos players, target IDs
|
||||
equal to or lower than 8. See the "Target id:" line in rockbox-info.txt
|
||||
or the target_id value in configure. */
|
||||
if (targetnum <= 8)
|
||||
do_bitswap_audio = 1;
|
||||
|
||||
memset(voiceonly, 0, sizeof(voiceonly));
|
||||
while (!feof(voicefontids))
|
||||
|
|
@ -147,8 +110,6 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi
|
|||
|
||||
size[i] = fread(buffer, 1, sizeof(buffer), pMp3File);
|
||||
fclose(pMp3File);
|
||||
if (do_bitswap_audio)
|
||||
BitswapAudio(buffer, buffer, size[i]);
|
||||
fwrite(buffer, 1, size[i], output);
|
||||
|
||||
printf(": %d %s %d\n", i, names[i], size[i]); /* debug */
|
||||
|
|
@ -203,12 +164,6 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi
|
|||
} /* for i */
|
||||
} /* for j */
|
||||
|
||||
|
||||
/*
|
||||
* after this the actual bitswapped mp3 data follows,
|
||||
* which we already have written, see above.
|
||||
*/
|
||||
|
||||
fclose(output);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue