forked from len0rd/rockbox
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
This commit is contained in:
parent
e9e0cf5908
commit
91ce4b2a60
7 changed files with 222 additions and 37 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue