summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2008-12-24 04:23:52 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2008-12-24 04:23:52 +0000
commit68e24d3a16f3472121a38d75aeafcc9d9c94a136 (patch)
tree14287aa0d4fc012d0eb40280998d51a76e4dbc93 /rbutil
parentc97f640060cd13ba4fed041f1f1feecd84aa2ae0 (diff)
downloadrockbox-68e24d3a16f3472121a38d75aeafcc9d9c94a136.tar.gz
rockbox-68e24d3a16f3472121a38d75aeafcc9d9c94a136.tar.bz2
rockbox-68e24d3a16f3472121a38d75aeafcc9d9c94a136.zip
Commit updated mkamsboot for c200v2 patching. Tested and seems to be working using USB for dualboot.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19575 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/mkamsboot/Makefile13
-rw-r--r--rbutil/mkamsboot/dualboot.S16
-rw-r--r--rbutil/mkamsboot/mkamsboot.c43
3 files changed, 47 insertions, 25 deletions
diff --git a/rbutil/mkamsboot/Makefile b/rbutil/mkamsboot/Makefile
index fe58d82b9a..5a62650904 100644
--- a/rbutil/mkamsboot/Makefile
+++ b/rbutil/mkamsboot/Makefile
@@ -8,8 +8,8 @@ LIBUCL=../../tools/ucl/src/libucl.a
# adding a new target. mkamsboot.c also needs to be edited to refer to these
# new images.
-BOOTIMAGES = dualboot_clip.o dualboot_e200v2.o dualboot_m200v4.o dualboot_fuze.o
-BOOTHEADERS = dualboot_clip.h dualboot_e200v2.h dualboot_m200v4.h dualboot_fuze.h
+BOOTIMAGES = dualboot_clip.o dualboot_e200v2.o dualboot_c200v2.o dualboot_m200v4.o dualboot_fuze.o
+BOOTHEADERS = dualboot_clip.h dualboot_e200v2.h dualboot_c200v2.h dualboot_m200v4.h dualboot_fuze.h
CLIPFILES = dualboot_clip.arm-o dualboot_clip.o dualboot_clip.c dualboot_clip.h
@@ -19,6 +19,9 @@ E200V2FILES = dualboot_e200v2.arm-o dualboot_e200v2.o dualboot_e200v2.c \
M200V4FILES = dualboot_m200v4.arm-o dualboot_m200v4.o dualboot_m200v4.arm-bin \
dualboot_m200v4.c dualboot_m200v4.h
+C200V2FILES = dualboot_c200v2.arm-o dualboot_c200v2.o dualboot_c200v2.c \
+ dualboot_c200v2.h
+
FUZEFILES = dualboot_fuze.arm-o dualboot_fuze.o dualboot_fuze.c dualboot_fuze.h
all: mkamsboot
@@ -37,6 +40,9 @@ dualboot_e200v2.arm-o: dualboot.S
dualboot_m200v4.arm-o: dualboot.S
arm-elf-gcc -DSANSA_M200V4 -c -o dualboot_m200v4.arm-o dualboot.S
+dualboot_c200v2.arm-o: dualboot.S
+ arm-elf-gcc -DSANSA_C200V2 -c -o dualboot_c200v2.arm-o dualboot.S
+
# Rules for the ucl unpack function
nrv2e_d8.arm-o: nrv2e_d8.S
arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.arm-o nrv2e_d8.S
@@ -80,4 +86,5 @@ bin2c: bin2c.c
clean:
rm -f mkamsboot mkamsboot.o nrv2e_d8.arm-o nrv2e_d8.arm-elf \
nrv2e_d8.arm-bin *~ bin2c nrv2e_d8.c nrv2e_d8.h nrv2e_d8.o md5.o \
- $(BOOTIMAGES) $(CLIPFILES) $(E200V2FILES) $(M200V4FILES) $(FUZEFILES)
+ $(BOOTIMAGES) $(CLIPFILES) $(E200V2FILES) $(M200V4FILES) $(FUZEFILES) \
+ $(C200V2FILES)
diff --git a/rbutil/mkamsboot/dualboot.S b/rbutil/mkamsboot/dualboot.S
index 4d19b020a3..6cdc88de18 100644
--- a/rbutil/mkamsboot/dualboot.S
+++ b/rbutil/mkamsboot/dualboot.S
@@ -81,12 +81,16 @@ uclcopy:
#ifndef SANSA_M200V4 /* this doesnt work for m200 */
/* we check A3 unconditionally of the model because it seems to be */
/* either hold, either usb on every model */
+ /* TODO: make it USB on all AMS Sansas for consistency, USB is safer too */
ldr r0, =GPIOA
mov r1, #0
str r1, [r0, #0x400]
+#ifdef SANSA_C200V2
+ ldr r1, [r0, #0x8] /* USB is A1 on C200 */
+#else
ldr r1, [r0, #0x20] /* read pin A3 */
-
+#endif
cmp r1, #0
bne boot_of
#endif
@@ -118,6 +122,16 @@ uclcopy:
cmp r1, #0 /* C3 = #0 means button pressed */
beq boot_of
+#elif defined(SANSA_C200V2)
+ /* check for RIGHT on C6, should maybe changed to LEFT as soon as it
+ * known in which pin that is in order for consistency */
+ ldr r0, =GPIOC
+ mov r1, #0
+ str r1, [r0, #0x400] /* set pin to output */
+
+ ldr r1, [r0, #256] /* 1<<(6+2) */
+ cmp r1, #0 /* C6 low means button pressed */
+ beq boot_of
#elif defined(SANSA_M200V4)
/* LEFT button */
.set row, (1<<5) /* enable output on A5 */
diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c
index 12c4f10335..a7f6ad65b1 100644
--- a/rbutil/mkamsboot/mkamsboot.c
+++ b/rbutil/mkamsboot/mkamsboot.c
@@ -93,6 +93,7 @@ execution to the uncompressed firmware.
#include "dualboot_e200v2.h"
#include "dualboot_fuze.h"
#include "dualboot_m200v4.h"
+#include "dualboot_c200v2.h"
/* Win32 compatibility */
#ifndef O_BINARY
@@ -109,9 +110,9 @@ enum
MODEL_FUZE = 0,
MODEL_CLIP,
MODEL_CLIPV2,
- MODEL_E200,
- MODEL_M200,
- MODEL_C200
+ MODEL_E200V2,
+ MODEL_M200V4,
+ MODEL_C200V2,
};
static const char* model_names[] =
@@ -119,9 +120,9 @@ static const char* model_names[] =
"Fuze",
"Clip",
"Clip V2",
- "E200",
- "M200",
- "C200"
+ "e200 v2",
+ "m200 v4",
+ "c200 v2"
};
static const unsigned char* bootloaders[] =
@@ -131,7 +132,7 @@ static const unsigned char* bootloaders[] =
NULL,
dualboot_e200v2,
dualboot_m200v4,
- NULL
+ dualboot_c200v2,
};
static const int bootloader_sizes[] =
@@ -141,7 +142,7 @@ static const int bootloader_sizes[] =
0,
sizeof(dualboot_e200v2),
sizeof(dualboot_m200v4),
- 0
+ sizeof(dualboot_c200v2),
};
/* Model names used in the Rockbox header in ".sansa" files - these match the
@@ -152,8 +153,8 @@ static const char* rb_model_names[] =
"clip",
NULL,
"e2v2",
- "m2v2",
- NULL
+ "m2v4",
+ "c2v2",
};
/* Model numbers used to initialise the checksum in the Rockbox header in
@@ -165,7 +166,7 @@ static const int rb_model_num[] =
0,
41,
42,
- 0
+ 44
};
struct md5sums {
@@ -180,19 +181,19 @@ struct md5sums {
static struct md5sums sansasums[] = {
/* NOTE: Different regional versions of the firmware normally only
differ in the filename - the md5sums are identical */
- { MODEL_E200, "3.01.11", 1, "e622ca8cb6df423f54b8b39628a1f0a3" },
- { MODEL_E200, "3.01.14", 1, "2c1d0383fc3584b2cc83ba8cc2243af6" },
- { MODEL_E200, "3.01.16", 1, "12563ad71b25a1034cf2092d1e0218c4" },
+ { MODEL_E200V2, "3.01.11", 1, "e622ca8cb6df423f54b8b39628a1f0a3" },
+ { MODEL_E200V2, "3.01.14", 1, "2c1d0383fc3584b2cc83ba8cc2243af6" },
+ { MODEL_E200V2, "3.01.16", 1, "12563ad71b25a1034cf2092d1e0218c4" },
{ MODEL_FUZE, "1.01.11", 1, "cac8ffa03c599330ac02c4d41de66166" },
{ MODEL_FUZE, "1.01.15", 1, "df0e2c1612727f722c19a3c764cff7f2" },
{ MODEL_FUZE, "1.01.22", 1, "5aff5486fe8dd64239cc71eac470af98" },
- { MODEL_C200, "3.02.05", 1, "b6378ebd720b0ade3fad4dc7ab61c1a5" },
+ { MODEL_C200V2, "3.02.05", 1, "b6378ebd720b0ade3fad4dc7ab61c1a5" },
- { MODEL_M200, "4.00.45", 1, "82e3194310d1514e3bbcd06e84c4add3" },
- { MODEL_M200, "4.01.08-A", 1, "fc9dd6116001b3e6a150b898f1b091f0" },
- { MODEL_M200, "4.01.08-E", 1, "d3fb7d8ec8624ee65bc99f8dab0e2369" },
+ { MODEL_M200V4, "4.00.45", 1, "82e3194310d1514e3bbcd06e84c4add3" },
+ { MODEL_M200V4, "4.01.08-A", 1, "fc9dd6116001b3e6a150b898f1b091f0" },
+ { MODEL_M200V4, "4.01.08-E", 1, "d3fb7d8ec8624ee65bc99f8dab0e2369" },
{ MODEL_CLIP, "1.01.17", 1, "12caad785d506219d73f538772afd99e" },
{ MODEL_CLIP, "1.01.18", 1, "d720b266bd5afa38a198986ef0508a45" },
@@ -267,11 +268,11 @@ static int get_model(int model_id)
case 0x22:
return MODEL_CLIP;
case 0x23:
- return MODEL_C200;
+ return MODEL_C200V2;
case 0x24:
- return MODEL_E200;
+ return MODEL_E200V2;
case 0x25:
- return MODEL_M200;
+ return MODEL_M200V4;
case 0x27:
return MODEL_CLIPV2;
}