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
This commit is contained in:
Maurus Cuelenaere 2009-07-17 14:30:42 +00:00
parent 1dc0c46d93
commit cf9935d636
8 changed files with 146 additions and 24 deletions

View file

@ -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

View file

@ -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;

View file

@ -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();

View file

@ -81,8 +81,13 @@
/* LCD dimensions */
#define CONFIG_LCD LCD_ONDAVX747
#ifdef BOOTLOADER /* OF requires landscape */
#define LCD_WIDTH 400
#define LCD_HEIGHT 240
#else
#define LCD_WIDTH 240
#define LCD_HEIGHT 400
#endif
#define LCD_DEPTH 16 /* 16bit colours */
#define LCD_PIXELFORMAT RGB565 /* rgb565 */

View file

@ -8,7 +8,7 @@ STARTUP(target/mips/ingenic_jz47xx/crt0.o)
#define DRAMSIZE ((MEMORYSIZE-4) * 0x100000)
#define DRAMORIG 0x80404000
#define DRAMORIG 0x80E04000
#define IRAMORIG 0x80000000
#define IRAMSIZE 16K

View file

@ -50,12 +50,12 @@
.set noat
#ifdef BOOTLOADER
/* These will get filled in scramble */
.word 0 /* Unknown */
/* These will get filled in by scramble */
.word 0 /* Empty */
.word 0 /* Filesize */
/* Relocate bootloader */
la t0, (_loadaddress-0x400000)
la t0, (_loadaddress-0xE00000)
la t1, _loadaddress
la t2, _bootend
_relocate_loop:

16
tools/configure vendored
View file

@ -2105,8 +2105,8 @@ fi
plugins="yes"
swcodec="yes"
toolset=$genericbitmaptools
boottool="cp"
bootoutput="rockboot.vx747"
boottool="$rootdir/tools/scramble -ccpmp"
bootoutput="ccpmp.bin"
# architecture, manufacturer and model for the target-tree build
t_cpu="mips"
t_manufacturer="ingenic_jz47xx"
@ -2127,8 +2127,8 @@ fi
plugins="" #FIXME
swcodec="yes"
toolset=$genericbitmaptools
boottool="cp"
bootoutput="rockboot.vx767"
boottool="$rootdir/tools/scramble -ccpmp"
bootoutput="ccpmp.bin"
# architecture, manufacturer and model for the target-tree build
t_cpu="mips"
t_manufacturer="ingenic_jz47xx"
@ -2149,8 +2149,8 @@ fi
plugins="yes"
swcodec="yes"
toolset=$genericbitmaptools
boottool="cp"
bootoutput="rockboot.vx747p"
boottool="$rootdir/tools/scramble -ccpmp"
bootoutput="ccpmp.bin"
# architecture, manufacturer and model for the target-tree build
t_cpu="mips"
t_manufacturer="ingenic_jz47xx"
@ -2171,8 +2171,8 @@ fi
plugins="" #TODO
swcodec="yes"
toolset=$genericbitmaptools
boottool="cp"
bootoutput="rockboot.vx777"
boottool="$rootdir/tools/scramble -ccpmp"
bootoutput="ccpmp.bin"
# architecture, manufacturer and model for the target-tree build
t_cpu="mips"
t_manufacturer="ingenic_jz47xx"

View file

@ -33,6 +33,7 @@
int iaudio_encode(char *iname, char *oname, char *idstring);
int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc);
int ccpmp_encode(char *iname, char *oname);
enum
{
@ -375,8 +376,7 @@ int main (int argc, char** argv)
oname = argv[3];
return ipod_encode(iname, oname, 3, true); /* Firmware image v3 */
}
else if(!strncmp(argv[1], "-creative=", 10))
{
else if(!strncmp(argv[1], "-creative=", 10)) {
if(!strcmp(argv[2], "-no-ciff"))
{
creative_enable_ciff = false;
@ -405,6 +405,11 @@ int main (int argc, char** argv)
return 2;
}
}
else if(!strcmp(argv[1], "-ccpmp")) {
iname = argv[2];
oname = argv[3];
return ccpmp_encode(iname, oname);
}
else if(!strncmp(argv[1], "-mi4", 4)) {
int mi4magic;
char model[4] = "";
@ -824,3 +829,58 @@ int ipod_encode(char *iname, char *oname, int fw_ver, bool fake_rsrc)
return 0;
}
#define CCPMP_SIZE 0x500000
int ccpmp_encode(char *iname, char *oname)
{
size_t len;
int length;
FILE *file;
unsigned char *outbuf;
file = fopen(iname, "rb");
if (!file) {
perror(iname);
return -1;
}
fseek(file,0,SEEK_END);
length = ftell(file);
fseek(file,0,SEEK_SET);
outbuf = malloc(CCPMP_SIZE);
if ( !outbuf ) {
printf("out of memory!\n");
return -1;
}
len = fread(outbuf, 1, length, file);
if(len < (size_t)length) {
perror(iname);
return -2;
}
fclose(file);
/* Clear the tail area to 0xFF */
memset(&outbuf[length], 0xFF, CCPMP_SIZE - length);
/* Header */
int2le(length, &outbuf[0x4]);
file = fopen(oname, "wb");
if (!file) {
perror(oname);
return -3;
}
len = fwrite(outbuf, 1, CCPMP_SIZE, file);
if(len < (size_t)length) {
perror(oname);
return -4;
}
fclose(file);
return 0;
}