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:
Jens Arnold 2011-06-19 17:23:18 +00:00
parent e9e0cf5908
commit 91ce4b2a60
7 changed files with 222 additions and 37 deletions

View file

@ -10,6 +10,7 @@
INCLUDES += -I$(APPSDIR)
SRC += $(call preprocess, $(APPSDIR)/SOURCES)
CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h
BOOTLDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds
BOOTLINK := $(BUILDDIR)/boot.link
@ -17,7 +18,7 @@ CLEANOBJS += $(BUILDDIR)/bootloader.*
.SECONDEXPANSION:
$(BOOTLINK): $(BOOTLDS)
$(BOOTLINK): $(BOOTLDS) $(CONFIGFILE)
$(call PRINTS,PP $(@F))
$(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))

View file

@ -123,6 +123,10 @@ void check_battery(void)
}
}
#if defined(IAUDIO_M5) || defined(IAUDIO_X5)
int initial_gpio_read;
#endif
void main(void)
{
int i;
@ -144,17 +148,13 @@ void main(void)
if ((GPIO_READ & 0x80000000) == 0)
rc_on_button = true;
#elif defined(IAUDIO_M5) || defined(IAUDIO_X5)
int data;
or_l(0x0e000000, &GPIO_FUNCTION); /* main Hold & Power, remote Play */
and_l(~0x0e000000, &GPIO_ENABLE);
data = GPIO_READ;
if ((data & 0x04000000) == 0)
if ((initial_gpio_read & 0x04000000) == 0)
on_button = true;
if ((data & 0x02000000) == 0)
if ((initial_gpio_read & 0x02000000) == 0)
rc_on_button = true;
#endif