summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-02-18 19:08:29 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-02-18 19:08:29 +0000
commit65068e28f3aedf841045a0f6167d68fb898c1595 (patch)
treea64b88dcd7b545764199c2bba1362fc13621b99e /tools
parent332a14036b08eaa4f5b4c260e54b26922a503611 (diff)
downloadrockbox-65068e28f3aedf841045a0f6167d68fb898c1595.tar.gz
rockbox-65068e28f3aedf841045a0f6167d68fb898c1595.tar.bz2
rockbox-65068e28f3aedf841045a0f6167d68fb898c1595.zip
A first tiny set of changes for the Creative Zen Vision:M. Work done by
Maurus Cuelenaere git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16347 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/configure34
-rw-r--r--tools/scramble.c100
2 files changed, 133 insertions, 1 deletions
diff --git a/tools/configure b/tools/configure
index e1ca5be190..83ce296546 100755
--- a/tools/configure
+++ b/tools/configure
@@ -219,6 +219,13 @@ arm946cc () {
endian="little"
}
+arm9cc () {
+ prefixtools arm-elf-
+ GCCOPTS="$CCOPTS -mcpu=arm9 -mlong-calls"
+ GCCOPTIMIZE="-fomit-frame-pointer"
+ endian="little"
+}
+
arm926ejscc () {
prefixtools arm-elf-
GCCOPTS="$CCOPTS -mcpu=arm926ej-s -mlong-calls"
@@ -611,7 +618,9 @@ cat <<EOF
==Tatung== ==Olympus== ==Logik==
60) Elio TPJ-1022 70) M:Robe 500 80) DAX 1GB MP3/DAB
- 71) M:Robe 100
+ 71) M:Robe 10
+ ==Creative==
+ 90) Zen Vision:M
EOF
buildfor=`input`;
@@ -1313,6 +1322,29 @@ EOF
t_manufacturer="tcc77x"
t_model="logikdax"
;;
+
+ 90|creativezvm)
+ target_id=35
+ modelname="creativezvm"
+ target="-DCREATIVE_ZVM"
+ memory=32 # always
+ arm9cc
+ bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
+ bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
+ bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
+ bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
+ output="rockbox.zvm"
+ appextra="recorder:gui"
+ plugins="yes"
+ swcodec="yes"
+ toolset=$gigabeatbitmaptools
+ boottool="$rootdir/tools/scramble -zvm"
+ bootoutput="rockbox.zvmboot"
+ # architecture, manufacturer and model for the target-tree build
+ t_cpu="arm"
+ t_manufacturer="tms320dm320"
+ t_model="creative-zvm"
+ ;;
50|e200)
target_id=23
diff --git a/tools/scramble.c b/tools/scramble.c
index 3e5a0771bc..6d69f9175e 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -94,6 +94,7 @@ void usage(void)
"\t-ipod3g ipod firmware partition format (3rd Gen)\n"
"\t-ipod4g ipod firmware partition format (4th Gen, Mini, Nano, Photo/Color)\n"
"\t-ipod5g ipod firmware partition format (5th Gen - aka Video)\n"
+ "\t-zvm Zen Vision:M FRESCUE structure format\n"
"\t-gigabeat Toshiba Gigabeat F/X format\n"
"\t-gigabeats Toshiba Gigabeat S format\n"
"\t-mi4v2 PortalPlayer .mi4 format (revision 010201)\n"
@@ -314,6 +315,11 @@ int main (int argc, char** argv)
oname = argv[3];
return ipod_encode(iname, oname, 3, true); /* Firmware image v3 */
}
+ else if(!strcmp(argv[1], "-zvm")) {
+ iname = argv[2];
+ oname = argv[3];
+ return zvm_encode(iname, oname);
+ }
else if(!strncmp(argv[1], "-mi4", 4)) {
int mi4magic;
int version;
@@ -723,3 +729,97 @@ int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc)
return 0;
}
+
+
+/* Create an Zen Vision:M FRESCUE structure file
+*/
+
+int zvm_encode(char *iname, char *oname)
+{
+ size_t len;
+ int length;
+ FILE *file;
+ unsigned int sum = 0;
+ unsigned char *outbuf;
+ int i;
+
+ file = fopen(iname, "rb");
+ if (!file) {
+ perror(iname);
+ return -1;
+ }
+ fseek(file,0,SEEK_END);
+ length = ftell(file);
+
+ fseek(file,0,SEEK_SET);
+
+ outbuf = malloc(length+0x18+0x10);
+
+ if ( !outbuf ) {
+ printf("out of memory!\n");
+ return -1;
+ }
+
+ len = fread(outbuf+0x18, 1, length, file);
+ if(len < length) {
+ perror(iname);
+ return -2;
+ }
+ fclose(file);
+
+ /* Calculate checksum for later use in header */
+ for(i=0; i<length; i+= 4)
+ sum += le2int(&outbuf[0x18+i]) + (le2int(&outbuf[0x18+i])>>16);
+
+ /* Clear the header area to zero */
+ memset(outbuf, 0, 0x18);
+
+ /* Header (EDOC) */
+ memcpy((char*)outbuf, "EDOC", 4);
+ /* Total Size */
+ int2le(length+0x20, &outbuf[0x4]);
+ /* 4 bytes of zero */
+
+ /* Address = 0x900000 */
+ int2le(0x900000, &outbuf[0xC]);
+ /* Size */
+ int2le(length, &outbuf[0x10]);
+ /* Checksum */
+ int2le(sum, &outbuf[0x14]);
+ outbuf[0x16] = 0;
+ outbuf[0x17] = 0;
+ /* Data starts here... */
+
+ /* Second block starts here ... */
+ /* Address = 0x0 */
+ /* Size */
+ int2le(0x4, &outbuf[0x18+length+0x4]);
+ /* Checksum */
+ outbuf[0x18+length+0x8] = 0xB7;
+ outbuf[0x18+length+0x9] = 0xD5;
+ /* Data: LDR PC, =0x900000 */
+ outbuf[0x18+length+0xC] = 0x18;
+ outbuf[0x18+length+0xD] = 0xF0;
+ outbuf[0x18+length+0xE] = 0x9F;
+ outbuf[0x18+length+0xF] = 0xE5;
+
+
+ file = fopen(oname, "wb");
+ if (!file) {
+ perror(oname);
+ return -3;
+ }
+
+ len = fwrite(outbuf, 1, length+0x28, file);
+ if(len < length+0x18) {
+ perror(oname);
+ return -4;
+ }
+
+ free(outbuf);
+
+ fclose(file);
+
+ return 0;
+}
+