summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
8# adding a new target. mkamsboot.c also needs to be edited to refer to these 8# adding a new target. mkamsboot.c also needs to be edited to refer to these
9# new images. 9# new images.
10 10
11BOOTIMAGES = dualboot_clip.o dualboot_e200v2.o dualboot_m200v4.o dualboot_fuze.o 11BOOTIMAGES = dualboot_clip.o dualboot_e200v2.o dualboot_c200v2.o dualboot_m200v4.o dualboot_fuze.o
12BOOTHEADERS = dualboot_clip.h dualboot_e200v2.h dualboot_m200v4.h dualboot_fuze.h 12BOOTHEADERS = dualboot_clip.h dualboot_e200v2.h dualboot_c200v2.h dualboot_m200v4.h dualboot_fuze.h
13 13
14CLIPFILES = dualboot_clip.arm-o dualboot_clip.o dualboot_clip.c dualboot_clip.h 14CLIPFILES = dualboot_clip.arm-o dualboot_clip.o dualboot_clip.c dualboot_clip.h
15 15
@@ -19,6 +19,9 @@ E200V2FILES = dualboot_e200v2.arm-o dualboot_e200v2.o dualboot_e200v2.c \
19M200V4FILES = dualboot_m200v4.arm-o dualboot_m200v4.o dualboot_m200v4.arm-bin \ 19M200V4FILES = dualboot_m200v4.arm-o dualboot_m200v4.o dualboot_m200v4.arm-bin \
20 dualboot_m200v4.c dualboot_m200v4.h 20 dualboot_m200v4.c dualboot_m200v4.h
21 21
22C200V2FILES = dualboot_c200v2.arm-o dualboot_c200v2.o dualboot_c200v2.c \
23 dualboot_c200v2.h
24
22FUZEFILES = dualboot_fuze.arm-o dualboot_fuze.o dualboot_fuze.c dualboot_fuze.h 25FUZEFILES = dualboot_fuze.arm-o dualboot_fuze.o dualboot_fuze.c dualboot_fuze.h
23 26
24all: mkamsboot 27all: mkamsboot
@@ -37,6 +40,9 @@ dualboot_e200v2.arm-o: dualboot.S
37dualboot_m200v4.arm-o: dualboot.S 40dualboot_m200v4.arm-o: dualboot.S
38 arm-elf-gcc -DSANSA_M200V4 -c -o dualboot_m200v4.arm-o dualboot.S 41 arm-elf-gcc -DSANSA_M200V4 -c -o dualboot_m200v4.arm-o dualboot.S
39 42
43dualboot_c200v2.arm-o: dualboot.S
44 arm-elf-gcc -DSANSA_C200V2 -c -o dualboot_c200v2.arm-o dualboot.S
45
40# Rules for the ucl unpack function 46# Rules for the ucl unpack function
41nrv2e_d8.arm-o: nrv2e_d8.S 47nrv2e_d8.arm-o: nrv2e_d8.S
42 arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.arm-o nrv2e_d8.S 48 arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.arm-o nrv2e_d8.S
@@ -80,4 +86,5 @@ bin2c: bin2c.c
80clean: 86clean:
81 rm -f mkamsboot mkamsboot.o nrv2e_d8.arm-o nrv2e_d8.arm-elf \ 87 rm -f mkamsboot mkamsboot.o nrv2e_d8.arm-o nrv2e_d8.arm-elf \
82 nrv2e_d8.arm-bin *~ bin2c nrv2e_d8.c nrv2e_d8.h nrv2e_d8.o md5.o \ 88 nrv2e_d8.arm-bin *~ bin2c nrv2e_d8.c nrv2e_d8.h nrv2e_d8.o md5.o \
83 $(BOOTIMAGES) $(CLIPFILES) $(E200V2FILES) $(M200V4FILES) $(FUZEFILES) 89 $(BOOTIMAGES) $(CLIPFILES) $(E200V2FILES) $(M200V4FILES) $(FUZEFILES) \
90 $(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:
81#ifndef SANSA_M200V4 /* this doesnt work for m200 */ 81#ifndef SANSA_M200V4 /* this doesnt work for m200 */
82 /* we check A3 unconditionally of the model because it seems to be */ 82 /* we check A3 unconditionally of the model because it seems to be */
83 /* either hold, either usb on every model */ 83 /* either hold, either usb on every model */
84 /* TODO: make it USB on all AMS Sansas for consistency, USB is safer too */
84 85
85 ldr r0, =GPIOA 86 ldr r0, =GPIOA
86 mov r1, #0 87 mov r1, #0
87 str r1, [r0, #0x400] 88 str r1, [r0, #0x400]
89#ifdef SANSA_C200V2
90 ldr r1, [r0, #0x8] /* USB is A1 on C200 */
91#else
88 ldr r1, [r0, #0x20] /* read pin A3 */ 92 ldr r1, [r0, #0x20] /* read pin A3 */
89 93#endif
90 cmp r1, #0 94 cmp r1, #0
91 bne boot_of 95 bne boot_of
92#endif 96#endif
@@ -118,6 +122,16 @@ uclcopy:
118 122
119 cmp r1, #0 /* C3 = #0 means button pressed */ 123 cmp r1, #0 /* C3 = #0 means button pressed */
120 beq boot_of 124 beq boot_of
125#elif defined(SANSA_C200V2)
126 /* check for RIGHT on C6, should maybe changed to LEFT as soon as it
127 * known in which pin that is in order for consistency */
128 ldr r0, =GPIOC
129 mov r1, #0
130 str r1, [r0, #0x400] /* set pin to output */
131
132 ldr r1, [r0, #256] /* 1<<(6+2) */
133 cmp r1, #0 /* C6 low means button pressed */
134 beq boot_of
121#elif defined(SANSA_M200V4) 135#elif defined(SANSA_M200V4)
122 /* LEFT button */ 136 /* LEFT button */
123.set row, (1<<5) /* enable output on A5 */ 137.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.
93#include "dualboot_e200v2.h" 93#include "dualboot_e200v2.h"
94#include "dualboot_fuze.h" 94#include "dualboot_fuze.h"
95#include "dualboot_m200v4.h" 95#include "dualboot_m200v4.h"
96#include "dualboot_c200v2.h"
96 97
97/* Win32 compatibility */ 98/* Win32 compatibility */
98#ifndef O_BINARY 99#ifndef O_BINARY
@@ -109,9 +110,9 @@ enum
109 MODEL_FUZE = 0, 110 MODEL_FUZE = 0,
110 MODEL_CLIP, 111 MODEL_CLIP,
111 MODEL_CLIPV2, 112 MODEL_CLIPV2,
112 MODEL_E200, 113 MODEL_E200V2,
113 MODEL_M200, 114 MODEL_M200V4,
114 MODEL_C200 115 MODEL_C200V2,
115}; 116};
116 117
117static const char* model_names[] = 118static const char* model_names[] =
@@ -119,9 +120,9 @@ static const char* model_names[] =
119 "Fuze", 120 "Fuze",
120 "Clip", 121 "Clip",
121 "Clip V2", 122 "Clip V2",
122 "E200", 123 "e200 v2",
123 "M200", 124 "m200 v4",
124 "C200" 125 "c200 v2"
125}; 126};
126 127
127static const unsigned char* bootloaders[] = 128static const unsigned char* bootloaders[] =
@@ -131,7 +132,7 @@ static const unsigned char* bootloaders[] =
131 NULL, 132 NULL,
132 dualboot_e200v2, 133 dualboot_e200v2,
133 dualboot_m200v4, 134 dualboot_m200v4,
134 NULL 135 dualboot_c200v2,
135}; 136};
136 137
137static const int bootloader_sizes[] = 138static const int bootloader_sizes[] =
@@ -141,7 +142,7 @@ static const int bootloader_sizes[] =
141 0, 142 0,
142 sizeof(dualboot_e200v2), 143 sizeof(dualboot_e200v2),
143 sizeof(dualboot_m200v4), 144 sizeof(dualboot_m200v4),
144 0 145 sizeof(dualboot_c200v2),
145}; 146};
146 147
147/* Model names used in the Rockbox header in ".sansa" files - these match the 148/* Model names used in the Rockbox header in ".sansa" files - these match the
@@ -152,8 +153,8 @@ static const char* rb_model_names[] =
152 "clip", 153 "clip",
153 NULL, 154 NULL,
154 "e2v2", 155 "e2v2",
155 "m2v2", 156 "m2v4",
156 NULL 157 "c2v2",
157}; 158};
158 159
159/* Model numbers used to initialise the checksum in the Rockbox header in 160/* Model numbers used to initialise the checksum in the Rockbox header in
@@ -165,7 +166,7 @@ static const int rb_model_num[] =
165 0, 166 0,
166 41, 167 41,
167 42, 168 42,
168 0 169 44
169}; 170};
170 171
171struct md5sums { 172struct md5sums {
@@ -180,19 +181,19 @@ struct md5sums {
180static struct md5sums sansasums[] = { 181static struct md5sums sansasums[] = {
181 /* NOTE: Different regional versions of the firmware normally only 182 /* NOTE: Different regional versions of the firmware normally only
182 differ in the filename - the md5sums are identical */ 183 differ in the filename - the md5sums are identical */
183 { MODEL_E200, "3.01.11", 1, "e622ca8cb6df423f54b8b39628a1f0a3" }, 184 { MODEL_E200V2, "3.01.11", 1, "e622ca8cb6df423f54b8b39628a1f0a3" },
184 { MODEL_E200, "3.01.14", 1, "2c1d0383fc3584b2cc83ba8cc2243af6" }, 185 { MODEL_E200V2, "3.01.14", 1, "2c1d0383fc3584b2cc83ba8cc2243af6" },
185 { MODEL_E200, "3.01.16", 1, "12563ad71b25a1034cf2092d1e0218c4" }, 186 { MODEL_E200V2, "3.01.16", 1, "12563ad71b25a1034cf2092d1e0218c4" },
186 187
187 { MODEL_FUZE, "1.01.11", 1, "cac8ffa03c599330ac02c4d41de66166" }, 188 { MODEL_FUZE, "1.01.11", 1, "cac8ffa03c599330ac02c4d41de66166" },
188 { MODEL_FUZE, "1.01.15", 1, "df0e2c1612727f722c19a3c764cff7f2" }, 189 { MODEL_FUZE, "1.01.15", 1, "df0e2c1612727f722c19a3c764cff7f2" },
189 { MODEL_FUZE, "1.01.22", 1, "5aff5486fe8dd64239cc71eac470af98" }, 190 { MODEL_FUZE, "1.01.22", 1, "5aff5486fe8dd64239cc71eac470af98" },
190 191
191 { MODEL_C200, "3.02.05", 1, "b6378ebd720b0ade3fad4dc7ab61c1a5" }, 192 { MODEL_C200V2, "3.02.05", 1, "b6378ebd720b0ade3fad4dc7ab61c1a5" },
192 193
193 { MODEL_M200, "4.00.45", 1, "82e3194310d1514e3bbcd06e84c4add3" }, 194 { MODEL_M200V4, "4.00.45", 1, "82e3194310d1514e3bbcd06e84c4add3" },
194 { MODEL_M200, "4.01.08-A", 1, "fc9dd6116001b3e6a150b898f1b091f0" }, 195 { MODEL_M200V4, "4.01.08-A", 1, "fc9dd6116001b3e6a150b898f1b091f0" },
195 { MODEL_M200, "4.01.08-E", 1, "d3fb7d8ec8624ee65bc99f8dab0e2369" }, 196 { MODEL_M200V4, "4.01.08-E", 1, "d3fb7d8ec8624ee65bc99f8dab0e2369" },
196 197
197 { MODEL_CLIP, "1.01.17", 1, "12caad785d506219d73f538772afd99e" }, 198 { MODEL_CLIP, "1.01.17", 1, "12caad785d506219d73f538772afd99e" },
198 { MODEL_CLIP, "1.01.18", 1, "d720b266bd5afa38a198986ef0508a45" }, 199 { MODEL_CLIP, "1.01.18", 1, "d720b266bd5afa38a198986ef0508a45" },
@@ -267,11 +268,11 @@ static int get_model(int model_id)
267 case 0x22: 268 case 0x22:
268 return MODEL_CLIP; 269 return MODEL_CLIP;
269 case 0x23: 270 case 0x23:
270 return MODEL_C200; 271 return MODEL_C200V2;
271 case 0x24: 272 case 0x24:
272 return MODEL_E200; 273 return MODEL_E200V2;
273 case 0x25: 274 case 0x25:
274 return MODEL_M200; 275 return MODEL_M200V4;
275 case 0x27: 276 case 0x27:
276 return MODEL_CLIPV2; 277 return MODEL_CLIPV2;
277 } 278 }