From 96165abec2da60c466659fa0e68e06d97587d51a Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Thu, 28 May 2009 18:27:08 +0000 Subject: FS#10253 : mkamsboot v1.0 - Bump version to 1.0 - Add Clipv2 target - Make mkamsboot work as a library (work by domonoky : FS#10185, with a few modifications by me) . Use a macro with variadic arguments for error cases in functions which might error. . Add detailed descriptions to functions exported by the library (in the header file) - modify bin2c.c to produce only one pair of .c/.h files with several files embedded in it - move files needing to be built by an ARM cross compiler into dualboot/ - commit produced .c/.h files (containing nrv2e_d8.S and dualboot.S built for Clip, Fuze, e200v2, c200v2, m200v4, Clipv2) - Write a real README file - cosmetics: indent dualboot.S properly, remove trailing spaces, limit lines to 80 characters - comments: add/correct comments in dualboot.S and mkamsboot.c - move back extract_fw.c to utils/AMS/hacking git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21118 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/mkamsboot/dualboot/dualboot.S | 220 +++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 rbutil/mkamsboot/dualboot/dualboot.S (limited to 'rbutil/mkamsboot/dualboot/dualboot.S') diff --git a/rbutil/mkamsboot/dualboot/dualboot.S b/rbutil/mkamsboot/dualboot/dualboot.S new file mode 100644 index 0000000000..5210ba5160 --- /dev/null +++ b/rbutil/mkamsboot/dualboot/dualboot.S @@ -0,0 +1,220 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 Rafaël Carré + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +.text + + #if defined(SANSA_CLIPV2) +.set RAM_SIZE, 0x100000 /* Use 1MB of SDRAM on v2 firmwares (bigger firmware) */ +#else +.set RAM_SIZE, 0x50000 /* Use full IRAM on v1 firmwares */ +#endif + +/* AS3525 hardware registers */ +.set GPIOA, 0xC80B0000 +.set GPIOB, 0xC80C0000 +.set GPIOC, 0xC80D0000 +.set GPIOD, 0xC80E0000 +.set CGU_PERI, 0xC80F0014 + + +/* Vectors */ + + ldr pc, =start /* reset vector */ + /* next vectors are unused */ + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + +/* These values are filled in by mkamsboot - don't move them from offset 0x20 */ + +uclunpack_end: .word 0 /* End of the ucl_unpack function */ +uclunpack_size: .word 0 /* Size in bytes of the ucl_unpack function */ + +ucl_of_end: .word 0 /* End of the ucl-compressed OF image */ +ucl_of_size: .word 0 /* Size in bytes of the compressed OF image */ + +ucl_rb_end: .word 0 /* End of the ucl-compressed RB image */ +ucl_rb_size: .word 0 /* Size in bytes of the compressed RB image */ + + +start: + /* First copy the UCL unpack function to the end of RAM */ + ldr r0, uclunpack_end /* Source */ + ldr r1, uclunpack_size /* Source length */ + sub r2, r0, r1 /* Source start - 1*/ + + ldr r3, =(RAM_SIZE-1) /* Destination end */ + +uclcopy: + ldrb r4, [r0], #-1 + strb r4, [r3], #-1 + cmp r2, r0 + bne uclcopy + + add r5, r3, #2 /* r5 is entry point of copy of uclunpack */ + /* function, plus one (for thumb mode */ + + /* enable gpio clock */ + ldr r0, =CGU_PERI + ldr r1, [r0] + orr r1, r1, #(1<<16) + str r1, [r0] + + +/* TODO : M200V4 */ +#if defined(SANSA_C200V2) +#define USB_PIN 1 +#elif defined(SANSA_CLIP) || defined(SANSA_CLIPV2) +#define USB_PIN 6 +#elif defined(SANSA_FUZE) || defined(SANSA_E200V2) +#define USB_PIN 3 +#endif + +#ifdef USB_PIN /* TODO : remove this check when we'll have an USB driver */ + ldr r0, =GPIOA + mov r1, #0 + str r1, [r0, #0x400] + ldr r1, [r0, #(4*(1<