summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-27 15:40:29 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-27 15:40:29 +0000
commitc2ca8c710c9841892ca8123e39d2acdf0a0e5de3 (patch)
tree3559f4629701ad4ce7b0142bb3160a2a96ea92c1
parent1dff29a9d6780c2fd10ac1ad32929cb6808c0936 (diff)
downloadrockbox-c2ca8c710c9841892ca8123e39d2acdf0a0e5de3.zip
rockbox-c2ca8c710c9841892ca8123e39d2acdf0a0e5de3.tar.gz
rockbox-c2ca8c710c9841892ca8123e39d2acdf0a0e5de3.tar.bz2
rockbox-c2ca8c710c9841892ca8123e39d2acdf0a0e5de3.tar.xz
* 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
-rw-r--r--bootloader/gigabeat-s.c50
-rw-r--r--firmware/app.lds2
-rw-r--r--firmware/common/disk.c7
-rw-r--r--firmware/export/config-gigabeat-s.h2
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/system-target.h2
5 files changed, 51 insertions, 12 deletions
diff --git a/bootloader/gigabeat-s.c b/bootloader/gigabeat-s.c
index 25b9ab5..d692dcb 100644
--- a/bootloader/gigabeat-s.c
+++ b/bootloader/gigabeat-s.c
@@ -28,6 +28,7 @@
#include "kernel.h"
#include "thread.h"
#include "ata.h"
+#include "dir.h"
#include "fat.h"
#include "disk.h"
#include "font.h"
@@ -47,13 +48,18 @@
#include <stdarg.h>
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)
{
lcd_clear_display();
printf("Hello world!");
- printf("Gigabeat S Rockbox Bootloader v.00000001");
+ printf("Gigabeat S Rockbox Bootloader v.00000001");
kernel_init();
+ printf("kernel init done");
int rc;
rc = ata_init();
@@ -62,8 +68,10 @@ void main(void)
reset_screen();
error(EATA, rc);
}
+ printf("ata init done");
disk_init();
+ printf("disk init done");
rc = disk_mount_all();
if (rc<=0)
@@ -71,24 +79,48 @@ void main(void)
error(EDISK,rc);
}
- printf("Congratulations!");
- while(1);
+ /* Look for the first valid firmware file */
+ 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");
- loadbuffer = (unsigned char*) 0x100;
- buffer_size = (unsigned char*)0x400000 - loadbuffer;
+ unsigned char *loadbuffer = (unsigned char *)0x88000000;
+ int buffer_size = 1024*1024;
- rc = load_firmware(loadbuffer, BOOTFILE, buffer_size);
+ rc = load_firmware(loadbuffer, buf, buffer_size);
if(rc < 0)
- error(EBOOTFILE, rc);
+ error(buf, rc);
if (rc == EOK)
{
kernel_entry = (void*) loadbuffer;
rc = kernel_entry();
}
-#endif
+
+ while (1);
}
diff --git a/firmware/app.lds b/firmware/app.lds
index d88ce9f..87f3d2a 100644
--- a/firmware/app.lds
+++ b/firmware/app.lds
@@ -70,7 +70,7 @@ INPUT(target/sh/crt0.o)
#define IRAMORIG 0x00000000
#define IRAMSIZE 0x4000
#elif CONFIG_CPU==IMX31L
-#define DRAMORIG (0x80000000 + STUBOFFSET)
+#define DRAMORIG (0x88000000 + STUBOFFSET)
#define IRAMORIG 0x1FFFC000
#define IRAMSIZE 0x4000
#else
diff --git a/firmware/common/disk.c b/firmware/common/disk.c
index 563bb05..e3cf839 100644
--- a/firmware/common/disk.c
+++ b/firmware/common/disk.c
@@ -150,7 +150,12 @@ int disk_mount(int drive)
/* 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
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
int j;
diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h
index 285b381..c6de206 100644
--- a/firmware/export/config-gigabeat-s.h
+++ b/firmware/export/config-gigabeat-s.h
@@ -6,7 +6,7 @@
#define TOSHIBA_GIGABEAT_S 1
/* For Rolo and boot loader */
-#define MODEL_NUMBER 19
+#define MODEL_NUMBER 21
/* define this if you have a bitmap LCD display */
#define HAVE_LCD_BITMAP
diff --git a/firmware/target/arm/imx31/gigabeat-s/system-target.h b/firmware/target/arm/imx31/gigabeat-s/system-target.h
index b1803d0..e87b93b 100644
--- a/firmware/target/arm/imx31/gigabeat-s/system-target.h
+++ b/firmware/target/arm/imx31/gigabeat-s/system-target.h
@@ -30,6 +30,8 @@ static inline void udelay(unsigned int usecs)
while (EPITCNT1 > stop);
}
+#define __dbg_hw_info(...) 0
+#define __dbg_ports(...) 0
#define HAVE_INVALIDATE_ICACHE
static inline void invalidate_icache(void)