diff options
author | Dave Chapman <dave@dchapman.com> | 2009-10-12 19:46:45 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2009-10-12 19:46:45 +0000 |
commit | a70c7bf862f6b4e31375ada8eb39c6535bed6eb4 (patch) | |
tree | ad3a5d8eefc7fbfc803d651bdd160630c6857839 /bootloader/ipodnano2g.c | |
parent | 48658eec41e47eb74602b54f540aa92651946fd8 (diff) | |
download | rockbox-a70c7bf862f6b4e31375ada8eb39c6535bed6eb4.tar.gz rockbox-a70c7bf862f6b4e31375ada8eb39c6535bed6eb4.zip |
Nano2G bootloader - fix dual-booting the Apple firmware.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23139 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/ipodnano2g.c')
-rw-r--r-- | bootloader/ipodnano2g.c | 21 |
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 */ |
55 | unsigned char *loadbuffer = (unsigned char *)0x08000000; | 55 | unsigned char *loadbuffer = (unsigned char *)0x48000000; |
56 | 56 | ||
57 | /* Bootloader version */ | 57 | /* Bootloader version */ |
58 | char version[] = APPSVERSION; | 58 | char 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"); |