From 1b908334836883dafa30f3ba4dfba67683c32864 Mon Sep 17 00:00:00 2001 From: funman Date: Wed, 13 Jan 2010 03:05:29 +0000 Subject: [PATCH] Add Sansa Clip+ target to test mkamsboot UNTESTED, could ver well brick your Clip+ If it works, booting should just be delayed by a small delay (perhaps not noticeable) Hopefully the Clipv2 checks will work for Clip+ and then we'll be able to test the other Clipv2 code (LCD/button) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24219 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/mkamsboot/README | 2 ++ rbutil/mkamsboot/dualboot.c | 14 ++++++++++++++ rbutil/mkamsboot/dualboot.h | 1 + rbutil/mkamsboot/dualboot/Makefile | 7 +++++-- rbutil/mkamsboot/dualboot/dualboot.S | 8 +++++++- rbutil/mkamsboot/mkamsboot.c | 21 +++++++++++++++++---- rbutil/mkamsboot/mkamsboot.h | 1 + tools/configure | 36 ++++++++++++++++++++++++++++-------- tools/scramble.c | 4 +++- 9 files changed, 78 insertions(+), 16 deletions(-) diff --git a/rbutil/mkamsboot/README b/rbutil/mkamsboot/README index 53f1fba9b..a9eba35d2 100644 --- a/rbutil/mkamsboot/README +++ b/rbutil/mkamsboot/README @@ -23,6 +23,7 @@ Supported models ---------------- Sansa Clip : firmware version starting with "01." +Sansa Clip+ : firmware version starting with "01." Sansa Clipv2: firmware version starting with "02." Sansa Fuze : firmware version starting with "01." Sansa E200v2: firmware version starting with "03." @@ -37,6 +38,7 @@ For the firmware upgrade to happen, the firmware has to be named specially: clip v2 : m30pa.bin clip : m300a.bin +clip+ : clppa.bin fuze : fuzea.bin e200v2 : e200pa.bin c200v2 : c200pa.bin diff --git a/rbutil/mkamsboot/dualboot.c b/rbutil/mkamsboot/dualboot.c index 2eda3930c..01a3083f5 100644 --- a/rbutil/mkamsboot/dualboot.c +++ b/rbutil/mkamsboot/dualboot.c @@ -116,3 +116,17 @@ unsigned char dualboot_clipv2[272] = { 0x01, 0x00, 0x83, 0xe2, 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x38, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x00, 0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x00, 0x00, 0x0e, 0xc8 }; +unsigned char dualboot_clipplus[188] = { + 0xa8, 0xf0, 0x9f, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x1f, 0xe5, 0x20, 0x10, 0x1f, 0xe5, + 0x01, 0x20, 0x40, 0xe0, 0x68, 0x30, 0x9f, 0xe5, 0x01, 0x40, 0x50, 0xe4, 0x01, 0x40, 0x43, 0xe4, + 0x00, 0x00, 0x52, 0xe1, 0xfb, 0xff, 0xff, 0x1a, 0x02, 0x50, 0x83, 0xe2, 0x54, 0x00, 0x9f, 0xe5, + 0x00, 0x10, 0x90, 0xe5, 0x01, 0x18, 0x81, 0xe3, 0x00, 0x10, 0x80, 0xe5, 0x05, 0x06, 0xa0, 0xe3, + 0x01, 0x00, 0x50, 0xe2, 0xfd, 0xff, 0xff, 0x1a, 0x02, 0x00, 0x00, 0xea, 0x54, 0x00, 0x1f, 0xe5, + 0x54, 0x10, 0x1f, 0xe5, 0x01, 0x00, 0x00, 0xea, 0x68, 0x00, 0x1f, 0xe5, 0x68, 0x10, 0x1f, 0xe5, + 0x01, 0x40, 0x43, 0xe0, 0x01, 0x20, 0x50, 0xe4, 0x01, 0x20, 0x43, 0xe4, 0x04, 0x00, 0x53, 0xe1, + 0xfb, 0xff, 0xff, 0x1a, 0x01, 0x00, 0x83, 0xe2, 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, + 0x38, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x00, 0x14, 0x00, 0x0f, 0xc8 +}; diff --git a/rbutil/mkamsboot/dualboot.h b/rbutil/mkamsboot/dualboot.h index b88a18240..f3f1fc765 100644 --- a/rbutil/mkamsboot/dualboot.h +++ b/rbutil/mkamsboot/dualboot.h @@ -7,3 +7,4 @@ extern unsigned char dualboot_c200v2[228]; extern unsigned char dualboot_m200v4[204]; extern unsigned char dualboot_fuze[228]; extern unsigned char dualboot_clipv2[272]; +extern unsigned char dualboot_clipplus[188]; diff --git a/rbutil/mkamsboot/dualboot/Makefile b/rbutil/mkamsboot/dualboot/Makefile index 06b90c7fb..94ec71857 100644 --- a/rbutil/mkamsboot/dualboot/Makefile +++ b/rbutil/mkamsboot/dualboot/Makefile @@ -4,8 +4,8 @@ CC=gcc # adding a new target. mkamsboot.c also needs to be edited to refer to these # new images. -BOOTOBJS = nrv2e_d8.o dualboot_clip.o dualboot_e200v2.o dualboot_c200v2.o dualboot_m200v4.o dualboot_fuze.o dualboot_clipv2.o -BOOTBINS = 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 +BOOTOBJS = nrv2e_d8.o dualboot_clip.o dualboot_e200v2.o dualboot_c200v2.o dualboot_m200v4.o dualboot_fuze.o dualboot_clipv2.o dualboot_clipplus.o +BOOTBINS = 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 all: dualboot.h @@ -31,6 +31,9 @@ dualboot_c200v2.o: dualboot.S dualboot_clipv2.o: dualboot.S arm-elf-gcc -DSANSA_CLIPV2 -c -o dualboot_clipv2.o dualboot.S +dualboot_clipplus.o: dualboot.S + arm-elf-gcc -DSANSA_CLIPPLUS -c -o dualboot_clipplus.o dualboot.S + # Rules for the ucl unpack function nrv2e_d8.o: nrv2e_d8.S 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 5210ba516..fe1a64bef 100644 --- a/rbutil/mkamsboot/dualboot/dualboot.S +++ b/rbutil/mkamsboot/dualboot/dualboot.S @@ -21,7 +21,7 @@ .text - #if defined(SANSA_CLIPV2) +#if defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS) .set RAM_SIZE, 0x100000 /* Use 1MB of SDRAM on v2 firmwares (bigger firmware) */ #else .set RAM_SIZE, 0x50000 /* Use full IRAM on v1 firmwares */ @@ -156,6 +156,12 @@ uclcopy: cmp r1, #0 /* C3 = #0 means button pressed */ beq boot_of +#elif defined(SANSA_CLIPPLUS) + /* TODO */ + mov r0, #0x500000 /* Approximately 5 seconds */ +1: subs r0, r0, #1 /* just to prove we are running */ + bne 1b + b boot_of /* branch to OF */ #elif defined(SANSA_C200V2) /* check for RIGHT on C6, should changed to LEFT as soon as it * known in which pin that is in order for consistency */ diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c index 8d40a1966..d983d3785 100644 --- a/rbutil/mkamsboot/mkamsboot.c +++ b/rbutil/mkamsboot/mkamsboot.c @@ -109,7 +109,7 @@ execution to the uncompressed firmware. #define O_BINARY 0 #endif -/* 4 for m200, 2 for e200/c200, 1 or 2 for fuze/clop */ +/* 4 for m200, 2 for e200/c200, 1 or 2 for fuze/clip, 1 for clip+ */ const unsigned short hw_revisions[] = { [MODEL_FUZE] = 1, [MODEL_CLIP] = 1, @@ -117,9 +117,10 @@ const unsigned short hw_revisions[] = { [MODEL_E200V2] = 2, [MODEL_M200V4] = 4, [MODEL_C200V2] = 2, + [MODEL_CLIPPLUS]= 1, }; -/* version 2 is used in Clipv2 and Fuzev2 firmwares */ +/* version 2 is used in Clipv2, Clip+ and Fuzev2 firmwares */ const unsigned short fw_revisions[] = { [MODEL_FUZE] = 1, [MODEL_CLIP] = 1, @@ -127,6 +128,7 @@ const unsigned short fw_revisions[] = { [MODEL_E200V2] = 1, [MODEL_M200V4] = 1, [MODEL_C200V2] = 1, + [MODEL_CLIPPLUS]= 2, }; /* Descriptive name of these models */ @@ -134,6 +136,7 @@ const char* model_names[] = { [MODEL_FUZE] = "Fuze", [MODEL_CLIP] = "Clip", [MODEL_CLIPV2] = "Clip", + [MODEL_CLIPPLUS]= "Clip+", [MODEL_E200V2] = "e200", [MODEL_M200V4] = "m200", [MODEL_C200V2] = "c200", @@ -147,6 +150,7 @@ static const unsigned char* bootloaders[] = { [MODEL_E200V2] = dualboot_e200v2, [MODEL_M200V4] = dualboot_m200v4, [MODEL_C200V2] = dualboot_c200v2, + [MODEL_CLIPPLUS]= dualboot_clipplus, }; /* Size of dualboot functions for these models */ @@ -157,6 +161,7 @@ const int bootloader_sizes[] = { [MODEL_E200V2] = sizeof(dualboot_e200v2), [MODEL_M200V4] = sizeof(dualboot_m200v4), [MODEL_C200V2] = sizeof(dualboot_c200v2), + [MODEL_CLIPPLUS]= sizeof(dualboot_clipplus), }; /* Model names used in the Rockbox header in ".sansa" files - these match the @@ -168,6 +173,7 @@ static const char* rb_model_names[] = { [MODEL_E200V2] = "e2v2", [MODEL_M200V4] = "m2v4", [MODEL_C200V2] = "c2v2", + [MODEL_CLIPPLUS]= "cli+", }; /* Model numbers used to initialise the checksum in the Rockbox header in @@ -178,7 +184,8 @@ static const int rb_model_num[] = { [MODEL_CLIPV2] = 60, [MODEL_E200V2] = 41, [MODEL_M200V4] = 42, - [MODEL_C200V2] = 44 + [MODEL_C200V2] = 44, + [MODEL_CLIPPLUS]= 66, }; /* Checksums of unmodified original firmwares - for safety, and device @@ -212,7 +219,11 @@ static struct md5sums sansasums[] = { { MODEL_CLIP, "1.01.32", "d835d12342500732ffb9c4ee54abec15" }, { MODEL_CLIPV2, "2.01.16", "c57fb3fcbe07c2c9b360f060938f80cb" }, - { MODEL_CLIPV2, "2.01.32", "0ad3723e52022509089d938d0fbbf8c5" } + { MODEL_CLIPV2, "2.01.32", "0ad3723e52022509089d938d0fbbf8c5" }, + +#if 0 /* uncomment when Clip+ support is tested */ + { MODEL_CLIPPLUS, "01.02.09", "656d38114774c2001dc18e6726df3c5d" }, +#endif }; #define NUM_MD5S (sizeof(sansasums)/sizeof(sansasums[0])) @@ -293,6 +304,8 @@ static int get_model(int model_id) return MODEL_M200V4; case 0x27: return MODEL_CLIPV2; + case 0x28: + return MODEL_CLIPPLUS; } return MODEL_UNKNOWN; diff --git a/rbutil/mkamsboot/mkamsboot.h b/rbutil/mkamsboot/mkamsboot.h index 647770ff4..06fd329c8 100644 --- a/rbutil/mkamsboot/mkamsboot.h +++ b/rbutil/mkamsboot/mkamsboot.h @@ -41,6 +41,7 @@ enum { MODEL_E200V2, MODEL_M200V4, MODEL_C200V2, + MODEL_CLIPPLUS, }; diff --git a/tools/configure b/tools/configure index d14875aef..33c272d1b 100755 --- a/tools/configure +++ b/tools/configure @@ -900,14 +900,14 @@ cat <