summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-07-17 14:30:42 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-07-17 14:30:42 +0000
commitcf9935d6362dd52e4b2f33dd19fff0a0860814d7 (patch)
tree1530a9450d78768077798bd756fbfa67ea1efb12 /bootloader
parent1dc0c46d930d8e59902e9b3ce92aab21a5311d78 (diff)
downloadrockbox-cf9935d6362dd52e4b2f33dd19fff0a0860814d7.tar.gz
rockbox-cf9935d6362dd52e4b2f33dd19fff0a0860814d7.tar.bz2
rockbox-cf9935d6362dd52e4b2f33dd19fff0a0860814d7.zip
Onda VX747: add dual-boot capability + make it possible to permanently 'stick' Rockbox to your DAP
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21919 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/SOURCES1
-rw-r--r--bootloader/common.c3
-rwxr-xr-xbootloader/ondavx747.c73
3 files changed, 67 insertions, 10 deletions
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index d36479c4ee..42f3f577cf 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -44,6 +44,7 @@ meizu_m6sp.c
meizu_m3.c
#elif defined(ONDA_VX747) || defined(ONDA_VX747P) || defined(ONDA_VX767) || defined(ONDA_VX777)
ondavx747.c
+show_logo.c
#elif defined(CREATIVE_ZVx)
creativezvm.c
#elif CONFIG_CPU==AS3525
diff --git a/bootloader/common.c b/bootloader/common.c
index 4ac421d872..f7ab661ca2 100644
--- a/bootloader/common.c
+++ b/bootloader/common.c
@@ -40,7 +40,8 @@
#if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined(IRIVER_H10_5GB) \
|| defined(SANSA_E200) || defined(SANSA_C200) || defined(GIGABEAT_F) \
|| defined(PHILIPS_SA9200) || (CONFIG_CPU == AS3525) || defined(COWON_D2) \
- || defined(MROBE_100) || defined(PHILIPS_HDD1630) || defined(MROBE_500)
+ || defined(MROBE_100) || defined(PHILIPS_HDD1630) || defined(MROBE_500) \
+ || defined(ONDA_VX747)
bool verbose = false;
#else
bool verbose = true;
diff --git a/bootloader/ondavx747.c b/bootloader/ondavx747.c
index 6a04c1ba85..3767005ebe 100755
--- a/bootloader/ondavx747.c
+++ b/bootloader/ondavx747.c
@@ -34,6 +34,8 @@
#include "string.h"
#include "adc.h"
+extern int show_logo(void);
+
static void show_splash(int timeout, const char *msg)
{
reset_screen();
@@ -84,9 +86,52 @@ static void usb_mode(void)
reset_screen();
}
-static void boot_of(void)
+static int boot_of(void)
{
- /* Do nothing atm */
+ int fd, rc, len, i, checksum = 0;
+ void (*kernel_entry)(int, void*, void*);
+
+ /* TODO: get this from the NAND flash instead of SD */
+ fd = open("/ccpmp.bin", O_RDONLY);
+ if(fd < 0)
+ return EFILE_NOT_FOUND;
+
+ lseek(fd, 4, SEEK_SET);
+ rc = read(fd, (char*)&len, 4); /* CPU is LE */
+ if(rc < 4)
+ return EREAD_IMAGE_FAILED;
+
+ len += 8;
+ printf("Reading %d bytes...", len);
+
+ lseek(fd, 0, SEEK_SET);
+ rc = read(fd, (void*)0x80004000, len);
+ if(rc < len)
+ return EREAD_IMAGE_FAILED;
+
+ close(fd);
+
+ for(i=0; i<len; i++)
+ checksum += ((unsigned char*)0x80004000)[i];
+
+ *((unsigned int*)0x80004000) = checksum;
+
+ printf("Starting the OF...");
+
+ /* OF requires all clocks on */
+ __cpm_start_all();
+
+ disable_interrupt();
+ __dcache_writeback_all();
+ __icache_invalidate_all();
+
+ for(i=8000; i>0; i--)
+ asm volatile("nop\n");
+
+ kernel_entry = (void*) 0x80004008;
+ kernel_entry(0, "Jan 10 2008", "15:34:42"); /* Reversed from the SPL */
+
+ return 0;
}
int main(void)
@@ -102,12 +147,9 @@ int main(void)
font_init();
lcd_setfont(FONT_SYSFIXED);
button_init();
- adc_init();
backlight_init();
- reset_screen();
- printf(MODEL_NAME" Rockbox Bootloader");
- printf("Version "APPSVERSION);
+ show_logo();
rc = storage_init();
if(rc)
@@ -119,15 +161,28 @@ int main(void)
rc = button_read_device();
#endif
+ if(rc)
+ verbose = true;
+
if(rc & BUTTON_VOL_UP)
usb_mode();
- else if(button_hold())
- boot_of();
+
+ if(verbose)
+ reset_screen();
+ printf(MODEL_NAME" Rockbox Bootloader");
+ printf("Version "APPSVERSION);
rc = disk_mount_all();
if (rc <= 0)
error(EDISK,rc);
+ if(button_hold())
+ {
+ rc = boot_of();
+ if(rc < 0)
+ printf("Error: %s", strerror(rc));
+ }
+
printf("Loading firmware");
rc = load_firmware((unsigned char *)CONFIG_SDRAM_START, BOOTFILE, 0x400000);
if(rc < 0)
@@ -136,7 +191,7 @@ int main(void)
if (rc == EOK)
{
printf("Starting Rockbox...");
- adc_close(); /* Disable SADC */
+ adc_close(); /* Disable SADC */
_backlight_off(); /* Force backlight off to prevent LCD 'flicker' */
disable_interrupt();