summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-07-20 22:54:04 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-07-20 22:54:04 +0000
commit69697aefe84f3e576daad595259a8dd16b00ea99 (patch)
tree523a7af43c480663a4acafd8ddb03be0f5100693
parent0258287e57d38499e8d78fd28bd17c60cc51323a (diff)
downloadrockbox-69697aefe84f3e576daad595259a8dd16b00ea99.tar.gz
rockbox-69697aefe84f3e576daad595259a8dd16b00ea99.zip
Added a check to prevent the flash plugins being used (and crashing) if Rockbox runs directly in flash ROM. (You need to RoLo a .ajz before re-flashing.)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4906 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/firmware_flash.c14
-rw-r--r--apps/plugins/rockbox_flash.c14
2 files changed, 28 insertions, 0 deletions
diff --git a/apps/plugins/firmware_flash.c b/apps/plugins/firmware_flash.c
index 7353a3e8c6..8f7f187607 100644
--- a/apps/plugins/firmware_flash.c
+++ b/apps/plugins/firmware_flash.c
@@ -608,6 +608,13 @@ void DoUserDialog(char* filename)
rb->lcd_setfont(FONT_SYSFIXED);
+ /* this can only work if Rockbox runs in DRAM, not flash ROM */
+ if ((UINT8*)rb >= FB && (UINT8*)rb < FB + 4096*1024) /* 4 MB max */
+ { /* we're running from flash */
+ rb->splash(HZ*3, true, "Not from ROM");
+ return; /* exit */
+ }
+
/* test if the user is running the correct plugin for this box */
if (!CheckPlatform(PLATFORM_ID, *(UINT16*)(FB + VERSION_ADR)))
{
@@ -829,6 +836,13 @@ void DoUserDialog(char* filename)
tCheckROM result;
bool is_romless;
+ /* this can only work if Rockbox runs in DRAM, not flash ROM */
+ if ((UINT8*)rb >= FB && (UINT8*)rb < FB + 4096*1024) /* 4 MB max */
+ { /* we're running from flash */
+ rb->splash(HZ*3, true, "Not from ROM");
+ return; /* exit */
+ }
+
/* test if the user is running the correct plugin for this box */
if (!CheckPlatform(PLATFORM_ID, *(UINT16*)(FB + VERSION_ADR)))
{
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c
index 25a97ea25c..3bb8476b43 100644
--- a/apps/plugins/rockbox_flash.c
+++ b/apps/plugins/rockbox_flash.c
@@ -603,6 +603,13 @@ void DoUserDialog(char* filename, bool show_greet)
rb->lcd_setfont(FONT_SYSFIXED);
+ /* this can only work if Rockbox runs in DRAM, not flash ROM */
+ if ((UINT8*)rb >= FB && (UINT8*)rb < FB + 4096*1024) /* 4 MB max */
+ { /* we're running from flash */
+ rb->splash(HZ*3, true, "Not from ROM");
+ return; /* exit */
+ }
+
/* "allocate" memory */
sector = rb->plugin_get_buffer(&memleft);
if (memleft < SECTORSIZE) /* need buffer for a flash sector */
@@ -801,6 +808,13 @@ void DoUserDialog(char* filename, bool show_greet)
int memleft;
UINT32 crc;
+ /* this can only work if Rockbox runs in DRAM, not flash ROM */
+ if ((UINT8*)rb >= FB && (UINT8*)rb < FB + 4096*1024) /* 4 MB max */
+ { /* we're running from flash */
+ rb->splash(HZ*3, true, "Not from ROM");
+ return; /* exit */
+ }
+
/* "allocate" memory */
sector = rb->plugin_get_buffer(&memleft);
if (memleft < SECTORSIZE) /* need buffer for a flash sector */