summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-15 19:40:55 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-24 21:20:13 +0000
commit092c340a2062fa98b7387fc5fd63578ddae7d0b6 (patch)
tree98ec96946eeb2ae709cb0528cc6998e21bb9b290 /tools
parent17f7cc92c258bc456a27c3e7c5a19c9409851879 (diff)
downloadrockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.tar.gz
rockbox-092c340a2062fa98b7387fc5fd63578ddae7d0b6.zip
[1/4] Remove SH support and all archos targets
This removes all code specific to SH targets Change-Id: I7980523785d2596e65c06430f4638eec74a06061
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile10
-rw-r--r--tools/builds.pm15
-rwxr-xr-xtools/buildzip.pl8
-rwxr-xr-xtools/configure234
-rwxr-xr-xtools/rockboxdev.sh10
-rw-r--r--tools/root.make44
-rw-r--r--tools/scramble.c157
-rw-r--r--tools/sh2d.c573
-rw-r--r--tools/toolchain-patches/gcc-4.0.3-rockbox-1.diff75
-rw-r--r--tools/tools.make4
-rw-r--r--tools/voicefont.c45
11 files changed, 44 insertions, 1131 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 953577b6d1..d63be9e919 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -10,11 +10,11 @@ LDFLAGS := -g
10 10
11.PHONY: rbspeexenc uclpack 11.PHONY: rbspeexenc uclpack
12 12
13CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \ 13CLEANALL := scramble descramble iriver bmp2rb rdf2binary convbdf \
14 generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat lngdump \ 14 generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat lngdump \
15 telechips gigabeats creative hmac-sha1 rbspeexenc mkzenboot mk500boot convttf 15 telechips gigabeats creative hmac-sha1 rbspeexenc mkzenboot mk500boot convttf
16 16
17all: scramble descramble sh2d rdf2binary mkboot mkzenboot convbdf codepages \ 17all: scramble descramble rdf2binary mkboot mkzenboot convbdf codepages \
18 uclpack rbspeexenc voicefont mk500boot 18 uclpack rbspeexenc voicefont mk500boot
19 19
20scramble: scramble.o iriver.o mi4.o gigabeat.o gigabeats.o telechips.o \ 20scramble: 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
36iaudio_bl_flash.c iaudio_bl_flash.h: iaudio_bl_flash.bmp bmp2rb 36iaudio_bl_flash.c iaudio_bl_flash.h: iaudio_bl_flash.bmp bmp2rb
37 $(SILENT)./bmp2rb -f 7 -h . $< >iaudio_bl_flash.c 37 $(SILENT)./bmp2rb -f 7 -h . $< >iaudio_bl_flash.c
38 38
39sh2d: sh2d.c
40
41bmp2rb: bmp2rb.c 39bmp2rb: bmp2rb.c
42 $(SILENT)$(CC) -DAPPLICATION_NAME=\"$@\" $(CFLAGS) $+ -o $@ 40 $(SILENT)$(CC) -DAPPLICATION_NAME=\"$@\" $(CFLAGS) $+ -o $@
43 41
@@ -78,10 +76,6 @@ convbdf: convbdf.c
78codepages: codepages.c codepage_tables.c 76codepages: codepages.c codepage_tables.c
79 $(SILENT)$(CC) $(CFLAGS) $+ -o $@ 77 $(SILENT)$(CC) $(CFLAGS) $+ -o $@
80 78
81player_unifont: player_unifont.c ../firmware/drivers/lcd-charset-player.c
82 $(SILENT)$(CC) -DARCHOS_PLAYER -D__PCTOOL__ -I../firmware/export $+ \
83 -o $@
84
85uclpack: 79uclpack:
86 $(SILENT)$(MAKE) -C ucl 80 $(SILENT)$(MAKE) -C ucl
87 81
diff --git a/tools/builds.pm b/tools/builds.pm
index 7b36c6c046..8c2452d168 100644
--- a/tools/builds.pm
+++ b/tools/builds.pm
@@ -20,23 +20,27 @@ $releasenotes="/wiki/ReleaseNotes315";
20%builds = ( 20%builds = (
21 'archosfmrecorder' => { 21 'archosfmrecorder' => {
22 name => 'Archos FM Recorder', 22 name => 'Archos FM Recorder',
23 status => 3, 23 status => 0,
24 ram => 2, 24 ram => 2,
25 release => '3.15',
25 }, 26 },
26 'archosondiofm' => { 27 'archosondiofm' => {
27 name => 'Archos Ondio FM', 28 name => 'Archos Ondio FM',
28 status => 3, 29 status => 0,
29 ram => 2, 30 ram => 2,
31 release => '3.15',
30 }, 32 },
31 'archosondiosp' => { 33 'archosondiosp' => {
32 name => 'Archos Ondio SP', 34 name => 'Archos Ondio SP',
33 status => 3, 35 status => 0,
34 ram => 2, 36 ram => 2,
37 release => '3.15',
35 }, 38 },
36 'archosplayer' => { 39 'archosplayer' => {
37 name => 'Archos Player/Studio', 40 name => 'Archos Player/Studio',
38 status => 3, 41 status => 0,
39 ram => 2, 42 ram => 2,
43 release => '3.15',
40 }, 44 },
41 'archosrecorder' => { 45 'archosrecorder' => {
42 name => 'Archos Recorder v1', 46 name => 'Archos Recorder v1',
@@ -46,9 +50,10 @@ $releasenotes="/wiki/ReleaseNotes315";
46 }, 50 },
47 'archosrecorderv2' => { 51 'archosrecorderv2' => {
48 name => 'Archos Recorder v2', 52 name => 'Archos Recorder v2',
49 status => 3, 53 status => 0,
50 ram => 2, 54 ram => 2,
51 manual => "archosfmrecorder", 55 manual => "archosfmrecorder",
56 release => '3.15',
52 }, 57 },
53 'cowond2' => { 58 'cowond2' => {
54 name => 'Cowon D2', 59 name => 'Cowon D2',
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index 6a67f7b51b..b1626f429c 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -691,15 +691,9 @@ sub runone {
691 691
692if(!$exe) { 692if(!$exe) {
693 # not specified, guess! 693 # not specified, guess!
694 if($target =~ /(recorder|ondio)/i) { 694 if($target =~ /iriver/i) {
695 $exe = "ajbrec.ajz";
696 }
697 elsif($target =~ /iriver/i) {
698 $exe = "rockbox.iriver"; 695 $exe = "rockbox.iriver";
699 } 696 }
700 else {
701 $exe = "archos.mod";
702 }
703} 697}
704elsif(($exe =~ /rockboxui/)) { 698elsif(($exe =~ /rockboxui/)) {
705 # simulator, exclude the exe file 699 # simulator, exclude the exe file
diff --git a/tools/configure b/tools/configure
index 501482ea0e..b4a7910397 100755
--- a/tools/configure
+++ b/tools/configure
@@ -496,14 +496,6 @@ EOF
496# the gcc version should most likely match what versions we build with 496# the gcc version should most likely match what versions we build with
497# rockboxdev.sh 497# rockboxdev.sh
498# 498#
499shcc () {
500 prefixtools sh-elf-
501 GCCOPTS="$CCOPTS -m1"
502 GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
503 endian="big"
504 gccchoice="4.0.3"
505}
506
507calmrisccc () { 499calmrisccc () {
508 prefixtools calmrisc16-unknown-elf- 500 prefixtools calmrisc16-unknown-elf-
509 GCCOPTS="-Wl\,--no-check-sections $CCOPTS" 501 GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
@@ -927,12 +919,6 @@ whichadvanced () {
927 printf "Enter your developer options (press only enter when done)\n\ 919 printf "Enter your developer options (press only enter when done)\n\
928(D)EBUG, (L)ogf, Boot(c)hart, (S)imulator, (P)rofiling, (V)oice, (W)in32 crosscompile,\n\ 920(D)EBUG, (L)ogf, Boot(c)hart, (S)imulator, (P)rofiling, (V)oice, (W)in32 crosscompile,\n\
929Win(6)4 crosscompile, (T)est plugins, S(m)all C lib, Logf to Ser(i)al port:" 921Win(6)4 crosscompile, (T)est plugins, S(m)all C lib, Logf to Ser(i)al port:"
930 if [ "$modelname" = "archosplayer" ]; then
931 printf ", Use (A)TA poweroff"
932 fi
933 if [ "$t_model" = "ondio" ]; then
934 printf ", (B)acklight MOD"
935 fi
936 if [ "$modelname" = "iaudiom5" ]; then 922 if [ "$modelname" = "iaudiom5" ]; then
937 printf ", (F)M radio MOD" 923 printf ", (F)M radio MOD"
938 fi 924 fi
@@ -998,18 +984,6 @@ Win(6)4 crosscompile, (T)est plugins, S(m)all C lib, Logf to Ser(i)al port:"
998 echo "Voice build selected" 984 echo "Voice build selected"
999 voice="yes" 985 voice="yes"
1000 ;; 986 ;;
1001 [Aa])
1002 if [ "$modelname" = "archosplayer" ]; then
1003 have_ata_poweroff="#define HAVE_ATA_POWER_OFF"
1004 echo "ATA power off enabled"
1005 fi
1006 ;;
1007 [Bb])
1008 if [ "$t_model" = "ondio" ]; then
1009 have_backlight="#define HAVE_BACKLIGHT"
1010 echo "Backlight functions enabled"
1011 fi
1012 ;;
1013 [Ff]) 987 [Ff])
1014 if [ "$modelname" = "iaudiom5" ]; then 988 if [ "$modelname" = "iaudiom5" ]; then
1015 have_fmradio_in="#define HAVE_FMRADIO_IN" 989 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:"
1076 if [ "yes" = "$simulator" ]; then 1050 if [ "yes" = "$simulator" ]; then
1077 debug="-DDEBUG" 1051 debug="-DDEBUG"
1078 extradefines="$extradefines -DSIMULATOR -DHAVE_TEST_PLUGINS" 1052 extradefines="$extradefines -DSIMULATOR -DHAVE_TEST_PLUGINS"
1079 archosrom=""
1080 flash="" 1053 flash=""
1081 fi 1054 fi
1082 if [ "yes" = "$profile" ]; then 1055 if [ "yes" = "$profile" ]; then
@@ -1572,13 +1545,13 @@ if [ "$ARG_TARGET" ]; then
1572else 1545else
1573 echo "Enter target platform:" 1546 echo "Enter target platform:"
1574cat <<EOF 1547cat <<EOF
1575 ==Archos== ==iriver== ==Apple iPod== 1548 ==iriver== ==Apple iPod==
1576 0) Player/Studio 10) H120/H140 20) Color/Photo 1549 10) H120/H140 20) Color/Photo
1577 1) Recorder 11) H320/H340 21) Nano 1G 1550 11) H320/H340 21) Nano 1G
1578 2) FM Recorder 12) iHP-100/110/115 22) Video 1551 12) iHP-100/110/115 22) Video
1579 3) Recorder v2 13) iFP-790 23) 3G 1552 13) iFP-790 23) 3G
1580 4) Ondio SP 14) H10 20Gb 24) 4G Grayscale 1553 14) H10 20Gb 24) 4G Grayscale
1581 5) Ondio FM 15) H10 5/6Gb 25) Mini 1G 1554 15) H10 5/6Gb 25) Mini 1G
1582 26) Mini 2G 1555 26) Mini 2G
1583 ==Toshiba== 27) 1G, 2G 1556 ==Toshiba== 27) 1G, 2G
1584 ==Cowon/iAudio== 40) Gigabeat F/X 28) Nano 2G 1557 ==Cowon/iAudio== 40) Gigabeat F/X 28) Nano 2G
@@ -1641,7 +1614,6 @@ fi
1641 toolset="rdf2binary convbdf codepages" 1614 toolset="rdf2binary convbdf codepages"
1642 1615
1643 # Toolsets for some target families: 1616 # Toolsets for some target families:
1644 archosbitmaptools="$toolset scramble descramble sh2d uclpack bmp2rb"
1645 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb" 1617 iriverbitmaptools="$toolset scramble descramble mkboot bmp2rb"
1646 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb" 1618 iaudiobitmaptools="$toolset scramble descramble mkboot bmp2rb"
1647 ipodbitmaptools="$toolset scramble bmp2rb" 1619 ipodbitmaptools="$toolset scramble bmp2rb"
@@ -1673,8 +1645,6 @@ fi
1673 # $output) 1645 # $output)
1674 # appextra: passed to the APPEXTRA variable in the Makefiles. 1646 # appextra: passed to the APPEXTRA variable in the Makefiles.
1675 # TODO: add proper explanation 1647 # TODO: add proper explanation
1676 # archosrom: used only for Archos targets that build a special flashable .ucl
1677 # image.
1678 # flash: name of output for flashing, for targets where there's a special 1648 # flash: name of output for flashing, for targets where there's a special
1679 # file output for this. 1649 # file output for this.
1680 # plugins: set to 'yes' to build the plugins. Early development builds can 1650 # plugins: set to 'yes' to build the plugins. Early development builds can
@@ -1691,140 +1661,6 @@ fi
1691 1661
1692 case $buildfor in 1662 case $buildfor in
1693 1663
1694 0|archosplayer)
1695 target_id=1
1696 modelname="archosplayer"
1697 target="ARCHOS_PLAYER"
1698 shcc
1699 tool="$rootdir/tools/scramble"
1700 output="archos.mod"
1701 appextra="player:gui"
1702 #archosrom="$pwd/rombox.ucl"
1703 flash="$pwd/rockbox.ucl"
1704 plugins="yes"
1705 swcodec=""
1706
1707 # toolset is the tools within the tools directory that we build for
1708 # this particular target.
1709 toolset="$toolset scramble descramble sh2d player_unifont uclpack"
1710
1711 # Note: the convbdf is present in the toolset just because: 1) the
1712 # firmware/Makefile assumes it is present always, and 2) we will need it when we
1713 # build the player simulator
1714
1715 t_cpu="sh"
1716 t_manufacturer="archos"
1717 t_model="player"
1718 ;;
1719
1720 1|archosrecorder)
1721 target_id=2
1722 modelname="archosrecorder"
1723 target="ARCHOS_RECORDER"
1724 shcc
1725 tool="$rootdir/tools/scramble"
1726 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1727 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1728 output="ajbrec.ajz"
1729 appextra="recorder:gui:radio"
1730 #archosrom="$pwd/rombox.ucl"
1731 flash="$pwd/rockbox.ucl"
1732 plugins="yes"
1733 swcodec=""
1734 # toolset is the tools within the tools directory that we build for
1735 # this particular target.
1736 toolset=$archosbitmaptools
1737 t_cpu="sh"
1738 t_manufacturer="archos"
1739 t_model="recorder"
1740 ;;
1741
1742 2|archosfmrecorder)
1743 target_id=3
1744 modelname="archosfmrecorder"
1745 target="ARCHOS_FMRECORDER"
1746 shcc
1747 tool="$rootdir/tools/scramble -fm"
1748 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1749 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1750 output="ajbrec.ajz"
1751 appextra="recorder:gui:radio"
1752 #archosrom="$pwd/rombox.ucl"
1753 flash="$pwd/rockbox.ucl"
1754 plugins="yes"
1755 swcodec=""
1756 # toolset is the tools within the tools directory that we build for
1757 # this particular target.
1758 toolset=$archosbitmaptools
1759 t_cpu="sh"
1760 t_manufacturer="archos"
1761 t_model="fm_v2"
1762 ;;
1763
1764 3|archosrecorderv2)
1765 target_id=4
1766 modelname="archosrecorderv2"
1767 target="ARCHOS_RECORDERV2"
1768 shcc
1769 tool="$rootdir/tools/scramble -v2"
1770 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1771 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1772 output="ajbrec.ajz"
1773 appextra="recorder:gui:radio"
1774 #archosrom="$pwd/rombox.ucl"
1775 flash="$pwd/rockbox.ucl"
1776 plugins="yes"
1777 swcodec=""
1778 # toolset is the tools within the tools directory that we build for
1779 # this particular target.
1780 toolset=$archosbitmaptools
1781 t_cpu="sh"
1782 t_manufacturer="archos"
1783 t_model="fm_v2"
1784 ;;
1785
1786 4|archosondiosp)
1787 target_id=7
1788 modelname="archosondiosp"
1789 target="ARCHOS_ONDIOSP"
1790 shcc
1791 tool="$rootdir/tools/scramble -osp"
1792 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1793 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1794 output="ajbrec.ajz"
1795 appextra="recorder:gui:radio"
1796 #archosrom="$pwd/rombox.ucl"
1797 flash="$pwd/rockbox.ucl"
1798 plugins="yes"
1799 swcodec=""
1800 # toolset is the tools within the tools directory that we build for
1801 # this particular target.
1802 toolset=$archosbitmaptools
1803 t_cpu="sh"
1804 t_manufacturer="archos"
1805 t_model="ondio"
1806 ;;
1807
1808 5|archosondiofm)
1809 target_id=8
1810 modelname="archosondiofm"
1811 target="ARCHOS_ONDIOFM"
1812 shcc
1813 tool="$rootdir/tools/scramble -ofm"
1814 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
1815 bmp2rb_native="$rootdir/tools/bmp2rb -f 0"
1816 output="ajbrec.ajz"
1817 appextra="recorder:gui:radio"
1818 #archosrom="$pwd/rombox.ucl"
1819 flash="$pwd/rockbox.ucl"
1820 plugins="yes"
1821 swcodec=""
1822 toolset=$archosbitmaptools
1823 t_cpu="sh"
1824 t_manufacturer="archos"
1825 t_model="ondio"
1826 ;;
1827
1828 10|iriverh120) 1664 10|iriverh120)
1829 target_id=9 1665 target_id=9
1830 modelname="iriverh120" 1666 modelname="iriverh120"
@@ -4529,21 +4365,14 @@ fi
4529 echo "sansa eraser build selected" 4365 echo "sansa eraser build selected"
4530 ;; 4366 ;;
4531 [Bb]) 4367 [Bb])
4532 if test $t_manufacturer = "archos"; then 4368 appsdir='$(ROOTDIR)/bootloader'
4533 # Archos SH-based players do this somewhat differently for 4369 apps="bootloader"
4534 # some reason 4370 flash=""
4535 appsdir='$(ROOTDIR)/flash/bootbox' 4371 if test -n "$boottool"; then
4536 apps="bootbox" 4372 tool="$boottool"
4537 else 4373 fi
4538 appsdir='$(ROOTDIR)/bootloader' 4374 if test -n "$bootoutput"; then
4539 apps="bootloader" 4375 output=$bootoutput
4540 flash=""
4541 if test -n "$boottool"; then
4542 tool="$boottool"
4543 fi
4544 if test -n "$bootoutput"; then
4545 output=$bootoutput
4546 fi
4547 fi 4376 fi
4548 extradefines="$extradefines -DBOOTLOADER -ffunction-sections -fdata-sections" 4377 extradefines="$extradefines -DBOOTLOADER -ffunction-sections -fdata-sections"
4549 bootloader="1" 4378 bootloader="1"
@@ -4557,7 +4386,6 @@ fi
4557 debug="-DDEBUG" 4386 debug="-DDEBUG"
4558 simulator="yes" 4387 simulator="yes"
4559 extradefines="$extradefines -DSIMULATOR -DHAVE_TEST_PLUGINS" 4388 extradefines="$extradefines -DSIMULATOR -DHAVE_TEST_PLUGINS"
4560 archosrom=""
4561 flash="" 4389 flash=""
4562 echo "Simulator build selected" 4390 echo "Simulator build selected"
4563 ;; 4391 ;;
@@ -4588,7 +4416,6 @@ fi
4588 extradefines="$extradefines -DDEBUG" 4416 extradefines="$extradefines -DDEBUG"
4589 appsdir='$(ROOTDIR)/tools/checkwps'; 4417 appsdir='$(ROOTDIR)/tools/checkwps';
4590 output='checkwps.'${modelname}; 4418 output='checkwps.'${modelname};
4591 archosrom='';
4592 echo "CheckWPS build selected" 4419 echo "CheckWPS build selected"
4593 ;; 4420 ;;
4594 [Dd]) 4421 [Dd])
@@ -4596,7 +4423,6 @@ fi
4596 simcc "database-sdl" 4423 simcc "database-sdl"
4597 toolset=''; 4424 toolset='';
4598 appsdir='$(ROOTDIR)/tools/database'; 4425 appsdir='$(ROOTDIR)/tools/database';
4599 archosrom='';
4600 4426
4601 case $uname in 4427 case $uname in
4602 CYGWIN*|MINGW*) 4428 CYGWIN*|MINGW*)
@@ -4620,7 +4446,6 @@ fi
4620 GCCOPTS=''; 4446 GCCOPTS='';
4621 extradefines="$extradefines -DDEBUG" 4447 extradefines="$extradefines -DDEBUG"
4622 output='warble.'${modelname}; 4448 output='warble.'${modelname};
4623 archosrom='';
4624 echo "Warble build selected" 4449 echo "Warble build selected"
4625 ;; 4450 ;;
4626 *) 4451 *)
@@ -4636,9 +4461,6 @@ fi
4636 esac 4461 esac
4637 # to be able running "make manual" from non-manual configuration 4462 # to be able running "make manual" from non-manual configuration
4638 case $modelname in 4463 case $modelname in
4639 archosrecorderv2)
4640 manualdev="archosfmrecorder"
4641 ;;
4642 iriverh1??) 4464 iriverh1??)
4643 manualdev="iriverh100" 4465 manualdev="iriverh100"
4644 ;; 4466 ;;
@@ -4766,30 +4588,15 @@ echo "Using $LD $ldver"
4766makever=`make --version | head -1` 4588makever=`make --version | head -1`
4767echo "Detected make $makever" 4589echo "Detected make $makever"
4768 4590
4769# check the compiler for SH platforms
4770if test "$CC" = "sh-elf-gcc"; then
4771 if test "$gccnum" -lt "400"; then
4772 echo "WARNING: Consider upgrading your compiler to the 4.0.X series!"
4773 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
4774 else
4775 # figure out patch status
4776 gccpatch=`$CC --version`;
4777
4778 if { echo $gccpatch | grep "rockbox" >/dev/null 2>&1; } then
4779 echo "gcc $gccver is rockbox patched"
4780 # then convert -O to -Os to get smaller binaries!
4781 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
4782 else
4783 echo "WARNING: You use an unpatched gcc compiler: $gccver"
4784 echo "WARNING: http://www.rockbox.org/twiki/bin/view/Main/CrossCompiler"
4785 fi
4786 fi
4787fi
4788
4789if test "$CC" = "m68k-elf-gcc"; then 4591if test "$CC" = "m68k-elf-gcc"; then
4790 # convert -O to -Os to get smaller binaries! 4592 # convert -O to -Os to get smaller binaries!
4791 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'` 4593 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
4792fi 4594fi
4595if test "$CC" = "mipsel-elf-gcc"; then
4596 # convert -O to -Os to get smaller binaries!
4597 GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
4598fi
4599
4793 4600
4794if [ "$ARG_CCACHE" = "1" ]; then 4601if [ "$ARG_CCACHE" = "1" ]; then
4795 echo "Enable ccache for building" 4602 echo "Enable ccache for building"
@@ -5025,7 +4832,6 @@ export DOCSDIR=${rootdir}/docs
5025export MANUALDIR=${rootdir}/manual 4832export MANUALDIR=${rootdir}/manual
5026export DEBUG=${debug} 4833export DEBUG=${debug}
5027export MODELNAME=${modelname} 4834export MODELNAME=${modelname}
5028export ARCHOSROM=${archosrom}
5029export FLASHFILE=${flash} 4835export FLASHFILE=${flash}
5030export TARGET_ID=${target_id} 4836export TARGET_ID=${target_id}
5031export TARGET=-D${target} 4837export TARGET=-D${target}
diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh
index 4123790ce6..bf50faf214 100755
--- a/tools/rockboxdev.sh
+++ b/tools/rockboxdev.sh
@@ -700,7 +700,6 @@ fi
700 700
701if [ -z "$RBDEV_TARGET" ]; then 701if [ -z "$RBDEV_TARGET" ]; then
702 echo "Select target arch:" 702 echo "Select target arch:"
703 echo "s - sh (Archos models)"
704 echo "m - m68k (iriver h1x0/h3x0, iaudio m3/m5/x5 and mpio hd200)" 703 echo "m - m68k (iriver h1x0/h3x0, iaudio m3/m5/x5 and mpio hd200)"
705 echo "a - arm (ipods, iriver H10, Sansa, D2, Gigabeat, etc)" 704 echo "a - arm (ipods, iriver H10, Sansa, D2, Gigabeat, etc)"
706 echo "i - mips (Jz47xx and ATJ-based players)" 705 echo "i - mips (Jz47xx and ATJ-based players)"
@@ -724,15 +723,6 @@ do
724 export MAKEFLAGS=`echo $MAKEFLAGS| sed 's/ -r / /'` # We don't want -r 723 export MAKEFLAGS=`echo $MAKEFLAGS| sed 's/ -r / /'` # We don't want -r
725 echo "" 724 echo ""
726 case $arch in 725 case $arch in
727 [Ss])
728 # For binutils 2.16.1 builtin rules conflict on some systems with a
729 # default rule for Objective C. Disable the builtin make rules. See
730 # http://sourceware.org/ml/binutils/2005-12/msg00259.html
731 export MAKEFLAGS="-r $MAKEFLAGS"
732 build "binutils" "sh-elf" "2.16.1" "binutils-2.16.1-texinfo-fix.diff" "--disable-werror"
733 build "gcc" "sh-elf" "4.0.3" "gcc-4.0.3-rockbox-1.diff"
734 ;;
735
736 [Ii]) 726 [Ii])
737 build "binutils" "mipsel-elf" "2.26.1" "" "--disable-werror" 727 build "binutils" "mipsel-elf" "2.26.1" "" "--disable-werror"
738 build "gcc" "mipsel-elf" "4.9.4" "" "" "gmp mpfr mpc" 728 build "gcc" "mipsel-elf" "4.9.4" "" "" "gmp mpfr mpc"
diff --git a/tools/root.make b/tools/root.make
index 412dbbc97b..b588e0f8b1 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -14,7 +14,7 @@ DEFINES = -DROCKBOX -DMEMORYSIZE=$(MEMORYSIZE) $(TARGET) \
14 $(EXTRA_DEFINES) # <-- -DSIMULATOR or not 14 $(EXTRA_DEFINES) # <-- -DSIMULATOR or not
15INCLUDES = -I$(BUILDDIR) -I$(BUILDDIR)/lang $(TARGET_INC) 15INCLUDES = -I$(BUILDDIR) -I$(BUILDDIR)/lang $(TARGET_INC)
16 16
17CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS) 17CFLAGS = $(INCLUDES) $(DEFINES) $(GCCOPTS)
18PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix 18PPCFLAGS = $(filter-out -g -Dmain=SDL_main,$(CFLAGS)) # cygwin sdl-config fix
19ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files 19ASMFLAGS = -D__ASSEMBLER__ # work around gcc 3.4.x bug with -std=gnu99, only meant for .S files
20CORE_LDOPTS = $(GLOBAL_LDOPTS) # linker ops specifically for core build 20CORE_LDOPTS = $(GLOBAL_LDOPTS) # linker ops specifically for core build
@@ -24,9 +24,6 @@ TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \
24 $(TOOLSDIR)/uclpack $(TOOLSDIR)/mkboot $(TOOLSDIR)/iaudio_bl_flash.c \ 24 $(TOOLSDIR)/uclpack $(TOOLSDIR)/mkboot $(TOOLSDIR)/iaudio_bl_flash.c \
25 $(TOOLSDIR)/iaudio_bl_flash.h 25 $(TOOLSDIR)/iaudio_bl_flash.h
26 26
27ifeq ($(MODELNAME),archosplayer)
28 TOOLS += $(TOOLSDIR)/player_unifont
29endif
30 27
31ifeq (,$(PREFIX)) 28ifeq (,$(PREFIX))
32ifdef APP_TYPE 29ifdef APP_TYPE
@@ -110,8 +107,6 @@ ifneq (,$(findstring bootloader,$(APPSDIR)))
110 else 107 else
111 include $(APPSDIR)/bootloader.make 108 include $(APPSDIR)/bootloader.make
112 endif 109 endif
113else ifneq (,$(findstring bootbox,$(APPSDIR)))
114 include $(APPSDIR)/bootbox.make
115else ifneq (,$(findstring checkwps,$(APP_TYPE))) 110else ifneq (,$(findstring checkwps,$(APP_TYPE)))
116 include $(APPSDIR)/checkwps.make 111 include $(APPSDIR)/checkwps.make
117 include $(ROOTDIR)/lib/skin_parser/skin_parser.make 112 include $(ROOTDIR)/lib/skin_parser/skin_parser.make
@@ -182,7 +177,7 @@ OBJ := $(OBJ:.S=.o)
182OBJ += $(BMP:.bmp=.o) 177OBJ += $(BMP:.bmp=.o)
183OBJ := $(call full_path_subst,$(ROOTDIR)/%,$(BUILDDIR)/%,$(OBJ)) 178OBJ := $(call full_path_subst,$(ROOTDIR)/%,$(BUILDDIR)/%,$(OBJ))
184 179
185build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(ARCHOSROM) $(RBINFO) 180build: $(TOOLS) $(BUILDDIR)/$(BINARY) $(CODECS) $(ROCKS) $(RBINFO)
186 181
187$(RBINFO): $(BUILDDIR)/$(BINARY) 182$(RBINFO): $(BUILDDIR)/$(BINARY)
188 $(SILENT)echo Creating $(@F) 183 $(SILENT)echo Creating $(@F)
@@ -215,7 +210,7 @@ clean::
215 rockbox-manual*.zip sysfont.h rockbox-info.txt voicefontids \ 210 rockbox-manual*.zip sysfont.h rockbox-info.txt voicefontids \
216 *.wav *.mp3 *.voice $(CLEANOBJS) \ 211 *.wav *.mp3 *.voice $(CLEANOBJS) \
217 $(LINKRAM) $(LINKROM) rockbox.elf rockbox.map rockbox.bin \ 212 $(LINKRAM) $(LINKROM) rockbox.elf rockbox.map rockbox.bin \
218 make.dep rombox.elf rombox.map rombox.bin rombox.ucl romstart.txt \ 213 make.dep rombox.elf rombox.map rombox.bin romstart.txt \
219 $(BINARY) $(FLASHFILE) uisimulator bootloader flash $(BOOTLINK) \ 214 $(BINARY) $(FLASHFILE) uisimulator bootloader flash $(BOOTLINK) \
220 rockbox.apk lang_enum.h rbversion.h 215 rockbox.apk lang_enum.h rbversion.h
221 216
@@ -273,37 +268,8 @@ $(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf
273$(BUILDDIR)/rombox.bin : $(BUILDDIR)/rombox.elf 268$(BUILDDIR)/rombox.bin : $(BUILDDIR)/rombox.elf
274 $(call PRINTS,OC $(@F))$(call objcopy,$<,$@) 269 $(call PRINTS,OC $(@F))$(call objcopy,$<,$@)
275 270
276#
277# If there's a flashfile defined for this target (rockbox.ucl for Archos
278# models) Then check if the mkfirmware script fails, as then it is (likely)
279# because the image is too big and we need to create a compressed image
280# instead.
281#
282$(BUILDDIR)/$(BINARY) : $(BUILDDIR)/rockbox.bin $(FLASHFILE) 271$(BUILDDIR)/$(BINARY) : $(BUILDDIR)/rockbox.bin $(FLASHFILE)
283 $(call PRINTS,SCRAMBLE $(notdir $@))($(MKFIRMWARE) $< $@; \ 272 $(call PRINTS,SCRAMBLE $(notdir $@)) $(MKFIRMWARE) $< $@
284 stat=$$?; \
285 if test -n "$(FLASHFILE)"; then \
286 if test "$$stat" -ne 0; then \
287 echo "Image too big, making a compressed version!"; \
288 $(MAKE) -C $(FIRMDIR)/decompressor OBJDIR=$(BUILDDIR)/firmware/decompressor; \
289 $(MKFIRMWARE) $(BUILDDIR)/firmware/decompressor/compressed.bin $@; \
290 fi \
291 fi )
292
293# archos
294$(BUILDDIR)/rockbox.ucl: $(BUILDDIR)/rockbox.bin
295 $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --best --2e -b1048576 $< $@ >/dev/null
296
297MAXINFILE = $(BUILDDIR)/temp.txt
298MAXOUTFILE = $(BUILDDIR)/romstart.txt
299
300$(BUILDDIR)/rombox.ucl: $(BUILDDIR)/rombox.bin $(MAXOUTFILE)
301 $(call PRINTS,UCLPACK $(@F))$(TOOLSDIR)/uclpack --none $< $@ >/dev/null; \
302 perl $(TOOLSDIR)/romsizetest.pl `cat $(MAXOUTFILE)` $<; \
303 if test $$? -ne 0; then \
304 echo "removing UCL file again, making it a fake one"; \
305 echo "fake" > $@; \
306 fi
307 273
308$(MAXOUTFILE): 274$(MAXOUTFILE):
309 $(call PRINTS,Creating $(@F)) 275 $(call PRINTS,Creating $(@F))
@@ -343,7 +309,7 @@ endif
343mapzip: 309mapzip:
344 $(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip 310 $(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
345 311
346elfzip: 312elfzip:
347 $(SILENT)find . -name "*.elf" | xargs zip rockbox-elfs.zip 313 $(SILENT)find . -name "*.elf" | xargs zip rockbox-elfs.zip
348 314
349fullzip: 315fullzip:
diff --git a/tools/scramble.c b/tools/scramble.c
index 7aa468ebaa..3b9497186d 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -36,24 +36,6 @@ static int iaudio_encode(char *iname, char *oname, char *idstring);
36static int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc); 36static int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc);
37static int ccpmp_encode(char *iname, char *oname); 37static int ccpmp_encode(char *iname, char *oname);
38 38
39enum
40{
41 ARCHOS_PLAYER, /* and V1 recorder */
42 ARCHOS_V2RECORDER,
43 ARCHOS_FMRECORDER,
44 ARCHOS_ONDIO_SP,
45 ARCHOS_ONDIO_FM
46};
47
48static unsigned int size_limit[] =
49{
50 0x32000, /* ARCHOS_PLAYER */
51 0x64000, /* ARCHOS_V2RECORDER */
52 0x64000, /* ARCHOS_FMRECORDER */
53 0x64000, /* ARCHOS_ONDIO_SP */
54 0x64000 /* ARCHOS_ONDIO_FM */
55};
56
57void short2le(unsigned short val, unsigned char* addr) 39void short2le(unsigned short val, unsigned char* addr)
58{ 40{
59 addr[0] = val & 0xFF; 41 addr[0] = val & 0xFF;
@@ -91,14 +73,9 @@ void short2be(unsigned short val, unsigned char* addr)
91 73
92void usage(void) 74void usage(void)
93{ 75{
94 printf("usage: scramble [options] <input file> <output file> [xor string]\n"); 76 printf("usage: scramble [options] <input file> <output file>\n");
95 printf("options:\n" 77 printf("options:\n"
96 "\t-fm Archos FM recorder format\n"
97 "\t-v2 Archos V2 recorder format\n"
98 "\t-ofm Archos Ondio FM recorder format\n"
99 "\t-osp Archos Ondio SP format\n"
100 "\t-neo SSI Neo format\n" 78 "\t-neo SSI Neo format\n"
101 "\t-mm=X Archos Multimedia format (X values: A=JBMM, B=AV1xx, C=AV3xx)\n"
102 "\t-iriver iRiver format\n" 79 "\t-iriver iRiver format\n"
103 "\t-iaudiox5 iAudio X5 format\n" 80 "\t-iaudiox5 iAudio X5 format\n"
104 "\t-iaudiox5v iAudio X5V format\n" 81 "\t-iaudiox5v iAudio X5V format\n"
@@ -131,87 +108,38 @@ void usage(void)
131 "\t ip6g, rk27, clzp, zxf2, zxf3, fuz+, e370, e360,\n" 108 "\t ip6g, rk27, clzp, zxf2, zxf3, fuz+, e370, e360,\n"
132 "\t zxfi, zmoz, zen, zenv, ypz5, zxfs, e450, e460,\n" 109 "\t zxfi, zmoz, zen, zenv, ypz5, zxfs, e450, e460,\n"
133 "\t e470, e580, a10, a20, a860, s750, e350, xdx3)\n"); 110 "\t e470, e580, a10, a20, a860, s750, e350, xdx3)\n");
134 printf("\nNo option results in Archos standard player/recorder format.\n"); 111 printf("\nNo option results in nothing being done.\n");
135 112
136 exit(1); 113 exit(1);
137} 114}
138 115
139int main (int argc, char** argv) 116int main (int argc, char** argv)
140{ 117{
141 unsigned long length,i,slen=0; 118 unsigned long length,i;
142 unsigned char *inbuf,*outbuf; 119 unsigned char *inbuf,*outbuf;
143 unsigned short crc=0; 120 unsigned short crc=0;
144 unsigned long chksum=0; /* 32 bit checksum */ 121 unsigned long chksum=0; /* 32 bit checksum */
145 unsigned char header[24]; 122 unsigned char header[24];
146 char *iname = argv[1]; 123 char *iname = argv[1];
147 char *oname = argv[2]; 124 char *oname = argv[2];
148 char *xorstring=NULL;
149 int headerlen = 6; 125 int headerlen = 6;
150 FILE* file; 126 FILE* file;
151 int version=0; 127 int version=0;
152 unsigned long modelnum; 128 unsigned long modelnum;
153 char modelname[5]; 129 char modelname[5];
154 int model_id; 130 enum { none, tcc_sum, tcc_crc, rkw, add } method = none;
155 enum { none, scramble, xor, tcc_sum, tcc_crc, rkw, add } method = scramble;
156 bool creative_enable_ciff; 131 bool creative_enable_ciff;
157 132
158 model_id = ARCHOS_PLAYER;
159
160 if (argc < 3) { 133 if (argc < 3) {
161 usage(); 134 usage();
162 } 135 }
163 136
164 if(!strcmp(argv[1], "-fm")) {
165 headerlen = 24;
166 iname = argv[2];
167 oname = argv[3];
168 version = 4;
169 model_id = ARCHOS_FMRECORDER;
170 }
171
172 else if(!strcmp(argv[1], "-v2")) {
173 headerlen = 24;
174 iname = argv[2];
175 oname = argv[3];
176 version = 2;
177 model_id = ARCHOS_V2RECORDER;
178 }
179
180 else if(!strcmp(argv[1], "-ofm")) {
181 headerlen = 24;
182 iname = argv[2];
183 oname = argv[3];
184 version = 8;
185 model_id = ARCHOS_ONDIO_FM;
186 }
187
188 else if(!strcmp(argv[1], "-osp")) {
189 headerlen = 24;
190 iname = argv[2];
191 oname = argv[3];
192 version = 16;
193 model_id = ARCHOS_ONDIO_SP;
194 }
195
196 else if(!strcmp(argv[1], "-neo")) { 137 else if(!strcmp(argv[1], "-neo")) {
197 headerlen = 17; 138 headerlen = 17;
198 iname = argv[2]; 139 iname = argv[2];
199 oname = argv[3]; 140 oname = argv[3];
200 method = none; 141 method = none;
201 } 142 }
202 else if(!strncmp(argv[1], "-mm=", 4)) {
203 headerlen = 16;
204 iname = argv[2];
205 oname = argv[3];
206 method = xor;
207 version = argv[1][4];
208 if (argc > 4)
209 xorstring = argv[4];
210 else {
211 printf("Multimedia needs an xor string\n");
212 return -1;
213 }
214 }
215 else if(!strncmp(argv[1], "-tcc=", 4)) { 143 else if(!strncmp(argv[1], "-tcc=", 4)) {
216 headerlen = 0; 144 headerlen = 0;
217 iname = argv[2]; 145 iname = argv[2];
@@ -554,20 +482,10 @@ int main (int argc, char** argv)
554 length = ftell(file); 482 length = ftell(file);
555 length = (length + 3) & ~3; /* Round up to nearest 4 byte boundary */ 483 length = (length + 3) & ~3; /* Round up to nearest 4 byte boundary */
556 484
557 if ((method == scramble) &&
558 ((length + headerlen) >= size_limit[model_id])) {
559 printf("error: firmware image is %ld bytes while max size is %u!\n",
560 length + headerlen,
561 size_limit[model_id]);
562 fclose(file);
563 return -1;
564 }
565 485
566 fseek(file,0,SEEK_SET); 486 fseek(file,0,SEEK_SET);
567 inbuf = malloc(length); 487 inbuf = malloc(length);
568 if (method == xor) 488 if(method == add)
569 outbuf = malloc(length*2);
570 else if(method == add)
571 outbuf = malloc(length + 8); 489 outbuf = malloc(length + 8);
572 else 490 else
573 outbuf = malloc(length); 491 outbuf = malloc(length);
@@ -597,32 +515,13 @@ int main (int argc, char** argv)
597 chksum += inbuf[i]; 515 chksum += inbuf[i];
598 } 516 }
599 break; 517 break;
600 case scramble:
601 slen = length/4;
602 for (i = 0; i < length; i++) {
603 unsigned long addr = (i >> 2) + ((i % 4) * slen);
604 unsigned char data = inbuf[i];
605 data = ~((data << 1) | ((data >> 7) & 1)); /* poor man's ROL */
606 outbuf[addr] = data;
607 }
608 break;
609
610 case xor:
611 /* "compress" */
612 slen = 0;
613 for (i=0; i<length; i++) {
614 if (!(i&7))
615 outbuf[slen++] = 0xff; /* all data is uncompressed */
616 outbuf[slen++] = inbuf[i];
617 }
618 break;
619 case none: 518 case none:
620 default: 519 default:
621 /* dummy case just to silence picky compilers */ 520 /* dummy case just to silence picky compilers */
622 break; 521 break;
623 } 522 }
624 523
625 if((method == none) || (method == scramble) || (method == xor)) { 524 if(method == none) {
626 /* calculate checksum */ 525 /* calculate checksum */
627 for (i=0;i<length;i++) 526 for (i=0;i<length;i++)
628 crc += inbuf[i]; 527 crc += inbuf[i];
@@ -650,50 +549,6 @@ int main (int argc, char** argv)
650 telechips_encode_crc(outbuf, length); 549 telechips_encode_crc(outbuf, length);
651 break; 550 break;
652 551
653 case scramble:
654 if (headerlen == 6) {
655 int2be(length, header);
656 header[4] = (crc >> 8) & 0xff;
657 header[5] = crc & 0xff;
658 }
659 else {
660 header[0] =
661 header[1] =
662 header[2] =
663 header[3] = 0xff; /* ??? */
664
665 header[6] = (crc >> 8) & 0xff;
666 header[7] = crc & 0xff;
667
668 header[11] = version;
669
670 header[15] = headerlen; /* really? */
671
672 int2be(length, &header[20]);
673 }
674 break;
675
676 case xor:
677 {
678 int xorlen = strlen(xorstring);
679
680 /* xor data */
681 for (i=0; i<slen; i++)
682 outbuf[i] ^= xorstring[i & (xorlen-1)];
683
684 /* calculate checksum */
685 for (i=0; i<slen; i++)
686 crc += outbuf[i];
687
688 header[0] = header[2] = 'Z';
689 header[1] = header[3] = version;
690 int2le(length, &header[4]);
691 int2le(slen, &header[8]);
692 int2le(crc, &header[12]);
693 length = slen;
694 break;
695 }
696
697#define MY_FIRMWARE_TYPE "Rockbox" 552#define MY_FIRMWARE_TYPE "Rockbox"
698#define MY_HEADER_VERSION 1 553#define MY_HEADER_VERSION 1
699 default: 554 default:
diff --git a/tools/sh2d.c b/tools/sh2d.c
deleted file mode 100644
index 0fcf8b1f6b..0000000000
--- a/tools/sh2d.c
+++ /dev/null
@@ -1,573 +0,0 @@
1/*
2 * sh2d
3 * Bart Trzynadlowski, July 24, 2000
4 * Public domain
5 *
6 * Some changes by Björn Stenberg <bjorn@haxx.se>
7 * $Id$
8 */
9
10
11#include <stdint.h>
12#include <stdio.h>
13#include <stdlib.h>
14#include <string.h>
15
16#define VERSION "0.2"
17
18#define ZERO_F 0 /* 0 format */
19#define N_F 1 /* n format */
20#define M_F 2 /* m format */
21#define NM_F 3 /* nm format */
22#define MD_F 4 /* md format */
23#define ND4_F 5 /* nd4 format */
24#define NMD_F 6 /* nmd format */
25#define D_F 7 /* d format */
26#define D12_F 8 /* d12 format */
27#define ND8_F 9 /* nd8 format */
28#define I_F 10 /* i format */
29#define NI_F 11 /* ni format */
30
31typedef struct
32{
33 int format;
34 const char *mnem;
35 unsigned short mask; /* mask used to obtain opcode bits */
36 unsigned short bits; /* opcode bits */
37 int dat; /* specific data for situation */
38 int sh2; /* SH-2 specific */
39} i_descr;
40
41/* register name lookup added by bjorn@haxx.se 2001-12-09 */
42char* regname[] =
43{
44 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
45 "","","","","","","","","","","","","","","","", /* 0 */
46 "","","","","","","","","","","","","","","","", /* 10 */
47 "","","","","","","","","","","","","","","","", /* 20 */
48 "","","","","","","","","","","","","","","","", /* 30 */
49 "","","","","","","","","","","","","","","","", /* 40 */
50 "","","","","","","","","","","","","","","","", /* 50 */
51 "","","","","","","","","","","","","","","","", /* 60 */
52 "","","","","","","","","","","","","","","","", /* 70 */
53 "","","","","","","","","","","","","","","","", /* 80 */
54 "","","","","","","","","","","","","","","","", /* 90 */
55 "","","","","","","","","","","","","","","","", /* a0 */
56 "","","","","","","","","","","","","","","","", /* b0 */
57
58 "SMR0","BRR0","SCR0","TDR0","SSR0","RDR0","","", /* c0 */
59 "SMR1","BRR1","SCR1","TDR1","SSR1","RDR1","","", /* c8 */
60 "","","","","","","","","","","","","","","","", /* d0 */
61 "ADDRAH","ADDRAL","ADDRBH","ADDRBL", /* e0 */
62 "ADDRCH","ADDRCL","ADDRDH","ADDRDL", /* e4 */
63 "ADCSR","ADCR","","","","","","", /* e8 */
64 "","","","","","","","","","","","","","","","", /* f0 */
65 "TSTR","TSNC","TMDR","TFCR","TCR0","TIOR0","TIER0","TSR0", /* 100 */
66 "TCNT0","!","GRA0","!","GRB0","!","TCR1","TIORL", /* 108 */
67 "TIERI","TSR1","TCNT1","!","GRA1","!","GRB1","!", /* 110 */
68 "TCR2","TIOR2","TIER2","TSR2","TCNT2","!","GRA2","!", /* 118 */
69 "GRB2","!","TCR3","TIOR3","TIER3","TSR3","TCNT3","!", /* 120 */
70 "GRA3","!","GRB3","!","BRA3","!","BRB3","!", /* 128 */
71 "","TOCR","TCR4","TIOR4","TIER4","TSR4","TCNT4","!", /* 130 */
72 "GRA4","!","GRB4","!","BRA4","!","BRB4","!", /* 138 */
73 "SAR0","!","!","!","DAR0","!","!","!", /* 140 */
74 "DMAOR","!","TCR0","!","","","CHCR0","!", /* 148 */
75 "SAR1","!","!","!","DAR1","!","!","!", /* 150 */
76 "","","TCR1","!","","","CHCR1","!", /* 158 */
77 "SAR2","!","!","!","DAR2","!","!","!", /* 160 */
78 "","","TCR2","!","","","CHCR2","!", /* 168 */
79 "SAR3","!","!","!","DAR3","!","!","!", /* 170 */
80 "","","TCR3","!","","","CHCR3","!", /* 178 */
81 "","","","","IPRA","!","IPRB","!", /* 180 */
82 "IPRC","!","IPRD","!","IPRE","!","ICR","!", /* 188 */
83 "BARH","!","BARL","!","BAMRH","!","BAMRL","!", /* 190 */
84 "BBR","!","","","","","","", /* 198 */
85 "BCR","!","WCR1","!","WCR2","!","WCR3","!", /* 1a0 */
86 "DCR","!","PCR","!","RCR","!","RTCSR","!", /* 1a8 */
87 "RTCNT","!","RTCOR","!","","","","", /* 1b0 */
88 "TCSR","TCNT","","RSTCSR","SBYCR","","","", /* 1b8 */
89 "PADR","!","PBDR","!","PAIOR","!","PBIOR","!", /* 1c0 */
90 "PACR1","!","PACR2","!","PBCR1","!","PBCR2","!", /* 1c8 */
91 "PCDR","!","","","","","","","","","","","","","","", /* 1d0 */
92 "","","","","","","","","","","","","","","CASCR","!", /* 1e0 */
93 "TPMR","TPCR","NDERB","NDERA","NDRB","NDRA","NDRB","NDRA", /* 1f0 */
94 "","","","","","","",""
95};
96
97i_descr tab[] =
98{
99 { ZERO_F, "clrt", 0xffff, 0x8, 0, 0 },
100 { ZERO_F, "clrmac", 0xffff, 0x28, 0, 0 },
101 { ZERO_F, "div0u", 0xffff, 0x19, 0, 0 },
102 { ZERO_F, "nop", 0xffff, 0x9, 0, 0 },
103 { ZERO_F, "rte", 0xffff, 0x2b, 0, 0 },
104 { ZERO_F, "rts", 0xffff, 0xb, 0, 0 },
105 { ZERO_F, "sett", 0xffff, 0x18, 0, 0 },
106 { ZERO_F, "sleep", 0xffff, 0x1b, 0, 0 },
107 { N_F, "cmp/pl\tr%d", 0xf0ff, 0x4015, 0, 0 },
108 { N_F, "cmp/pz\tr%d", 0xf0ff, 0x4011, 0, 0 },
109 { N_F, "dt\tr%d", 0xf0ff, 0x4010, 0, 1 },
110 { N_F, "movt\tr%d", 0xf0ff, 0x0029, 0, 0 },
111 { N_F, "rotl\tr%d", 0xf0ff, 0x4004, 0, 0 },
112 { N_F, "rotr\tr%d", 0xf0ff, 0x4005, 0, 0 },
113 { N_F, "rotcl\tr%d", 0xf0ff, 0x4024, 0, 0 },
114 { N_F, "rotcr\tr%d", 0xf0ff, 0x4025, 0, 0 },
115 { N_F, "shal\tr%d", 0xf0ff, 0x4020, 0, 0 },
116 { N_F, "shar\tr%d", 0xf0ff, 0x4021, 0, 0 },
117 { N_F, "shll\tr%d", 0xf0ff, 0x4000, 0, 0 },
118 { N_F, "shlr\tr%d", 0xf0ff, 0x4001, 0, 0 },
119 { N_F, "shll2\tr%d", 0xf0ff, 0x4008, 0, 0 },
120 { N_F, "shlr2\tr%d", 0xf0ff, 0x4009, 0, 0 },
121 { N_F, "shll8\tr%d", 0xf0ff, 0x4018, 0, 0 },
122 { N_F, "shlr8\tr%d", 0xf0ff, 0x4019, 0, 0 },
123 { N_F, "shll16\tr%d", 0xf0ff, 0x4028, 0, 0 },
124 { N_F, "shlr16\tr%d", 0xf0ff, 0x4029, 0, 0 },
125 { N_F, "stc\tsr,r%d", 0xf0ff, 0x0002, 0, 0 },
126 { N_F, "stc\tgbr,r%d", 0xf0ff, 0x0012, 0, 0 },
127 { N_F, "stc\tvbr,r%d", 0xf0ff, 0x0022, 0, 0 },
128 { N_F, "sts\tmach,r%d", 0xf0ff, 0x000a, 0, 0 },
129 { N_F, "sts\tmacl,r%d", 0xf0ff, 0x001a, 0, 0 },
130 { N_F, "sts\tpr,r%d", 0xf0ff, 0x002a, 0, 0 },
131 { N_F, "tas.b\t@r%d", 0xf0ff, 0x401b, 0, 0 },
132 { N_F, "stc.l\tsr,@-r%d", 0xf0ff, 0x4003, 0, 0 },
133 { N_F, "stc.l\tgbr,@-r%d", 0xf0ff, 0x4013, 0, 0 },
134 { N_F, "stc.l\tvbr,@-r%d", 0xf0ff, 0x4023, 0, 0 },
135 { N_F, "sts.l\tmach,@-r%d", 0xf0ff, 0x4002, 0, 0 },
136 { N_F, "sts.l\tmacl,@-r%d", 0xf0ff, 0x4012, 0, 0 },
137 { N_F, "sts.l\tpr,@-r%d", 0xf0ff, 0x4022, 0, 0 },
138 { M_F, "ldc\tr%d,sr", 0xf0ff, 0x400e, 0, 0 },
139 { M_F, "ldc\tr%d,gbr", 0xf0ff, 0x401e, 0, 0 },
140 { M_F, "ldc\tr%d,vbr", 0xf0ff, 0x402e, 0, 0 },
141 { M_F, "lds\tr%d,mach", 0xf0ff, 0x400a, 0, 0 },
142 { M_F, "lds\tr%d,macl", 0xf0ff, 0x401a, 0, 0 },
143 { M_F, "lds\tr%d,pr", 0xf0ff, 0x402a, 0, 0 },
144 { M_F, "jmp\t@r%d", 0xf0ff, 0x402b, 0, 0 },
145 { M_F, "jsr\t@r%d", 0xf0ff, 0x400b, 0, 0 },
146 { M_F, "ldc.l\t@r%d+,sr", 0xf0ff, 0x4007, 0, 0 },
147 { M_F, "ldc.l\t@r%d+,gbr", 0xf0ff, 0x4017, 0, 0 },
148 { M_F, "ldc.l\t@r%d+,vbr", 0xf0ff, 0x4027, 0, 0 },
149 { M_F, "lds.l\t@r%d+,mach", 0xf0ff, 0x4006, 0, 0 },
150 { M_F, "lds.l\t@r%d+,macl", 0xf0ff, 0x4016, 0, 0 },
151 { M_F, "lds.l\t@r%d+,pr", 0xf0ff, 0x4026, 0, 0 },
152 { M_F, "braf\tr%d", 0xf0ff, 0x0023, 0, 1 },
153 { M_F, "bsrf\tr%d", 0xf0ff, 0x0003, 0, 1 },
154 { NM_F, "add\tr%d,r%d", 0xf00f, 0x300c, 0, 0 },
155 { NM_F, "addc\tr%d,r%d", 0xf00f, 0x300e, 0, 0 },
156 { NM_F, "addv\tr%d,r%d", 0xf00f, 0x300f, 0, 0 },
157 { NM_F, "and\tr%d,r%d", 0xf00f, 0x2009, 0, 0 },
158 { NM_F, "cmp/eq\tr%d,r%d", 0xf00f, 0x3000, 0, 0 },
159 { NM_F, "cmp/hs\tr%d,r%d", 0xf00f, 0x3002, 0, 0 },
160 { NM_F, "cmp/ge\tr%d,r%d", 0xf00f, 0x3003, 0, 0 },
161 { NM_F, "cmp/hi\tr%d,r%d", 0xf00f, 0x3006, 0, 0 },
162 { NM_F, "cmp/gt\tr%d,r%d", 0xf00f, 0x3007, 0, 0 },
163 { NM_F, "cmp/str\tr%d,r%d", 0xf00f, 0x200c, 0, 0 },
164 { NM_F, "div1\tr%d,r%d", 0xf00f, 0x3004, 0, 0 },
165 { NM_F, "div0s\tr%d,r%d", 0xf00f, 0x2007, 0, 0 },
166 { NM_F, "dmuls.l\tr%d,r%d", 0xf00f, 0x300d, 0, 1 },
167 { NM_F, "dmulu.l\tr%d,r%d", 0xf00f, 0x3005, 0, 1 },
168 { NM_F, "exts.b\tr%d,r%d", 0xf00f, 0x600e, 0, 0 },
169 { NM_F, "exts.w\tr%d,r%d", 0xf00f, 0x600f, 0, 0 },
170 { NM_F, "extu.b\tr%d,r%d", 0xf00f, 0x600c, 0, 0 },
171 { NM_F, "extu.w\tr%d,r%d", 0xf00f, 0x600d, 0, 0 },
172 { NM_F, "mov\tr%d,r%d", 0xf00f, 0x6003, 0, 0 },
173 { NM_F, "mul.l\tr%d,r%d", 0xf00f, 0x0007, 0, 1 },
174 { NM_F, "muls.w\tr%d,r%d", 0xf00f, 0x200f, 0, 0 },
175 { NM_F, "mulu.w\tr%d,r%d", 0xf00f, 0x200e, 0, 0 },
176 { NM_F, "neg\tr%d,r%d", 0xf00f, 0x600b, 0, 0 },
177 { NM_F, "negc\tr%d,r%d", 0xf00f, 0x600a, 0, 0 },
178 { NM_F, "not\tr%d,r%d", 0xf00f, 0x6007, 0, 0 },
179 { NM_F, "or\tr%d,r%d", 0xf00f, 0x200b, 0, 0 },
180 { NM_F, "sub\tr%d,r%d", 0xf00f, 0x3008, 0, 0 },
181 { NM_F, "subc\tr%d,r%d", 0xf00f, 0x300a, 0, 0 },
182 { NM_F, "subv\tr%d,r%d", 0xf00f, 0x300b, 0, 0 },
183 { NM_F, "swap.b\tr%d,r%d", 0xf00f, 0x6008, 0, 0 },
184 { NM_F, "swap.w\tr%d,r%d", 0xf00f, 0x6009, 0, 0 },
185 { NM_F, "tst\tr%d,r%d", 0xf00f, 0x2008, 0, 0 },
186 { NM_F, "xor\tr%d,r%d", 0xf00f, 0x200a, 0, 0 },
187 { NM_F, "xtrct\tr%d,r%d", 0xf00f, 0x200d, 0, 0 },
188 { NM_F, "mov.b\tr%d,@r%d", 0xf00f, 0x2000, 0, 0 },
189 { NM_F, "mov.w\tr%d,@r%d", 0xf00f, 0x2001, 0, 0 },
190 { NM_F, "mov.l\tr%d,@r%d", 0xf00f, 0x2002, 0, 0 },
191 { NM_F, "mov.b\t@r%d,r%d", 0xf00f, 0x6000, 0, 0 },
192 { NM_F, "mov.w\t@r%d,r%d", 0xf00f, 0x6001, 0, 0 },
193 { NM_F, "mov.l\t@r%d,r%d", 0xf00f, 0x6002, 0, 0 },
194 { NM_F, "mac.l\t@r%d+,@r%d+", 0xf00f, 0x000f, 0, 1 },
195 { NM_F, "mac.w\t@r%d+,@r%d+", 0xf00f, 0x400f, 0, 0 },
196 { NM_F, "mov.b\t@r%d+,r%d", 0xf00f, 0x6004, 0, 0 },
197 { NM_F, "mov.w\t@r%d+,r%d", 0xf00f, 0x6005, 0, 0 },
198 { NM_F, "mov.l\t@r%d+,r%d", 0xf00f, 0x6006, 0, 0 },
199 { NM_F, "mov.b\tr%d,@-r%d", 0xf00f, 0x2004, 0, 0 },
200 { NM_F, "mov.w\tr%d,@-r%d", 0xf00f, 0x2005, 0, 0 },
201 { NM_F, "mov.l\tr%d,@-r%d", 0xf00f, 0x2006, 0, 0 },
202 { NM_F, "mov.b\tr%d,@(r0,r%d)", 0xf00f, 0x0004, 0, 0 },
203 { NM_F, "mov.w\tr%d,@(r0,r%d)", 0xf00f, 0x0005, 0, 0 },
204 { NM_F, "mov.l\tr%d,@(r0,r%d)", 0xf00f, 0x0006, 0, 0 },
205 { NM_F, "mov.b\t@(r0,r%d),r%d", 0xf00f, 0x000c, 0, 0 },
206 { NM_F, "mov.w\t@(r0,r%d),r%d", 0xf00f, 0x000d, 0, 0 },
207 { NM_F, "mov.l\t@(r0,r%d),r%d", 0xf00f, 0x000e, 0, 0 },
208 { MD_F, "mov.b\t@(0x%03X,r%d), r0", 0xff00, 0x8400, 0, 0 },
209 { MD_F, "mov.w\t@(0x%03X,r%d), r0", 0xff00, 0x8500, 0, 0 },
210 { ND4_F, "mov.b\tr0,@(0x%03X,r%d)", 0xff00, 0x8000, 0, 0 },
211 { ND4_F, "mov.w\tr0,@(0x%03X,r%d)", 0xff00, 0x8100, 0, 0 },
212 { NMD_F, "mov.l\tr%d,@(0x%03X,r%d)", 0xf000, 0x1000, 0,0 },
213 { NMD_F, "mov.l\t@(0x%03X,r%d),r%d", 0xf000, 0x5000, 0,0 },
214 { D_F, "mov.b\tr0,@(0x%03X,gbr)", 0xff00, 0xc000, 1, 0 },
215 { D_F, "mov.w\tr0,@(0x%03X,gbr)", 0xff00, 0xc100, 2, 0 },
216 { D_F, "mov.l\tr0,@(0x%03X,gbr)", 0xff00, 0xc200, 4, 0 },
217 { D_F, "mov.b\t@(0x%03X,gbr),r0", 0xff00, 0xc400, 1, 0 },
218 { D_F, "mov.w\t@(0x%03X,gbr),r0", 0xff00, 0xc500, 2, 0 },
219 { D_F, "mov.l\t@(0x%03X,gbr),r0", 0xff00, 0xc600, 4, 0 },
220 { D_F, "mova\t@(0x%03X,pc),r0", 0xff00, 0xc700, 4, 0 },
221 { D_F, "bf\t0x%08X", 0xff00, 0x8b00, 5, 0 },
222 { D_F, "bf/s\t0x%08X", 0xff00, 0x8f00, 5, 1 },
223 { D_F, "bt\t0x%08X", 0xff00, 0x8900, 5, 0 },
224 { D_F, "bt/s\t0x%08X", 0xff00, 0x8d00, 5, 1 },
225 { D12_F, "bra\t0x%08X", 0xf000, 0xa000, 0, 0 },
226 { D12_F, "bsr\t0x%08X", 0xf000, 0xb000, 0, 0 },
227 { ND8_F, "mov.w\t@(0x%03X,pc),r%d", 0xf000, 0x9000, 2, 0 },
228 { ND8_F, "mov.l\t@(0x%03X,pc),r%d", 0xf000, 0xd000, 4, 0 },
229 { I_F, "and.b\t#0x%02X,@(r0,gbr)", 0xff00, 0xcd00, 0,0 },
230 { I_F, "or.b\t#0x%02X,@(r0,gbr)", 0xff00, 0xcf00, 0,0 },
231 { I_F, "tst.b\t#0x%02X,@(r0,gbr)", 0xff00, 0xcc00, 0,0 },
232 { I_F, "xor.b\t#0x%02X,@(r0,gbr)", 0xff00, 0xce00, 0,0 },
233 { I_F, "and\t#0x%02X,r0", 0xff00, 0xc900, 0, 0 },
234 { I_F, "cmp/eq\t#0x%02X,r0", 0xff00, 0x8800, 0, 0 },
235 { I_F, "or\t#0x%02X,r0", 0xff00, 0xcb00, 0, 0 },
236 { I_F, "tst\t#0x%02X,r0", 0xff00, 0xc800, 0, 0 },
237 { I_F, "xor\t#0x%02X,r0", 0xff00, 0xca00, 0, 0 },
238 { I_F, "trapa\t#0x%X", 0xff00, 0xc300, 0, 0 },
239 { NI_F, "add\t#0x%02X,r%d", 0xf000, 0x7000, 0, 0 },
240 { NI_F, "mov\t#0x%02X,r%d", 0xf000, 0xe000, 0, 0 },
241 { 0, NULL, 0, 0, 0, 0 }
242};
243
244
245int FindOption(char *option, int p, int h, int u, int argc, char **argv)
246{
247 static int t[] = { 0, 0, 0, 0, 0, 0, 0, 0,
248 0, 0, 0, 0, 0, 0, 0, 0,
249 0, 0, 0, 0, 0, 0, 0, 0,
250 0, 0, 0, 0, 0, 0, 0, 0,
251 0, 0, 0, 0, 0, 0, 0, 0,
252 0, 0, 0, 0, 0, 0, 0, 0,
253 0, 0, 0, 0, 0, 0, 0, 0,
254 0, 0, 0, 0, 0, 0, 0, 0,
255 0, 0, 0, 0, 0, 0, 0, 0,
256 0, 0, 0, 0, 0, 0, 0, 0,
257 0, 0, 0, 0, 0, 0, 0, 0,
258 0, 0, 0, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 0, 0, 0,
260 0, 0, 0, 0, 0, 0, 0, 0,
261 0, 0, 0, 0, 0, 0, 0, 0,
262 0, 0, 0, 0, 0, 0, 0, 0 };
263 int i;
264 char *c;
265
266 if (argc > 128)
267 argc = 128; /* maximum this function can handle is 128 */
268
269 /*
270 * if p = 1 and h = 0 will find option and return decimal value of
271 * argv[i+1], if h = 1 will read it as hex.
272 * if p = 0 then it will return index of option in argv[], 0 not found
273 * if u = 1 will return index of first occurance of untouched option
274 */
275
276 if (u) /* find first untouched element */
277 {
278 for (i = 1; i < argc; i++)
279 {
280 if (!t[i]) /* 0 indicates untouched */
281 return i;
282 }
283 return 0;
284 }
285
286 if (p) /* find option and return integer value following it */
287 {
288 for (i = 1; i < argc; i++)
289 {
290 if (strcmp(argv[i], option) == 0) /* found */
291 {
292 if (i >= argc) /* bounds! */
293 return 0;
294 t[i + 1] = t[i] = 1; /* touched */
295 if (!h)
296 return atoi(argv[i + 1]);
297 else
298 return strtoul(argv[i + 1], &c, 16);
299 }
300 }
301 return 0; /* no match */
302 }
303 else /* find option and return position */
304 {
305 for (i = 1; i < argc; i++)
306 {
307 if (strcmp(argv[i], option) == 0)
308 {
309 t[i] = 1;
310 return i; /* found! return position */
311 }
312 }
313 return 0;
314 }
315}
316
317/*
318 * SH2Disasm(): SH-1/SH-2 disassembler routine. If mode = 0 then SH-2 mode,
319 * otherwise SH-1 mode
320 */
321
322void SH2Disasm(unsigned v_addr, unsigned char *p_addr, int mode, char *m_addr)
323 {
324 int i;
325 unsigned short op;
326
327 op = (unsigned short) (*p_addr << 8) | *(p_addr + 1);
328 printf("0x%08X: 0x%04X\t", v_addr, op);
329
330 if (m_addr[0]==ND8_F)
331 {
332 if (m_addr[2]==-1)
333 {
334 unsigned int tmp = (op << 16) | ((unsigned int) (p_addr [2] << 8) | p_addr[3]);
335 printf(".long\t0x%08X\t; 0x%08X",tmp,v_addr - (unsigned)m_addr[1]);
336 }
337 else
338 printf(".short\t0x%08X\t; 0x%08X",op,v_addr - (unsigned)m_addr[1]);
339 }
340 else if (m_addr[0] != -1)
341 {
342 for (i = 0; tab[i].mnem != NULL; i++) /* 0 format */
343 {
344 if ((op & tab[i].mask) == tab[i].bits)
345 {
346 if (tab[i].sh2 && mode) /* if SH-1 mode, no SH-2 */
347 printf("???");
348 else if (tab[i].format == ZERO_F)
349 printf("%s", tab[i].mnem);
350 else if (tab[i].format == N_F)
351 printf(tab[i].mnem, (op >> 8) & 0xf);
352 else if (tab[i].format == M_F)
353 printf(tab[i].mnem, (op >> 8) & 0xf);
354 else if (tab[i].format == NM_F)
355 printf(tab[i].mnem, (op >> 4) & 0xf,
356 (op >> 8) & 0xf);
357 else if (tab[i].format == MD_F)
358 {
359 if (op & 0x100)
360 printf(tab[i].mnem, (op & 0xf) * 2,
361 (op >> 4) & 0xf);
362 else
363 printf(tab[i].mnem, op & 0xf,
364 (op >> 4) & 0xf);
365 }
366 else if (tab[i].format == ND4_F)
367 {
368 if (op & 0x100)
369 printf(tab[i].mnem, (op & 0xf) * 2,
370 (op >> 4) & 0xf);
371 else
372 printf(tab[i].mnem, (op & 0xf),
373 (op >> 4) & 0xf);
374 }
375 else if (tab[i].format == NMD_F)
376 {
377 if ((op & 0xf000) == 0x1000)
378 printf(tab[i].mnem, (op >> 4) & 0xf,
379 (op & 0xf) * 4,
380 (op >> 8) & 0xf);
381 else
382 printf(tab[i].mnem, (op & 0xf) * 4,
383 (op >> 4) & 0xf,
384 (op >> 8) & 0xf);
385 }
386 else if (tab[i].format == D_F)
387 {
388 if (tab[i].dat <= 4)
389 {
390 if ((op & 0xff00) == 0xc700)
391 {
392 printf(tab[i].mnem,
393 (op & 0xff) *
394 tab[i].dat + 4);
395 printf("\t; 0x%08X",
396 (op & 0xff) *
397 tab[i].dat + 4 +
398 v_addr);
399 }
400 else
401 printf(tab[i].mnem,
402 (op & 0xff) *
403 tab[i].dat);
404 }
405 else
406 {
407 if (op & 0x80) /* sign extend */
408 printf(tab[i].mnem,
409 (((op & 0xff) +
410 0xffffff00) * 2) +
411
412 v_addr + 4);
413 else
414 printf(tab[i].mnem,
415 ((op & 0xff) * 2) +
416 v_addr + 4);
417 }
418 }
419 else if (tab[i].format == D12_F)
420 {
421 if (op & 0x800) /* sign extend */
422 printf(tab[i].mnem,
423 ((op & 0xfff) + 0xfffff000) * 2
424 + v_addr + 4);
425 else
426 printf(tab[i].mnem, (op & 0xfff) * 2 +
427 v_addr + 4);
428 }
429 else if (tab[i].format == ND8_F)
430 {
431 int imm = (op & 0xff) * tab[i].dat + 4;
432 if ((op & 0xf000) == 0x9000) /* .W */
433 {
434 int dat = (unsigned short) (*(imm + p_addr) << 8) | *(imm + p_addr + 1);
435 m_addr[imm+0] = ND8_F; /* this couldn't be an instruction so mark it ! */
436 m_addr[imm+1] = imm;
437 printf(tab[i].mnem,
438 imm,
439 (op >> 8) & 0xf);
440 printf("\t; 0x%08X (0x%04X)",
441 imm + v_addr, dat);
442 }
443 else /* .L */
444 {
445 unsigned char *b_addr = (unsigned char *)((intptr_t)p_addr & ~3);
446 int dat = (unsigned int) (*(imm + b_addr) << 24) | (*(imm + b_addr + 1) << 16)
447 | (*(imm + b_addr + 2) << 8) | *(imm + b_addr + 3) ;
448 /* SH-1 register name lookup */
449 char* str = "";
450 if ( (dat & 0xfffffe00) == 0x05fffe00 )
451 str = regname[dat & 0x1ff];
452 m_addr[imm+(b_addr-p_addr)+0] = ND8_F; /* this couldn't be an instruction so mark it ! */
453 m_addr[imm+(b_addr-p_addr)+1] = imm;
454 m_addr[imm+(b_addr-p_addr)+2] = -1;
455 printf(tab[i].mnem,
456 imm,
457 (op >> 8) & 0xf);
458 printf("\t; 0x%08X (0x%08X) %s",
459 imm + (v_addr & 0xfffffffc), dat, str);
460 }
461 }
462 else if (tab[i].format == I_F)
463 printf(tab[i].mnem, op & 0xff);
464 else if (tab[i].format == NI_F)
465 printf(tab[i].mnem, op & 0xff, (op >> 8) &
466 0xf);
467 else
468 printf("???");
469 printf("\n");
470 return;
471 }
472 }
473
474 printf("???");
475
476 }
477 printf("\n");
478 }
479
480void ShowHelp()
481{
482 printf("sh2d Version %s by Bart Trzynadlowski: A Free SH-1/SH-2 "
483 "Disassembler\n", VERSION);
484 printf("Usage: sh2d <file> [options]\n");
485 printf("Options: -?,-h Show this help text\n");
486 printf(" -s # Start offset (hexadecimal)\n");
487 printf(" -l # Number of bytes (decimal)\n");
488 printf(" -o # Set origin (hexadecimal)\n");
489 printf(" -sh1 SH-1 disassembly only\n");
490 printf(" -sh2 SH-2 disassembly (default)\n");
491 exit(0);
492}
493
494int main(int argc, char **argv)
495{
496 FILE *fp;
497 long fsize, file, mode;
498 unsigned start, len, calc_len = 0, org, do_org, i, j = 0;
499 char *buffer;
500 char *mark;
501
502 if (argc == 1) /* show help */
503 ShowHelp();
504 if (FindOption("-?", 0, 0, 0, argc, argv) ||
505 FindOption("-h", 0, 0, 0, argc, argv))
506 ShowHelp();
507
508 if (FindOption("-sh1", 0, 0, 0, argc, argv))
509 mode = 1; /* SH-1 mode */
510 else
511 mode = 0; /* SH-2 mode */
512 if (FindOption("-sh2", 0, 0, 0, argc, argv))
513 mode = 0; /* SH-2 mode */
514
515 start = FindOption("-s", 1, 1, 0, argc, argv);
516 org = FindOption("-o", 1, 1, 0, argc, argv);
517 if (!(len = FindOption("-l", 1, 0, 0, argc, argv)))
518 {
519 if (FindOption("-l", 0, 0, 0, argc, argv))
520 return 0; /* -l was actually specified w/ 0 */
521 calc_len = 1; /* no -l, calculate length */
522 }
523
524 if (FindOption("-o", 0, 0, 0, argc, argv))
525 do_org = 1; /* -o was actually 0 */
526 else
527 do_org = 0; /* there was no -o, ignore the org variable */
528
529 if (!(file = FindOption(NULL, 0, 0, 1, argc, argv)))
530 {
531 fprintf(stderr, "sh2d: No input file specified. Try "
532 "\"sh2d -h\" for usage instructions\n");
533 exit(1);
534 }
535
536 if ((fp = fopen(argv[file], "rb")) == NULL)
537 {
538 fprintf(stderr, "sh2d: Failed to open file: %s\n",
539 argv[file]);
540 exit(1);
541 }
542 fseek(fp, 0, SEEK_END);
543 fsize = ftell(fp);
544 rewind(fp);
545 if ((buffer = (char *) calloc(fsize * 2, sizeof(unsigned short)))
546 == NULL)
547 {
548 fprintf(stderr, "sh2d: Not enough memory to load input "
549 "file: %s, %lu bytes\n", argv[file], fsize);
550 exit(1);
551 }
552 fread(buffer, sizeof(unsigned char), fsize, fp);
553 fclose(fp);
554
555 if (calc_len)
556 len = fsize - start;
557
558 mark = buffer + fsize;
559
560 for (i = start; i < (unsigned) fsize && j < len; i += 2)
561 {
562 if (do_org)
563 {
564 SH2Disasm(org, (unsigned char*)&buffer[i], mode, &mark[i]);
565 org += 2;
566 }
567 else
568 SH2Disasm(i, (unsigned char *)&buffer[i], mode, &mark[i]);
569 j += 2;
570 }
571
572 return 0;
573}
diff --git a/tools/toolchain-patches/gcc-4.0.3-rockbox-1.diff b/tools/toolchain-patches/gcc-4.0.3-rockbox-1.diff
deleted file mode 100644
index abd0f44be3..0000000000
--- a/tools/toolchain-patches/gcc-4.0.3-rockbox-1.diff
+++ /dev/null
@@ -1,75 +0,0 @@
1diff -ru gcc-4.0.3-orig/gcc/config/sh/sh.h gcc-4.0.3/gcc/config/sh/sh.h
2--- gcc-4.0.3-orig/gcc/config/sh/sh.h 2006-03-06 23:40:49.000000000 +0100
3+++ gcc-4.0.3/gcc/config/sh/sh.h 2006-04-28 03:03:18.000000000 +0200
4@@ -2809,12 +2809,15 @@
5 #define CASE_VECTOR_MODE ((! optimize || TARGET_BIGTABLE) ? SImode : HImode)
6
7 #define CASE_VECTOR_SHORTEN_MODE(MIN_OFFSET, MAX_OFFSET, BODY) \
8-((MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 127 \
9+((MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 126 \
10 ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 0, QImode) \
11- : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 255 \
12+ : (MIN_OFFSET) >= 0 && (MAX_OFFSET) <= 254 \
13 ? (ADDR_DIFF_VEC_FLAGS (BODY).offset_unsigned = 1, QImode) \
14 : (MIN_OFFSET) >= -32768 && (MAX_OFFSET) <= 32767 ? HImode \
15 : SImode)
16+/* Note: The maximum range for byte-sized offsets was reduced by 1 to work
17+ around a bug in final.c I don't know how to fix properly (jump table
18+ length calculation should take alignment into account). -- Jens Arnold */
19
20 /* Define as C expression which evaluates to nonzero if the tablejump
21 instruction expects the table to contain offsets from the address of the
22diff -ru gcc-4.0.3-orig/gcc/version.c gcc-4.0.3/gcc/version.c
23--- gcc-4.0.3-orig/gcc/version.c 2006-03-09 21:46:18.000000000 +0100
24+++ gcc-4.0.3/gcc/version.c 2006-04-29 23:52:22.000000000 +0200
25@@ -5,7 +5,7 @@
26 please modify this string to indicate that, e.g. by putting your
27 organization's name in parentheses at the end of the string. */
28
29-const char version_string[] = "4.0.3";
30+const char version_string[] = "4.0.3 (rockbox patch #1)";
31
32 /* This is the location of the online document giving instructions for
33 reporting bugs. If you distribute a modified version of GCC,
34diff -ru gcc-4.0.3-orig/gcc/config.gcc gcc-4.0.3/gcc/config.gcc
35--- gcc-4.0.3-orig/gcc/config.gcc So Mrz 7 23:08:24 2010
36+++ gcc-4.0.3/gcc/config.gcc Mo Mrz 8 01:36:54 2010
37@@ -1867,7 +1867,7 @@
38 sh2*) sh_cpu_target=sh2 ;;
39 *) sh_cpu_target=sh1 ;;
40 esac
41- sh_cpu_default="`echo $with_cpu|sed s/^m/sh/|tr A-Z_ a-z-`"
42+ sh_cpu_default="`echo $with_cpu|sed s/^m/sh/|tr [A-Z]_ [a-z]-`"
43 case $sh_cpu_default in
44 sh5-64media-nofpu | sh5-64media | \
45 sh5-32media-nofpu | sh5-32media | sh5-compact-nofpu | sh5-compact | \
46@@ -1889,9 +1889,9 @@
47 *) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
48 esac
49 fi
50- target_cpu_default=SELECT_`echo ${sh_cpu_default}|tr a-z- A-Z_`
51+ target_cpu_default=SELECT_`echo ${sh_cpu_default}|tr [a-z]- [A-Z]_`
52 tm_defines=${tm_defines}' SH_MULTILIB_CPU_DEFAULT=\"'`echo $sh_cpu_default|sed s/sh/m/`'\"'
53- 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-`
54+ 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]-`
55 for sh_multilib in ${sh_multilibs}; do
56 case ${sh_multilib} in
57 sh1 | sh2 | sh2e | sh3 | sh3e | \
58@@ -1902,7 +1902,7 @@
59 sh5-32media | sh5-32media-nofpu | \
60 sh5-compact | sh5-compact-nofpu)
61 tmake_file="${tmake_file} sh/t-mlib-${sh_multilib}"
62- tm_defines="$tm_defines SUPPORT_`echo $sh_multilib|tr a-z- A-Z_`"
63+ tm_defines="$tm_defines SUPPORT_`echo $sh_multilib|tr [a-z]- [A-Z]_`"
64 ;;
65 *)
66 echo "with_multilib_list=${sh_multilib} not supported."
67@@ -2631,7 +2631,7 @@
68
69 sh[123456ble]-*-* | sh-*-*)
70 supported_defaults="cpu"
71- case "`echo $with_cpu | tr A-Z_ a-z- | sed s/sh/m/`" in
72+ case "`echo $with_cpu | tr [A-Z]_ [a-z]- | sed s/sh/m/`" in
73 "" | m1 | m2 | m2e | m3 | m3e | m4 | m4-single | m4-single-only | m4-nofpu )
74 # OK
75 ;;
diff --git a/tools/tools.make b/tools/tools.make
index 9f16d4c884..3350ad03bc 100644
--- a/tools/tools.make
+++ b/tools/tools.make
@@ -40,10 +40,6 @@ $(TOOLSDIR)/convttf: $(TOOLSDIR)/convttf.c
40 $(SILENT)$(HOSTCC) $(TOOLSFLAGS) -lm -O2 -Wall -g $+ -o $@ \ 40 $(SILENT)$(HOSTCC) $(TOOLSFLAGS) -lm -O2 -Wall -g $+ -o $@ \
41 `freetype-config --libs` `freetype-config --cflags` 41 `freetype-config --libs` `freetype-config --cflags`
42 42
43$(TOOLSDIR)/player_unifont: $(TOOLSDIR)/player_unifont.c $(ROOTDIR)/firmware/drivers/lcd-charset-player.c
44 $(call PRINTS,CC $(@F))
45 $(SILENT)$(HOSTCC) $(TOOLSFLAGS) -DARCHOS_PLAYER -D__PCTOOL__ -I$(ROOTDIR)/firmware/export -I. $+ -o $@
46
47# implicit rule for simple tools 43# implicit rule for simple tools
48$(TOOLSDIR)/%: $(TOOLSDIR)/%.c 44$(TOOLSDIR)/%: $(TOOLSDIR)/%.c
49 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$@)) 45 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$@))
diff --git a/tools/voicefont.c b/tools/voicefont.c
index 30a82ae5eb..9a8a7fbc02 100644
--- a/tools/voicefont.c
+++ b/tools/voicefont.c
@@ -41,35 +41,6 @@
41 (((unsigned)(x)<<24) & 0xff000000)) 41 (((unsigned)(x)<<24) & 0xff000000))
42#endif 42#endif
43 43
44/* bitswap audio bytes, LSB becomes MSB and vice versa */
45int BitswapAudio (unsigned char* pDest, unsigned char* pSrc, size_t len)
46{
47 static const unsigned char Lookup[256] =
48 {
49 0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
50 0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8,
51 0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4,
52 0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC,
53 0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2,
54 0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA,
55 0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6,
56 0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE,
57 0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1,
58 0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9,
59 0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5,
60 0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD,
61 0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3,
62 0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB,
63 0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7,
64 0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF,
65 };
66
67 while (len--)
68 *pDest++ = Lookup[*pSrc++];
69
70 return 0;
71}
72
73int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsigned int version) 44int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsigned int version)
74{ 45{
75 46
@@ -91,14 +62,6 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi
91 char mp3filename2[1024]; 62 char mp3filename2[1024];
92 char* mp3filename; 63 char* mp3filename;
93 FILE* pMp3File; 64 FILE* pMp3File;
94 int do_bitswap_audio = 0;
95
96
97 /* We bitswap the voice file only SH based archos players, target IDs
98 equal to or lower than 8. See the "Target id:" line in rockbox-info.txt
99 or the target_id value in configure. */
100 if (targetnum <= 8)
101 do_bitswap_audio = 1;
102 65
103 memset(voiceonly, 0, sizeof(voiceonly)); 66 memset(voiceonly, 0, sizeof(voiceonly));
104 while (!feof(voicefontids)) 67 while (!feof(voicefontids))
@@ -147,8 +110,6 @@ int voicefont(FILE* voicefontids,int targetnum,char* filedir, FILE* output, unsi
147 110
148 size[i] = fread(buffer, 1, sizeof(buffer), pMp3File); 111 size[i] = fread(buffer, 1, sizeof(buffer), pMp3File);
149 fclose(pMp3File); 112 fclose(pMp3File);
150 if (do_bitswap_audio)
151 BitswapAudio(buffer, buffer, size[i]);
152 fwrite(buffer, 1, size[i], output); 113 fwrite(buffer, 1, size[i], output);
153 114
154 printf(": %d %s %d\n", i, names[i], size[i]); /* debug */ 115 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
203 } /* for i */ 164 } /* for i */
204 } /* for j */ 165 } /* for j */
205 166
206
207 /*
208 * after this the actual bitswapped mp3 data follows,
209 * which we already have written, see above.
210 */
211
212 fclose(output); 167 fclose(output);
213 168
214 return 0; 169 return 0;