summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Purchase <shotofadds@rockbox.org>2008-03-12 20:57:19 +0000
committerRob Purchase <shotofadds@rockbox.org>2008-03-12 20:57:19 +0000
commitc8836112c6f88298f7d43eab0e83e05ca87eaf91 (patch)
treeb5ba6773db6d8160a89d751f1cadf773dcca9160
parent769fcbd4d9425d0de1fa1628acdce1a2ffbdcd98 (diff)
downloadrockbox-c8836112c6f88298f7d43eab0e83e05ca87eaf91.zip
rockbox-c8836112c6f88298f7d43eab0e83e05ca87eaf91.tar.gz
rockbox-c8836112c6f88298f7d43eab0e83e05ca87eaf91.tar.bz2
rockbox-c8836112c6f88298f7d43eab0e83e05ca87eaf91.tar.xz
Cowon D2: Make the bootloader functional (usage instructions to appear on the CowonD2Info wikipage shortly). Also re-enable IRAM by reducing Tremor's ICODE usage.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16646 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/telechips.c55
-rw-r--r--firmware/export/config-cowond2.h6
-rw-r--r--firmware/export/config.h2
3 files changed, 33 insertions, 30 deletions
diff --git a/bootloader/telechips.c b/bootloader/telechips.c
index dcb0c48..8d2e369 100644
--- a/bootloader/telechips.c
+++ b/bootloader/telechips.c
@@ -43,12 +43,15 @@
#if defined(COWON_D2)
#include "i2c.h"
+#define LOAD_ADDRESS 0x20000000 /* DRAM_START */
#endif
char version[] = APPSVERSION;
extern int line;
+#define MAX_LOAD_SIZE (8*1024*1024) /* Arbitrary, but plenty. */
+
void* main(void)
{
int button;
@@ -56,9 +59,9 @@ void* main(void)
int count = 0;
bool do_power_off = false;
-#if defined(COWON_D2)
- int i,rc,fd,len;
- int* buf = (int*)0x21000000; /* Unused DRAM */
+#if defined(COWON_D2) && defined(TCCBOOT)
+ int rc;
+ unsigned char* loadbuffer = (unsigned char*)LOAD_ADDRESS;
#endif
power_init();
@@ -78,7 +81,12 @@ void* main(void)
_backlight_on();
-#if defined(COWON_D2)
+/* Only load the firmware if TCCBOOT is defined - this ensures SDRAM_START is
+ available for loading the firmware. Otherwise display the debug screen. */
+#if defined(COWON_D2) && defined(TCCBOOT)
+ printf("Rockbox boot loader");
+ printf("Version %s", version);
+
printf("ATA");
rc = ata_init();
if(rc)
@@ -94,36 +102,20 @@ void* main(void)
error(EDISK,rc);
}
-#if 0
- printf("opening test file...");
+ rc = load_firmware(loadbuffer, BOOTFILE, MAX_LOAD_SIZE);
- fd = open("/test.bin", O_RDONLY);
- if (fd < 0) panicf("could not open test file");
-
- len = filesize(fd);
- printf("Length: %x", len);
-
- lseek(fd, 0, SEEK_SET);
- read(fd, buf, len);
- close(fd);
-
- printf("testing contents...");
-
- i = 0;
- while (buf[i] == i && i<(len/4)) { i++; }
-
- if (i < len/4)
+ if (rc < 0)
{
- printf("mismatch at %x [0x%x]", i, buf[i]);
+ error(EBOOTFILE,rc);
}
- else
+ else if (rc == EOK)
{
- printf("passed!");
+ int(*kernel_entry)(void);
+
+ kernel_entry = (void*) loadbuffer;
+ rc = kernel_entry();
}
- while (!button_read_device()) {};
- while (button_read_device()) {};
-#endif
-#endif
+#else
while(!do_power_off) {
line = 0;
@@ -145,6 +137,8 @@ void* main(void)
printf("Btn: 0x%08x",button);
#if defined(COWON_D2)
+ int i;
+
printf("GPIOA: 0x%08x",GPIOA);
printf("GPIOB: 0x%08x",GPIOB);
printf("GPIOC: 0x%08x",GPIOC);
@@ -195,6 +189,9 @@ void* main(void)
/* Power-off */
power_off();
+ printf("(NOT) POWERED OFF");
+#endif
+
return 0;
}
diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h
index 78b963c..9363f67 100644
--- a/firmware/export/config-cowond2.h
+++ b/firmware/export/config-cowond2.h
@@ -6,6 +6,9 @@
/* For Rolo and boot loader */
#define MODEL_NUMBER 24
+/* Produce a dual-boot bootloader.bin for mktccboot */
+#define TCCBOOT
+
/* define this if you have recording possibility */
//#define HAVE_RECORDING
@@ -63,6 +66,9 @@
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
+/* Reduce Tremor's ICODE usage */
+#define ICODE_ATTR_TREMOR_NOT_MDCT
+
/* The number of bytes reserved for loadable codecs */
#define CODEC_SIZE 0x80000
diff --git a/firmware/export/config.h b/firmware/export/config.h
index e1c0cbc..6a04504 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -400,7 +400,7 @@
defined(CPU_COLDFIRE) || /* Coldfire: core, plugins, codecs */ \
defined(CPU_PP) || /* PortalPlayer: core, plugins, codecs */ \
defined(CPU_TCC77X) || /* Telechips: core, plugins, codecs */ \
- /*defined(CPU_TCC780X) || /. Telechips: core, plugins, codecs */ \
+ defined(CPU_TCC780X) || /* Telechips: core, plugins, codecs */ \
(CONFIG_CPU == PNX0101))
#define ICODE_ATTR __attribute__ ((section(".icode")))
#define ICONST_ATTR __attribute__ ((section(".irodata")))