[prev in list] [next in list] [prev in thread] [next in thread]
List: rockbox-cvs
Subject: xduoox3: Bootloader improvements:
From: rockbox-gerrit-noreply--- via rockbox-cvs <rockbox-cvs () cool ! haxx ! se>
Date: 2021-08-22 1:56:31
Message-ID: 202108220156.17M1uVcn3766468 () stuffed ! shaftnet ! org
[Download RAW message or body]
commit e07c460eef832fc4cfe22750ecf15db1ff2fc213
Author: Solomon Peachy <pizza@shaftnet.org>
Date: Sat Aug 21 21:25:01 2021 -0400
xduoox3: Bootloader improvements:
* Explicitly clear the caches prior to launching the binary
* Ensure the function that launches the binary is in iram
* Re-sequenced some of the subsystem initializations
* Fixes for USB mode
Change-Id: Ie020b18586b2599edeb88529dd3d7337e33a5a6f
diff --git a/bootloader/xduoox3.c b/bootloader/xduoox3.c
index d38639bfd4..330431f9c9 100644
--- a/bootloader/xduoox3.c
+++ b/bootloader/xduoox3.c
@@ -55,13 +55,18 @@ static void show_splash(int timeout, const char *msg)
sleep(timeout);
}
+static int usb_inited = 0;
+
static void usb_mode(void)
{
int button;
- /* Init USB */
- usb_init();
- usb_start_monitoring();
+ /* Init USB, but only once */
+ if (!usb_inited) {
+ usb_init();
+ usb_start_monitoring();
+ usb_inited = 1;
+ }
/* Wait for threads to connect */
show_splash(HZ/2, "Waiting for USB");
@@ -91,10 +96,20 @@ static void usb_mode(void)
}
#endif
+/* Jump to loaded binary */
+void exec(void* addr) __attribute__((noinline, noreturn, section(".icode")));
+
+void exec(void* addr)
+{
+ commit_discard_idcache();
+ typedef void(*entry_fn)(void) __attribute__((noreturn));
+ entry_fn fn = (entry_fn)addr;
+ fn();
+}
+
static int boot_rockbox(void)
{
int rc;
- void (*kernel_entry)(void);
printf("Mounting disk...\n");
@@ -103,7 +118,6 @@ static int boot_rockbox(void)
verbose = true;
#ifdef HAVE_BOOTLOADER_USB_MODE
error(EDISK, rc, false);
- usb_start_monitoring();
usb_mode();
#else
error(EDISK, rc, true);
@@ -118,11 +132,8 @@ static int boot_rockbox(void)
{
printf("Starting Rockbox...\n");
adc_close(); /* Disable SADC, seems to fix the re-init Rockbox does */
-
disable_interrupt();
- kernel_entry = (void*) CONFIG_SDRAM_START;
- kernel_entry();
-
+ exec((void*) CONFIG_SDRAM_START);
return 0; /* Shouldn't happen */
}
}
@@ -152,13 +163,13 @@ int main(void)
serial_puts("\n\nSPL Stage 2\n\n");
+ system_init();
kernel_init();
+
lcd_init();
font_init();
lcd_setfont(FONT_SYSFIXED);
- button_init();
backlight_init();
-
show_logo();
rc = storage_init();
@@ -170,23 +181,20 @@ int main(void)
filesystem_init();
+ /* Don't mount the disks yet, there could be file system/partition errors
+ which are fixable in USB mode */
+
#ifdef HAVE_BOOTLOADER_USB_MODE
- button_init_device();
+ button_init();
int btn = button_read_device();
- usb_init();
-
/* Enter USB mode if USB is plugged and PLAY button is pressed */
if(btn & BUTTON_PLAY) {
- usb_start_monitoring();
if(usb_detect() == USB_INSERTED)
usb_mode();
}
#endif /* HAVE_BOOTLOADER_USB_MODE */
- /* Don't mount the disks yet, there could be file system/partition errors
- which are fixable in USB mode */
-
reset_screen();
printf(MODEL_NAME" Rockbox Bootloader\n");
_______________________________________________
rockbox-cvs mailing list
rockbox-cvs@cool.haxx.se
https://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic