summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-02-26 13:55:17 +0000
committerThomas Martitz <kugel@rockbox.org>2010-02-26 13:55:17 +0000
commitf6540e800db616a783a13bc47b7f5710c004bf71 (patch)
tree95ea7ee56408cb778258d5816c1a69161047eef1
parent92f0aa85fcdffc83a0e06f50c0580d5932075c43 (diff)
downloadrockbox-f6540e800db616a783a13bc47b7f5710c004bf71.tar.gz
rockbox-f6540e800db616a783a13bc47b7f5710c004bf71.zip
Sansa Fuzev2: Add mkamsboot and dualboot support. The bootloader doesn't work, but pressing |<< or inserting USB to boot the OF does.
It should be pretty safe to run test code on it now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24924 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/mkamsboot/dualboot.c17
-rw-r--r--rbutil/mkamsboot/dualboot.h1
-rw-r--r--rbutil/mkamsboot/dualboot/Makefile7
-rw-r--r--rbutil/mkamsboot/dualboot/dualboot.S10
-rw-r--r--rbutil/mkamsboot/mkamsboot.c12
-rw-r--r--rbutil/mkamsboot/mkamsboot.h1
6 files changed, 44 insertions, 4 deletions
diff --git a/rbutil/mkamsboot/dualboot.c b/rbutil/mkamsboot/dualboot.c
index 32dad00ff0..527850d452 100644
--- a/rbutil/mkamsboot/dualboot.c
+++ b/rbutil/mkamsboot/dualboot.c
@@ -136,3 +136,20 @@ unsigned char dualboot_clipplus[216] = {
136 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x0f, 0xc8, 136 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x0f, 0xc8,
137 0x00, 0x00, 0x0d, 0xc8, 0x00, 0x00, 0x0b, 0xc8 137 0x00, 0x00, 0x0d, 0xc8, 0x00, 0x00, 0x0b, 0xc8
138}; 138};
139unsigned char dualboot_fuzev2[236] = {
140 0xd4, 0xf0, 0x9f, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x1f, 0xe5,
144 0x24, 0x10, 0x1f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 0x18, 0x30, 0x1f, 0xe5, 0x01, 0x40, 0x50, 0xe4,
145 0x01, 0x40, 0x43, 0xe4, 0x00, 0x00, 0x52, 0xe1, 0xfb, 0xff, 0xff, 0x1a, 0x2c, 0x30, 0x0f, 0xe5,
146 0x78, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x01, 0x18, 0x81, 0xe3, 0x00, 0x10, 0x80, 0xe5,
147 0x6c, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, 0x00, 0x14, 0x80, 0xe5, 0x20, 0x10, 0x90, 0xe5,
148 0x00, 0x00, 0x51, 0xe3, 0x08, 0x00, 0x00, 0x1a, 0x58, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3,
149 0x00, 0x14, 0x80, 0xe5, 0x20, 0x10, 0x90, 0xe5, 0x00, 0x00, 0x51, 0xe3, 0x02, 0x00, 0x00, 0x1a,
150 0x78, 0x00, 0x1f, 0xe5, 0x78, 0x10, 0x1f, 0xe5, 0x01, 0x00, 0x00, 0xea, 0x8c, 0x00, 0x1f, 0xe5,
151 0x8c, 0x10, 0x1f, 0xe5, 0x84, 0x30, 0x1f, 0xe5, 0x02, 0x50, 0x83, 0xe2, 0x01, 0x40, 0x43, 0xe0,
152 0x01, 0x20, 0x50, 0xe4, 0x01, 0x20, 0x43, 0xe4, 0x04, 0x00, 0x53, 0xe1, 0xfb, 0xff, 0xff, 0x1a,
153 0x01, 0x00, 0x83, 0xe2, 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00,
154 0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x00, 0x00, 0x0d, 0xc8
155};
diff --git a/rbutil/mkamsboot/dualboot.h b/rbutil/mkamsboot/dualboot.h
index 28139ae34f..d67ad2b6d1 100644
--- a/rbutil/mkamsboot/dualboot.h
+++ b/rbutil/mkamsboot/dualboot.h
@@ -8,3 +8,4 @@ extern unsigned char dualboot_m200v4[212];
8extern unsigned char dualboot_fuze[236]; 8extern unsigned char dualboot_fuze[236];
9extern unsigned char dualboot_clipv2[280]; 9extern unsigned char dualboot_clipv2[280];
10extern unsigned char dualboot_clipplus[216]; 10extern unsigned char dualboot_clipplus[216];
11extern unsigned char dualboot_fuzev2[236];
diff --git a/rbutil/mkamsboot/dualboot/Makefile b/rbutil/mkamsboot/dualboot/Makefile
index 8a441c9237..cc788f1fe5 100644
--- a/rbutil/mkamsboot/dualboot/Makefile
+++ b/rbutil/mkamsboot/dualboot/Makefile
@@ -4,8 +4,8 @@ CC=gcc
4# adding a new target. mkamsboot.c also needs to be edited to refer to these 4# adding a new target. mkamsboot.c also needs to be edited to refer to these
5# new images. 5# new images.
6 6
7BOOTOBJS = nrv2e_d8.o dualboot_clip.o dualboot_e200v2.o dualboot_c200v2.o dualboot_m200v4.o dualboot_fuze.o dualboot_clipv2.o dualboot_clipplus.o 7BOOTOBJS = nrv2e_d8.o dualboot_clip.o dualboot_e200v2.o dualboot_c200v2.o dualboot_m200v4.o dualboot_fuze.o dualboot_clipv2.o dualboot_clipplus.o dualboot_fuzev2.o
8BOOTBINS = nrv2e_d8.arm-bin dualboot_clip.arm-bin dualboot_e200v2.arm-bin dualboot_c200v2.arm-bin dualboot_m200v4.arm-bin dualboot_fuze.arm-bin dualboot_clipv2.arm-bin dualboot_clipplus.arm-bin 8BOOTBINS = nrv2e_d8.arm-bin dualboot_clip.arm-bin dualboot_e200v2.arm-bin dualboot_c200v2.arm-bin dualboot_m200v4.arm-bin dualboot_fuze.arm-bin dualboot_clipv2.arm-bin dualboot_clipplus.arm-bin dualboot_fuzev2.arm-bin
9 9
10all: ../dualboot.h ../dualboot.c 10all: ../dualboot.h ../dualboot.c
11 11
@@ -32,6 +32,9 @@ dualboot_clipv2.o: dualboot.S
32dualboot_clipplus.o: dualboot.S 32dualboot_clipplus.o: dualboot.S
33 arm-elf-gcc -DSANSA_CLIPPLUS -c -o dualboot_clipplus.o dualboot.S 33 arm-elf-gcc -DSANSA_CLIPPLUS -c -o dualboot_clipplus.o dualboot.S
34 34
35dualboot_fuzev2.o: dualboot.S
36 arm-elf-gcc -DSANSA_FUZEV2 -c -o dualboot_fuzev2.o dualboot.S
37
35# Rules for the ucl unpack function 38# Rules for the ucl unpack function
36nrv2e_d8.o: nrv2e_d8.S 39nrv2e_d8.o: nrv2e_d8.S
37 arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.o nrv2e_d8.S 40 arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.o nrv2e_d8.S
diff --git a/rbutil/mkamsboot/dualboot/dualboot.S b/rbutil/mkamsboot/dualboot/dualboot.S
index a27ab34d85..84d2fcee4d 100644
--- a/rbutil/mkamsboot/dualboot/dualboot.S
+++ b/rbutil/mkamsboot/dualboot/dualboot.S
@@ -83,7 +83,7 @@ uclcopy:
83#define USB_PIN 1 /* FIXME: not correct on some c200v2s */ 83#define USB_PIN 1 /* FIXME: not correct on some c200v2s */
84#elif defined(SANSA_CLIP) || defined(SANSA_CLIPV2) 84#elif defined(SANSA_CLIP) || defined(SANSA_CLIPV2)
85#define USB_PIN 6 85#define USB_PIN 6
86#elif defined(SANSA_FUZE) || defined(SANSA_E200V2) 86#elif defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2)
87#define USB_PIN 3 87#define USB_PIN 3
88#endif 88#endif
89 89
@@ -143,14 +143,20 @@ uclcopy:
143 143
144 cmp r1, #0 144 cmp r1, #0
145 beq boot_of 145 beq boot_of
146#elif defined(SANSA_E200V2) || defined(SANSA_FUZE) 146#elif defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_FUZEV2)
147 ldr r0, =GPIOC 147 ldr r0, =GPIOC
148 mov r1, #0 148 mov r1, #0
149 str r1, [r0, #0x400] 149 str r1, [r0, #0x400]
150 ldr r1, [r0, #0x20] /* read pin C3 */ 150 ldr r1, [r0, #0x20] /* read pin C3 */
151 151
152 cmp r1, #0 /* C3 = #0 means button pressed */ 152 cmp r1, #0 /* C3 = #0 means button pressed */
153#ifdef SANSA_FUZEV2
154 /* the logic is reversed on the fuzev2 */
155 bne boot_of
156#else
153 beq boot_of 157 beq boot_of
158#endif /* SANSA_FUZEV2 */
159
154#elif defined(SANSA_CLIPPLUS) 160#elif defined(SANSA_CLIPPLUS)
155 @ read pins 161 @ read pins
156 ldr r0, =GPIOC 162 ldr r0, =GPIOC
diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c
index 9e0099d1b6..4cf1bcd317 100644
--- a/rbutil/mkamsboot/mkamsboot.c
+++ b/rbutil/mkamsboot/mkamsboot.c
@@ -118,6 +118,7 @@ const unsigned short hw_revisions[] = {
118 [MODEL_M200V4] = 4, 118 [MODEL_M200V4] = 4,
119 [MODEL_C200V2] = 2, 119 [MODEL_C200V2] = 2,
120 [MODEL_CLIPPLUS]= 1, 120 [MODEL_CLIPPLUS]= 1,
121 [MODEL_FUZEV2] = 2,
121}; 122};
122 123
123/* version 2 is used in Clipv2, Clip+ and Fuzev2 firmwares */ 124/* version 2 is used in Clipv2, Clip+ and Fuzev2 firmwares */
@@ -129,6 +130,7 @@ const unsigned short fw_revisions[] = {
129 [MODEL_M200V4] = 1, 130 [MODEL_M200V4] = 1,
130 [MODEL_C200V2] = 1, 131 [MODEL_C200V2] = 1,
131 [MODEL_CLIPPLUS]= 2, 132 [MODEL_CLIPPLUS]= 2,
133 [MODEL_FUZEV2] = 2,
132}; 134};
133 135
134/* Descriptive name of these models */ 136/* Descriptive name of these models */
@@ -140,6 +142,7 @@ const char* model_names[] = {
140 [MODEL_E200V2] = "e200", 142 [MODEL_E200V2] = "e200",
141 [MODEL_M200V4] = "m200", 143 [MODEL_M200V4] = "m200",
142 [MODEL_C200V2] = "c200", 144 [MODEL_C200V2] = "c200",
145 [MODEL_FUZEV2] = "Fuze",
143}; 146};
144 147
145/* Dualboot functions for these models */ 148/* Dualboot functions for these models */
@@ -151,6 +154,7 @@ static const unsigned char* bootloaders[] = {
151 [MODEL_M200V4] = dualboot_m200v4, 154 [MODEL_M200V4] = dualboot_m200v4,
152 [MODEL_C200V2] = dualboot_c200v2, 155 [MODEL_C200V2] = dualboot_c200v2,
153 [MODEL_CLIPPLUS]= dualboot_clipplus, 156 [MODEL_CLIPPLUS]= dualboot_clipplus,
157 [MODEL_FUZEV2] = dualboot_fuzev2,
154}; 158};
155 159
156/* Size of dualboot functions for these models */ 160/* Size of dualboot functions for these models */
@@ -162,6 +166,7 @@ const int bootloader_sizes[] = {
162 [MODEL_M200V4] = sizeof(dualboot_m200v4), 166 [MODEL_M200V4] = sizeof(dualboot_m200v4),
163 [MODEL_C200V2] = sizeof(dualboot_c200v2), 167 [MODEL_C200V2] = sizeof(dualboot_c200v2),
164 [MODEL_CLIPPLUS]= sizeof(dualboot_clipplus), 168 [MODEL_CLIPPLUS]= sizeof(dualboot_clipplus),
169 [MODEL_FUZEV2] = sizeof(dualboot_fuzev2),
165}; 170};
166 171
167/* Model names used in the Rockbox header in ".sansa" files - these match the 172/* Model names used in the Rockbox header in ".sansa" files - these match the
@@ -174,6 +179,7 @@ static const char* rb_model_names[] = {
174 [MODEL_M200V4] = "m2v4", 179 [MODEL_M200V4] = "m2v4",
175 [MODEL_C200V2] = "c2v2", 180 [MODEL_C200V2] = "c2v2",
176 [MODEL_CLIPPLUS]= "cli+", 181 [MODEL_CLIPPLUS]= "cli+",
182 [MODEL_FUZEV2] = "fuz2",
177}; 183};
178 184
179/* Model numbers used to initialise the checksum in the Rockbox header in 185/* Model numbers used to initialise the checksum in the Rockbox header in
@@ -186,6 +192,7 @@ static const int rb_model_num[] = {
186 [MODEL_M200V4] = 42, 192 [MODEL_M200V4] = 42,
187 [MODEL_C200V2] = 44, 193 [MODEL_C200V2] = 44,
188 [MODEL_CLIPPLUS]= 66, 194 [MODEL_CLIPPLUS]= 66,
195 [MODEL_FUZEV2] = 68,
189}; 196};
190 197
191/* Checksums of unmodified original firmwares - for safety, and device 198/* Checksums of unmodified original firmwares - for safety, and device
@@ -223,6 +230,9 @@ static struct md5sums sansasums[] = {
223 { MODEL_CLIPV2, "2.01.32", "0ad3723e52022509089d938d0fbbf8c5" }, 230 { MODEL_CLIPV2, "2.01.32", "0ad3723e52022509089d938d0fbbf8c5" },
224 231
225 { MODEL_CLIPPLUS, "01.02.09", "656d38114774c2001dc18e6726df3c5d" }, 232 { MODEL_CLIPPLUS, "01.02.09", "656d38114774c2001dc18e6726df3c5d" },
233
234 { MODEL_FUZEV2, "2.01.17", "8b85fb05bf645d08a4c8c3e344ec9ebe" },
235 { MODEL_FUZEV2, "2.02.26", "d4f6f85c3e4a8ea8f2e5acc421641801" },
226}; 236};
227 237
228#define NUM_MD5S (sizeof(sansasums)/sizeof(sansasums[0])) 238#define NUM_MD5S (sizeof(sansasums)/sizeof(sansasums[0]))
@@ -324,6 +334,8 @@ static int get_model(int model_id)
324 return MODEL_CLIPV2; 334 return MODEL_CLIPV2;
325 case 0x28: 335 case 0x28:
326 return MODEL_CLIPPLUS; 336 return MODEL_CLIPPLUS;
337 case 0x70:
338 return MODEL_FUZEV2;
327 } 339 }
328 340
329 return MODEL_UNKNOWN; 341 return MODEL_UNKNOWN;
diff --git a/rbutil/mkamsboot/mkamsboot.h b/rbutil/mkamsboot/mkamsboot.h
index cf5628aa5d..835d024d98 100644
--- a/rbutil/mkamsboot/mkamsboot.h
+++ b/rbutil/mkamsboot/mkamsboot.h
@@ -42,6 +42,7 @@ enum {
42 MODEL_M200V4, 42 MODEL_M200V4,
43 MODEL_C200V2, 43 MODEL_C200V2,
44 MODEL_CLIPPLUS, 44 MODEL_CLIPPLUS,
45 MODEL_FUZEV2,
45}; 46};
46 47
47 48