diff options
author | Jens Arnold <amiconn@rockbox.org> | 2011-06-19 17:23:18 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2011-06-19 17:23:18 +0000 |
commit | 91ce4b2a60c4cbe8e3568f79c3a73572461ff40d (patch) | |
tree | 863cf4142841fee4dd53e2849d060d2c559cca55 /firmware/target/coldfire | |
parent | e9e0cf59085cb3b3d77c8a2962fd8b80ac4d0c9d (diff) | |
download | rockbox-91ce4b2a60c4cbe8e3568f79c3a73572461ff40d.tar.gz rockbox-91ce4b2a60c4cbe8e3568f79c3a73572461ff40d.zip |
Optional dual-boot support in iAudio X5 and M5 bootloader, based on FS#5289.
In order to enable it, #define HAVE_DUALBOOT when building the bootloader.
Do not use the automatically created x5_fw.bin or m5_fw.bin, but use mkboot
to create a new firmware file from an OF x5_fw.bin resp. m5_fw.bin and
bootloader.bin.
The dual-boot bootloader boots the OF when pressing Play (main or remote) for
more than 3 seconds. Hold it a bit longer because the OF also checks buttons.
Short press boots rockbox.
As a bonus, the Play button read (for hold check) is done a bit earlier for
single-boot mode as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30018 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire')
-rw-r--r-- | firmware/target/coldfire/crt0.S | 53 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/boot.lds | 6 |
2 files changed, 56 insertions, 3 deletions
diff --git a/firmware/target/coldfire/crt0.S b/firmware/target/coldfire/crt0.S index e6717710b1..881fcf908f 100644 --- a/firmware/target/coldfire/crt0.S +++ b/firmware/target/coldfire/crt0.S @@ -26,11 +26,51 @@ .global start start: +#if defined(BOOTLOADER) && defined(HAVE_DUALBOOT) \ + && (defined(IAUDIO_X5) || defined(IAUDIO_M5)) + + /* 8 byte dualboot signature */ + bra.b 1f /* 0x6006 */ + .short 0x4442 /* DB */ +#if defined(IAUDIO_X5) + .long 0x69617835 /* iax5 */ +#elif defined(IAUDIO_M5) + .long 0x69616d35 /* iam5 */ +#else +#error Dualboot signature not defined +#endif +1: + /* As the control registers are write-only, we're relying on MBAR2 being */ + /* set up correctly by the preloader for button check */ + /* Only use scratch regs until we're sure that we will boot rockbox */ + lea MBAR2, %a1 + move.l (%a1), %a0 /* store GPIO_READ result for button check in main() */ + + /* Wait ~3 seconds for ON-button release. We need roughly 300ns per + iteration, so we check 10000000 times to reach the desired delay */ + move.l #10000000, %d0 +.on_button_test: + move.l (%a1), %d1 /* GPIO_READ */ + and.l #0x06000000, %d1 /* Check main (bit 25=0) and remote (bit 26=0) */ + cmp.l #0x06000000, %d1 /* ON buttons simultaneously */ + beq.b .loadrockbox + subq.l #1, %d0 + bne.b .on_button_test + +.loadoriginal: + jmp 0x10010 + +.loadrockbox: + move.l %a0, %d7 /* keep initial GPIO_READ value in %d7 for now */ + +#endif /* defined(BOOTLOADER && defined(HAVE_DUALBOOT) + && (defined(IAUDIO_X5) || defined(IAUDIO_M5)) */ + move.w #0x2700,%sr move.l #vectors,%d0 movec.l %d0,%vbr - + move.l #MBAR+1,%d0 movec.l %d0,%mbar @@ -39,7 +79,12 @@ start: lea MBAR,%a0 lea MBAR2,%a1 - + +#if defined(BOOTLOADER) && !defined(HAVE_DUALBOOT) \ + && (defined(IAUDIO_X5) || defined(IAUDIO_M5)) + move.l (%a1), %d7 /* store GPIO_READ result for button check in main() */ +#endif + clr.l (0x180,%a1) /* PLLCR = 0 */ /* 64K DMA-capable SRAM at 0x10000000 @@ -318,6 +363,10 @@ start: move.l %d0,(%a2)+ cmp.l %a2,%a4 bhi.b .mungeloop + +#if defined(BOOTLOADER) && (defined(IAUDIO_X5) || defined(IAUDIO_M5)) + move.l %d7, initial_gpio_read +#endif jsr main .hoo: diff --git a/firmware/target/coldfire/iaudio/boot.lds b/firmware/target/coldfire/iaudio/boot.lds index 4cd0e8eaab..9288a6c18b 100644 --- a/firmware/target/coldfire/iaudio/boot.lds +++ b/firmware/target/coldfire/iaudio/boot.lds @@ -14,8 +14,12 @@ STARTUP(target/coldfire/crt0.o) #define IRAMSIZE 0x18000 #endif #define DRAMORIG 0x31000000 +#ifdef HAVE_DUALBOOT +#define FLASHORIG 0x00150000 +#else #define FLASHORIG 0x00010000 -#define FLASHSIZE 4M +#endif +#define FLASHSIZE 4M - FLASHORIG MEMORY { |