diff options
-rw-r--r-- | bootloader/ipodnano2g.c | 21 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/boot.lds | 3 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/crt0.S | 2 |
3 files changed, 15 insertions, 11 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"); |
diff --git a/firmware/target/arm/s5l8700/boot.lds b/firmware/target/arm/s5l8700/boot.lds index 637a3a29c1..308a97dca8 100644 --- a/firmware/target/arm/s5l8700/boot.lds +++ b/firmware/target/arm/s5l8700/boot.lds | |||
@@ -12,11 +12,10 @@ STARTUP(target/arm/s5l8700/crt0.o) | |||
12 | #define DRAMORIG 0x08000000 | 12 | #define DRAMORIG 0x08000000 |
13 | #define DRAMSIZE (MEMORYSIZE * 0x100000) | 13 | #define DRAMSIZE (MEMORYSIZE * 0x100000) |
14 | 14 | ||
15 | #define IRAMORIG 0x22000000 | ||
15 | #if CONFIG_CPU==S5L8701 | 16 | #if CONFIG_CPU==S5L8701 |
16 | #define IRAMORIG 0x0 | ||
17 | #define IRAMSIZE 176K | 17 | #define IRAMSIZE 176K |
18 | #else | 18 | #else |
19 | #define IRAMORIG 0x22000000 | ||
20 | #define IRAMSIZE 256K | 19 | #define IRAMSIZE 256K |
21 | #endif | 20 | #endif |
22 | 21 | ||
diff --git a/firmware/target/arm/s5l8700/crt0.S b/firmware/target/arm/s5l8700/crt0.S index 3cc376711c..98f98a3178 100644 --- a/firmware/target/arm/s5l8700/crt0.S +++ b/firmware/target/arm/s5l8700/crt0.S | |||
@@ -91,7 +91,7 @@ newstart2: | |||
91 | #ifdef BOOTLOADER | 91 | #ifdef BOOTLOADER |
92 | /* Relocate ourself to IRAM - we have been loaded to DRAM */ | 92 | /* Relocate ourself to IRAM - we have been loaded to DRAM */ |
93 | mov r0, #0x08000000 /* source (DRAM) */ | 93 | mov r0, #0x08000000 /* source (DRAM) */ |
94 | mov r1, #0x00000000 /* dest (IRAM) */ | 94 | mov r1, #0x22000000 /* dest (IRAM) */ |
95 | ldr r2, =_dataend | 95 | ldr r2, =_dataend |
96 | 1: | 96 | 1: |
97 | cmp r2, r1 | 97 | cmp r2, r1 |