summaryrefslogtreecommitdiff
path: root/bootloader
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/ipodnano2g.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/bootloader/ipodnano2g.c b/bootloader/ipodnano2g.c
index 9891ea801e..020da207bd 100644
--- a/bootloader/ipodnano2g.c
+++ b/bootloader/ipodnano2g.c
@@ -51,8 +51,8 @@
51*/ 51*/
52#define MAX_LOADSIZE (8*1024*1024) 52#define MAX_LOADSIZE (8*1024*1024)
53 53
54/* The buffer to load the firmware into */ 54/* The buffer to load the firmware into - use an uncached alias of 0x08000000 */
55unsigned char *loadbuffer = (unsigned char *)0x08000000; 55unsigned char *loadbuffer = (unsigned char *)0x48000000;
56 56
57/* Bootloader version */ 57/* Bootloader version */
58char version[] = APPSVERSION; 58char version[] = APPSVERSION;
@@ -229,11 +229,9 @@ void main(void)
229 if (button_was_held || (btn==BUTTON_MENU)) { 229 if (button_was_held || (btn==BUTTON_MENU)) {
230 /* If either the hold switch was on, or the Menu button was held, then 230 /* If either the hold switch was on, or the Menu button was held, then
231 try the Apple firmware */ 231 try the Apple firmware */
232
233 verbose = true;
234 printf("Loading original firmware..."); 232 printf("Loading original firmware...");
235 233
236 if ((rc = readfw("DNANkbso", (void*)0x08000000, &size)) < 0) { 234 if ((rc = readfw("DNANkbso", loadbuffer, &size)) < 0) {
237 printf("readfw error %d",rc); 235 printf("readfw error %d",rc);
238 fatal_error(); 236 fatal_error();
239 } 237 }
@@ -241,7 +239,7 @@ void main(void)
241 /* Now we need to decrypt it */ 239 /* Now we need to decrypt it */
242 printf("Decrypting %d bytes...",size); 240 printf("Decrypting %d bytes...",size);
243 241
244 aes_decrypt((void*)0x08000000, size); 242 aes_decrypt(loadbuffer, size);
245 } else { 243 } else {
246 printf("Loading Rockbox..."); 244 printf("Loading Rockbox...");
247 rc=load_firmware(loadbuffer, BOOTFILE, MAX_LOADSIZE); 245 rc=load_firmware(loadbuffer, BOOTFILE, MAX_LOADSIZE);
@@ -265,8 +263,15 @@ void main(void)
265 /* Remap the bootrom back to zero - that's how the NOR bootloader leaves 263 /* Remap the bootrom back to zero - that's how the NOR bootloader leaves
266 it. 264 it.
267 */ 265 */
268 // This won't work, as we are running from IRAM mapped to 0x0... 266 MIUCON &= ~1;
269 //MIUCON &= ~1; 267
268 /* Disable caches and protection unit */
269 asm volatile(
270 "mrc 15, 0, r0, c1, c0, 0 \n"
271 "bic r0, r0, #0x1000 \n"
272 "bic r0, r0, #0x5 \n"
273 "mcr 15, 0, r0, c1, c0, 0 \n"
274 );
270 275
271 /* Branch to start of DRAM */ 276 /* Branch to start of DRAM */
272 asm volatile("ldr pc, =0x08000000"); 277 asm volatile("ldr pc, =0x08000000");