forked from len0rd/rockbox
* Make the Gigabeat S bootloader a bit more interesting: it looks for the first firmware file it finds on the second partition and attempts to load it. Loading fails to get past the splash screen though.
* Make the main binary compile. To send a firmware file, use mtp-sendfile. To update you'll need to delete the previous firmware file, as files are named sequentially and the first one is loaded. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15836 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1dff29a9d6
commit
c2ca8c710c
5 changed files with 51 additions and 12 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
|
#include "dir.h"
|
||||||
#include "fat.h"
|
#include "fat.h"
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
@ -47,13 +48,18 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
char version[] = APPSVERSION;
|
char version[] = APPSVERSION;
|
||||||
|
char buf[MAX_PATH];
|
||||||
|
char basedir[] = "/Content/0b00/00/"; /* Where files sent via MTP are stored */
|
||||||
|
char model[5];
|
||||||
|
int (*kernel_entry)(void);
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
printf("Hello world!");
|
printf("Hello world!");
|
||||||
printf("Gigabeat S Rockbox Bootloader v.00000001");
|
printf("Gigabeat S Rockbox Bootloader v.00000001");
|
||||||
kernel_init();
|
kernel_init();
|
||||||
|
printf("kernel init done");
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = ata_init();
|
rc = ata_init();
|
||||||
|
@ -62,8 +68,10 @@ void main(void)
|
||||||
reset_screen();
|
reset_screen();
|
||||||
error(EATA, rc);
|
error(EATA, rc);
|
||||||
}
|
}
|
||||||
|
printf("ata init done");
|
||||||
|
|
||||||
disk_init();
|
disk_init();
|
||||||
|
printf("disk init done");
|
||||||
|
|
||||||
rc = disk_mount_all();
|
rc = disk_mount_all();
|
||||||
if (rc<=0)
|
if (rc<=0)
|
||||||
|
@ -71,24 +79,48 @@ void main(void)
|
||||||
error(EDISK,rc);
|
error(EDISK,rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Congratulations!");
|
/* Look for the first valid firmware file */
|
||||||
while(1);
|
struct dirent_uncached* entry;
|
||||||
|
DIR_UNCACHED* dir;
|
||||||
|
int fd;
|
||||||
|
dir = opendir_uncached(basedir);
|
||||||
|
while ((entry = readdir_uncached(dir)))
|
||||||
|
{
|
||||||
|
if (*entry->d_name != '.')
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s%s", basedir, entry->d_name);
|
||||||
|
fd = open(buf, O_RDONLY);
|
||||||
|
if (fd >= 0)
|
||||||
|
{
|
||||||
|
lseek(fd, 4, SEEK_SET);
|
||||||
|
rc = read(fd, model, 4);
|
||||||
|
close(fd);
|
||||||
|
if (rc == 4)
|
||||||
|
{
|
||||||
|
model[4] = 0;
|
||||||
|
if (strcmp(model, "gigs") == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
printf("Firmware file: %s", buf);
|
||||||
printf("Loading firmware");
|
printf("Loading firmware");
|
||||||
|
|
||||||
loadbuffer = (unsigned char*) 0x100;
|
unsigned char *loadbuffer = (unsigned char *)0x88000000;
|
||||||
buffer_size = (unsigned char*)0x400000 - loadbuffer;
|
int buffer_size = 1024*1024;
|
||||||
|
|
||||||
rc = load_firmware(loadbuffer, BOOTFILE, buffer_size);
|
rc = load_firmware(loadbuffer, buf, buffer_size);
|
||||||
if(rc < 0)
|
if(rc < 0)
|
||||||
error(EBOOTFILE, rc);
|
error(buf, rc);
|
||||||
|
|
||||||
if (rc == EOK)
|
if (rc == EOK)
|
||||||
{
|
{
|
||||||
kernel_entry = (void*) loadbuffer;
|
kernel_entry = (void*) loadbuffer;
|
||||||
rc = kernel_entry();
|
rc = kernel_entry();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ INPUT(target/sh/crt0.o)
|
||||||
#define IRAMORIG 0x00000000
|
#define IRAMORIG 0x00000000
|
||||||
#define IRAMSIZE 0x4000
|
#define IRAMSIZE 0x4000
|
||||||
#elif CONFIG_CPU==IMX31L
|
#elif CONFIG_CPU==IMX31L
|
||||||
#define DRAMORIG (0x80000000 + STUBOFFSET)
|
#define DRAMORIG (0x88000000 + STUBOFFSET)
|
||||||
#define IRAMORIG 0x1FFFC000
|
#define IRAMORIG 0x1FFFC000
|
||||||
#define IRAMSIZE 0x4000
|
#define IRAMSIZE 0x4000
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -150,7 +150,12 @@ int disk_mount(int drive)
|
||||||
/* The Elio's hard drive has no partition table and probing for partitions causes
|
/* The Elio's hard drive has no partition table and probing for partitions causes
|
||||||
Rockbox to crash - so we temporarily disable the probing until we fix the
|
Rockbox to crash - so we temporarily disable the probing until we fix the
|
||||||
real problem. */
|
real problem. */
|
||||||
for (i=0; volume != -1 && i<4; i++)
|
#ifdef TOSHIBA_GIGABEAT_S
|
||||||
|
i = 1; /* For the Gigabeat S, we mount the second partition */
|
||||||
|
#else
|
||||||
|
i = 0;
|
||||||
|
#endif
|
||||||
|
for (i; volume != -1 && i<4; i++)
|
||||||
{
|
{
|
||||||
#ifdef MAX_LOG_SECTOR_SIZE
|
#ifdef MAX_LOG_SECTOR_SIZE
|
||||||
int j;
|
int j;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#define TOSHIBA_GIGABEAT_S 1
|
#define TOSHIBA_GIGABEAT_S 1
|
||||||
|
|
||||||
/* For Rolo and boot loader */
|
/* For Rolo and boot loader */
|
||||||
#define MODEL_NUMBER 19
|
#define MODEL_NUMBER 21
|
||||||
|
|
||||||
/* define this if you have a bitmap LCD display */
|
/* define this if you have a bitmap LCD display */
|
||||||
#define HAVE_LCD_BITMAP
|
#define HAVE_LCD_BITMAP
|
||||||
|
|
|
@ -30,6 +30,8 @@ static inline void udelay(unsigned int usecs)
|
||||||
while (EPITCNT1 > stop);
|
while (EPITCNT1 > stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define __dbg_hw_info(...) 0
|
||||||
|
#define __dbg_ports(...) 0
|
||||||
|
|
||||||
#define HAVE_INVALIDATE_ICACHE
|
#define HAVE_INVALIDATE_ICACHE
|
||||||
static inline void invalidate_icache(void)
|
static inline void invalidate_icache(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue