summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2007-01-12 18:34:00 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2007-01-12 18:34:00 +0000
commit0ea4d3197ed7e56f39c630741cb69152ac9e41de (patch)
treebc29ccef30da139df3e928fd3b8ff3801407b58c
parent12ef310466937551dbedb2165769d7832b11156c (diff)
downloadrockbox-0ea4d3197ed7e56f39c630741cb69152ac9e41de.tar.gz
rockbox-0ea4d3197ed7e56f39c630741cb69152ac9e41de.zip
Prepare core support for the iriver bootloader supporting ROM images
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11991 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugin.c7
-rw-r--r--apps/plugin.h9
-rw-r--r--apps/plugins/iriver_flash.c93
-rw-r--r--firmware/eeprom_settings.c8
-rw-r--r--firmware/export/config-h120.h5
-rw-r--r--firmware/export/eeprom_settings.h13
-rw-r--r--firmware/export/system.h4
-rw-r--r--firmware/system.c35
-rw-r--r--firmware/target/coldfire/crt0.S58
9 files changed, 178 insertions, 54 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index c2b697fe0b..250b4cc545 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -487,6 +487,13 @@ static const struct plugin_api rockbox_api = {
487 pcm_record_more, 487 pcm_record_more,
488#endif 488#endif
489 create_thread_on_core, 489 create_thread_on_core,
490
491#ifdef IRIVER_H100_SERIES
492 /* Routines for the iriver_flash -plugin. */
493 detect_original_firmware,
494 detect_flashed_ramimage,
495 detect_flashed_romimage,
496#endif
490}; 497};
491 498
492int plugin_load(const char* plugin, void* parameter) 499int plugin_load(const char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 16781de0c1..b2d894f0ee 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -602,11 +602,18 @@ struct plugin_api {
602 int (*sound_default)(int setting); 602 int (*sound_default)(int setting);
603 void (*pcm_record_more)(void *start, size_t size); 603 void (*pcm_record_more)(void *start, size_t size);
604#endif 604#endif
605 605
606 struct thread_entry*(*create_thread_on_core)( 606 struct thread_entry*(*create_thread_on_core)(
607 unsigned int core, void (*function)(void), 607 unsigned int core, void (*function)(void),
608 void* stack, int stack_size, 608 void* stack, int stack_size,
609 const char *name IF_PRIO(, int priority)); 609 const char *name IF_PRIO(, int priority));
610
611#ifdef IRIVER_H100_SERIES
612 /* Routines for the iriver_flash -plugin. */
613 bool (*detect_original_firmware)(void);
614 bool (*detect_flashed_ramimage)(void);
615 bool (*detect_flashed_romimage)(void);
616#endif
610}; 617};
611 618
612/* plugin header */ 619/* plugin header */
diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c
index 590622f6d2..44bd9c7f66 100644
--- a/apps/plugins/iriver_flash.c
+++ b/apps/plugins/iriver_flash.c
@@ -59,6 +59,10 @@ static struct plugin_api* rb; /* here is a global api struct pointer */
59#ifdef IRIVER_H100_SERIES 59#ifdef IRIVER_H100_SERIES
60#define SEC_SIZE 4096 60#define SEC_SIZE 4096
61#define BOOTLOADER_ERASEGUARD (BOOTLOADER_ENTRYPOINT / SEC_SIZE) 61#define BOOTLOADER_ERASEGUARD (BOOTLOADER_ENTRYPOINT / SEC_SIZE)
62enum sections {
63 SECT_RAMIMAGE = 1,
64 SECT_ROMIMAGE = 2,
65};
62 66
63static volatile uint16_t* FB = (uint16_t*)0x00000000; /* Flash base address */ 67static volatile uint16_t* FB = (uint16_t*)0x00000000; /* Flash base address */
64#endif 68#endif
@@ -338,23 +342,9 @@ int load_firmware_file(const char *filename, uint32_t *checksum)
338 return len; 342 return len;
339} 343}
340 344
341bool detect_flashed_rockbox(void)
342{
343 struct flash_header hdr;
344 uint8_t *src = (uint8_t *)FLASH_ENTRYPOINT;
345
346 rb->memcpy(&hdr, src, sizeof(struct flash_header));
347
348 if (hdr.magic != FLASH_MAGIC)
349 return false;
350
351 return true;
352}
353
354unsigned long valid_bootloaders[][2] = { 345unsigned long valid_bootloaders[][2] = {
355 /* Size-8 CRC32 */ 346 /* Size-8 CRC32 */
356 { 62332, 0x77395351 }, /* Pre-release v7 */ 347 { 63844, 0x98c5027a }, /* 7-pre3, improved failsafe functions */
357 { 63340, 0xc41857b6 }, /* Pre-release v7, fixed crash unless firmware found. */
358 { 0, 0 } 348 { 0, 0 }
359}; 349};
360 350
@@ -378,15 +368,28 @@ bool detect_valid_bootloader(const unsigned char *addr, int len)
378 return false; 368 return false;
379} 369}
380 370
381int flash_rockbox(const char *filename) 371static int get_section_address(int section)
372{
373 if (section == SECT_RAMIMAGE)
374 return FLASH_RAMIMAGE_ENTRY;
375 else if (section == SECT_ROMIMAGE)
376 return FLASH_ROMIMAGE_ENTRY;
377 else
378 return -1;
379}
380
381int flash_rockbox(const char *filename, int section)
382{ 382{
383 struct flash_header hdr; 383 struct flash_header hdr;
384 char buf[32]; 384 char buf[64];
385 int pos, i, len, rc; 385 int pos, i, len, rc;
386 unsigned long checksum, sum; 386 unsigned long checksum, sum;
387 unsigned char *p8; 387 unsigned char *p8;
388 uint16_t *p16; 388 uint16_t *p16;
389 389
390 if (get_section_address(section) < 0)
391 return -1;
392
390 p8 = (char *)BOOTLOADER_ENTRYPOINT; 393 p8 = (char *)BOOTLOADER_ENTRYPOINT;
391 if (!detect_valid_bootloader(p8, 0)) 394 if (!detect_valid_bootloader(p8, 0))
392 { 395 {
@@ -394,7 +397,7 @@ int flash_rockbox(const char *filename)
394 return -1; 397 return -1;
395 } 398 }
396 399
397 if (detect_flashed_rockbox()) 400 if (!rb->detect_original_firmware())
398 { 401 {
399 if (!confirm("Update Rockbox flash image?")) 402 if (!confirm("Update Rockbox flash image?"))
400 return -2; 403 return -2;
@@ -409,13 +412,36 @@ int flash_rockbox(const char *filename)
409 if (len <= 0) 412 if (len <= 0)
410 return len * 10; 413 return len * 10;
411 414
415 pos = get_section_address(section);
416
417 /* Check if image relocation seems to be sane. */
418 if (section == SECT_ROMIMAGE)
419 {
420 uint32_t *p32 = (uint32_t *)audiobuf;
421
422 if (pos+sizeof(struct flash_header) != *p32)
423 {
424 rb->snprintf(buf, sizeof(buf), "Incorrect relocation: 0x%08x/0x%08x",
425 *p32, pos+sizeof(struct flash_header));
426 rb->splash(HZ*10, true, buf);
427 return -1;
428 }
429
430 }
431
412 /* Erase the program flash. */ 432 /* Erase the program flash. */
413 for (i = 1; i < BOOTLOADER_ERASEGUARD && (i-1)*4096 < len + 32; i++) 433 for (i = 0; i + pos < BOOTLOADER_ENTRYPOINT && i < len + 32; i += SEC_SIZE)
414 { 434 {
415 rc = cfi_erase_sector(FB + (SEC_SIZE/2) * i); 435 /* Additional safety check. */
416 rb->snprintf(buf, sizeof(buf), "Erase: 0x%03x (%d)", i, rc); 436 if (i + pos < SEC_SIZE)
437 return -1;
438
439 rb->snprintf(buf, sizeof(buf), "Erasing... %d%%",
440 (i+SEC_SIZE)*100/len);
417 rb->lcd_puts(0, 3, buf); 441 rb->lcd_puts(0, 3, buf);
418 rb->lcd_update(); 442 rb->lcd_update();
443
444 rc = cfi_erase_sector(FB + (i + pos)/2);
419 } 445 }
420 446
421 /* Write the magic and size. */ 447 /* Write the magic and size. */
@@ -425,11 +451,11 @@ int flash_rockbox(const char *filename)
425 // rb->strncpy(hdr.version, APPSVERSION, sizeof(hdr.version)-1); 451 // rb->strncpy(hdr.version, APPSVERSION, sizeof(hdr.version)-1);
426 p16 = (uint16_t *)&hdr; 452 p16 = (uint16_t *)&hdr;
427 453
428 rb->snprintf(buf, sizeof(buf), "Programming"); 454 rb->snprintf(buf, sizeof(buf), "Programming...");
429 rb->lcd_puts(0, 4, buf); 455 rb->lcd_puts(0, 4, buf);
430 rb->lcd_update(); 456 rb->lcd_update();
431 457
432 pos = FLASH_ENTRYPOINT/2; 458 pos = get_section_address(section)/2;
433 for (i = 0; i < (long)sizeof(struct flash_header)/2; i++) 459 for (i = 0; i < (long)sizeof(struct flash_header)/2; i++)
434 { 460 {
435 cfi_program_word(FB + pos, p16[i]); 461 cfi_program_word(FB + pos, p16[i]);
@@ -438,14 +464,24 @@ int flash_rockbox(const char *filename)
438 464
439 p16 = (uint16_t *)audiobuf; 465 p16 = (uint16_t *)audiobuf;
440 for (i = 0; i < len/2 && pos + i < (BOOTLOADER_ENTRYPOINT/2); i++) 466 for (i = 0; i < len/2 && pos + i < (BOOTLOADER_ENTRYPOINT/2); i++)
467 {
468 if (i % SEC_SIZE == 0)
469 {
470 rb->snprintf(buf, sizeof(buf), "Programming... %d%%",
471 (i+1)*100/(len/2));
472 rb->lcd_puts(0, 4, buf);
473 rb->lcd_update();
474 }
475
441 cfi_program_word(FB + pos + i, p16[i]); 476 cfi_program_word(FB + pos + i, p16[i]);
477 }
442 478
443 /* Verify */ 479 /* Verify */
444 rb->snprintf(buf, sizeof(buf), "Verifying"); 480 rb->snprintf(buf, sizeof(buf), "Verifying");
445 rb->lcd_puts(0, 5, buf); 481 rb->lcd_puts(0, 5, buf);
446 rb->lcd_update(); 482 rb->lcd_update();
447 483
448 p8 = (char *)FLASH_ENTRYPOINT; 484 p8 = (char *)get_section_address(section);
449 p8 += sizeof(struct flash_header); 485 p8 += sizeof(struct flash_header);
450 sum = 0; 486 sum = 0;
451 for (i = 0; i < len; i++) 487 for (i = 0; i < len; i++)
@@ -456,7 +492,10 @@ int flash_rockbox(const char *filename)
456 rb->splash(HZ*3, true, "Verify failed!"); 492 rb->splash(HZ*3, true, "Verify failed!");
457 /* Erase the magic sector so bootloader does not try to load 493 /* Erase the magic sector so bootloader does not try to load
458 * rockbox from flash and crash. */ 494 * rockbox from flash and crash. */
459 cfi_erase_sector(FB + SEC_SIZE/2); 495 if (section == SECT_RAMIMAGE)
496 cfi_erase_sector(FB + FLASH_RAMIMAGE_ENTRY/2);
497 else
498 cfi_erase_sector(FB + FLASH_ROMIMAGE_ENTRY/2);
460 return -5; 499 return -5;
461 } 500 }
462 501
@@ -741,7 +780,9 @@ void DoUserDialog(char* filename)
741 audiobuf = rb->plugin_get_audio_buffer(&audiobuf_size); 780 audiobuf = rb->plugin_get_audio_buffer(&audiobuf_size);
742 781
743 if (rb->strcasestr(filename, "/rockbox.iriver")) 782 if (rb->strcasestr(filename, "/rockbox.iriver"))
744 flash_rockbox(filename); 783 flash_rockbox(filename, SECT_RAMIMAGE);
784 else if (rb->strcasestr(filename, "/rombox.iriver"))
785 flash_rockbox(filename, SECT_ROMIMAGE);
745 else if (rb->strcasestr(filename, "/bootloader.iriver")) 786 else if (rb->strcasestr(filename, "/bootloader.iriver"))
746 flash_bootloader(filename); 787 flash_bootloader(filename);
747 else if (rb->strcasestr(filename, "/ihp_120.bin")) 788 else if (rb->strcasestr(filename, "/ihp_120.bin"))
diff --git a/firmware/eeprom_settings.c b/firmware/eeprom_settings.c
index ad2c9c848f..f3be2ec2b3 100644
--- a/firmware/eeprom_settings.c
+++ b/firmware/eeprom_settings.c
@@ -36,7 +36,7 @@ static bool reset_config(void)
36#else 36#else
37 firmware_settings.version = EEPROM_SETTINGS_VERSION; 37 firmware_settings.version = EEPROM_SETTINGS_VERSION;
38 firmware_settings.initialized = true; 38 firmware_settings.initialized = true;
39 firmware_settings.boot_disk = false; 39 firmware_settings.bootmethod = BOOT_RECOVERY;
40 firmware_settings.bl_version = 0; 40 firmware_settings.bl_version = 0;
41#endif 41#endif
42 42
@@ -51,7 +51,7 @@ bool eeprom_settings_init(void)
51 eeprom_24cxx_init(); 51 eeprom_24cxx_init();
52 52
53 /* Check if player has been flashed. */ 53 /* Check if player has been flashed. */
54 if (!detect_flashed_rockbox()) 54 if (detect_original_firmware())
55 { 55 {
56 memset(&firmware_settings, 0, sizeof(struct eeprom_settings)); 56 memset(&firmware_settings, 0, sizeof(struct eeprom_settings));
57 firmware_settings.initialized = false; 57 firmware_settings.initialized = false;
@@ -61,7 +61,7 @@ bool eeprom_settings_init(void)
61 61
62 ret = eeprom_24cxx_read(0, &firmware_settings, 62 ret = eeprom_24cxx_read(0, &firmware_settings,
63 sizeof(struct eeprom_settings)); 63 sizeof(struct eeprom_settings));
64 64
65 if (ret < 0) 65 if (ret < 0)
66 { 66 {
67 memset(&firmware_settings, 0, sizeof(struct eeprom_settings)); 67 memset(&firmware_settings, 0, sizeof(struct eeprom_settings));
@@ -101,7 +101,7 @@ bool eeprom_settings_store(void)
101 int ret; 101 int ret;
102 uint32_t sum; 102 uint32_t sum;
103 103
104 if (!firmware_settings.initialized || !detect_flashed_rockbox()) 104 if (!firmware_settings.initialized || detect_original_firmware())
105 { 105 {
106 logf("Rockbox in flash is required"); 106 logf("Rockbox in flash is required");
107 return false; 107 return false;
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index ee3d70236a..9bfb9583dd 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -139,8 +139,9 @@
139#define BOOTFILE "rockbox." BOOTFILE_EXT 139#define BOOTFILE "rockbox." BOOTFILE_EXT
140 140
141#define BOOTLOADER_ENTRYPOINT 0x001F0000 141#define BOOTLOADER_ENTRYPOINT 0x001F0000
142#define FLASH_ENTRYPOINT 0x00001000 142#define FLASH_RAMIMAGE_ENTRY 0x00001000
143#define FLASH_MAGIC 0xfbfbfbf1 143#define FLASH_ROMIMAGE_ENTRY 0x00100000
144#define FLASH_MAGIC 0xfbfbfbf2
144 145
145/* Define this if there is an EEPROM chip */ 146/* Define this if there is an EEPROM chip */
146#define HAVE_EEPROM 147#define HAVE_EEPROM
diff --git a/firmware/export/eeprom_settings.h b/firmware/export/eeprom_settings.h
index 367e7b24e9..aade86bc0d 100644
--- a/firmware/export/eeprom_settings.h
+++ b/firmware/export/eeprom_settings.h
@@ -23,17 +23,26 @@
23#include <stdbool.h> 23#include <stdbool.h>
24#include "inttypes.h" 24#include "inttypes.h"
25 25
26#define EEPROM_SETTINGS_VERSION 0x24c01001 26#define EEPROM_SETTINGS_VERSION 0x24c01002
27#define EEPROM_SETTINGS_BL_MINVER 7 27#define EEPROM_SETTINGS_BL_MINVER 7
28 28
29enum boot_methods {
30 BOOT_DISK = 0,
31 BOOT_RAM,
32 BOOT_ROM,
33 BOOT_RECOVERY,
34};
35
29struct eeprom_settings 36struct eeprom_settings
30{ 37{
31 long version; /* Settings version number */ 38 long version; /* Settings version number */
32 bool initialized; /* Is eeprom_settings ready to be used */ 39 bool initialized; /* Is eeprom_settings ready to be used */
33 bool disk_clean; /* Is disk intact from last reboot */ 40 bool disk_clean; /* Is disk intact from last reboot */
34 bool boot_disk; /* Load firmware from disk (default=FLASH) */ 41 uint8_t bootmethod; /* The default boot method. */
35 uint8_t bl_version; /* Installed bootloader version */ 42 uint8_t bl_version; /* Installed bootloader version */
36 43
44 long reserved; /* A few reserved bits for the future. */
45
37 /* This must be the last entry */ 46 /* This must be the last entry */
38 uint32_t checksum; /* Checksum of this structure */ 47 uint32_t checksum; /* Checksum of this structure */
39}; 48};
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 94922871b6..86bbefb28f 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -52,7 +52,9 @@ struct flash_header {
52 char version[32]; 52 char version[32];
53}; 53};
54 54
55bool detect_flashed_rockbox(void); 55bool detect_flashed_romimage(void);
56bool detect_flashed_ramimage(void);
57bool detect_original_firmware(void);
56 58
57#ifdef HAVE_ADJUSTABLE_CPU_FREQ 59#ifdef HAVE_ADJUSTABLE_CPU_FREQ
58#define FREQ cpu_frequency 60#define FREQ cpu_frequency
diff --git a/firmware/system.c b/firmware/system.c
index 4ab47fac1f..c9ce086f0a 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -82,31 +82,44 @@ void cpu_idle_mode(bool on_off)
82#endif /* HAVE_ADJUSTABLE_CPU_FREQ */ 82#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
83 83
84 84
85bool detect_flashed_rockbox(void)
86{
87#ifdef HAVE_FLASHED_ROCKBOX 85#ifdef HAVE_FLASHED_ROCKBOX
88 struct flash_header hdr; 86static bool detect_flash_header(uint8_t *addr)
89 uint8_t *src = (uint8_t *)FLASH_ENTRYPOINT; 87{
90
91#ifndef BOOTLOADER 88#ifndef BOOTLOADER
92 int oldmode = system_memory_guard(MEMGUARD_NONE); 89 int oldmode = system_memory_guard(MEMGUARD_NONE);
93#endif 90#endif
94 91 struct flash_header hdr;
95 memcpy(&hdr, src, sizeof(struct flash_header)); 92 memcpy(&hdr, addr, sizeof(struct flash_header));
96
97#ifndef BOOTLOADER 93#ifndef BOOTLOADER
98 system_memory_guard(oldmode); 94 system_memory_guard(oldmode);
99#endif 95#endif
96 return hdr.magic == FLASH_MAGIC;
97}
98#endif
100 99
101 if (hdr.magic != FLASH_MAGIC) 100bool detect_flashed_romimage(void)
102 return false; 101{
102#ifdef HAVE_FLASHED_ROCKBOX
103 return detect_flash_header((uint8_t *)FLASH_ROMIMAGE_ENTRY);
104#else
105 return false;
106#endif /* HAVE_FLASHED_ROCKBOX */
107}
103 108
104 return true; 109bool detect_flashed_ramimage(void)
110{
111#ifdef HAVE_FLASHED_ROCKBOX
112 return detect_flash_header((uint8_t *)FLASH_RAMIMAGE_ENTRY);
105#else 113#else
106 return false; 114 return false;
107#endif /* HAVE_FLASHED_ROCKBOX */ 115#endif /* HAVE_FLASHED_ROCKBOX */
108} 116}
109 117
118bool detect_original_firmware(void)
119{
120 return !(detect_flashed_ramimage() || detect_flashed_romimage());
121}
122
110#if CONFIG_CPU == SH7034 123#if CONFIG_CPU == SH7034
111#include "led.h" 124#include "led.h"
112#include "system.h" 125#include "system.h"
diff --git a/firmware/target/coldfire/crt0.S b/firmware/target/coldfire/crt0.S
index 7fc389c23d..c177cd4e27 100644
--- a/firmware/target/coldfire/crt0.S
+++ b/firmware/target/coldfire/crt0.S
@@ -89,28 +89,40 @@ start:
89#endif 89#endif
90 90
91#ifdef BOOTLOADER 91#ifdef BOOTLOADER
92 /* Check if original firmware is still present */ 92 /* Check if we have a Rockbox ROM image */
93 lea 0x00100000,%a2
94 move.l (%a2),%d0
95 move.l #FLASH_MAGIC,%d1
96 cmp.l %d0,%d1
97 beq.b .imagefound
98
99 /* Check for RAM image */
93 lea 0x00001000,%a2 100 lea 0x00001000,%a2
94 move.l (%a2),%d0 101 move.l (%a2),%d0
95 move.l #0xfbfbfbf1,%d1 102 move.l #FLASH_MAGIC,%d1
96 cmp.l %d0,%d1 103 cmp.l %d0,%d1
97 beq.b .ignorecookie 104 beq.b .imagefound
98 105
99 /* The cookie is not reset. This must mean that the boot loader 106 /* Not either ROM or RAM image was found, so original firmware
100 has crashed. Let's start the original firmware immediately. */ 107 should be still present. */
108
109 /* Check if the cookie is present. */
101 lea 0x10017ffc,%a2 110 lea 0x10017ffc,%a2
102 move.l (%a2),%d0 111 move.l (%a2),%d0
103 move.l #0xc0015a17,%d1 112 move.l #0xc0015a17,%d1
104 cmp.l %d0,%d1 113 cmp.l %d0,%d1
105 bne.b .nocookie 114 bne.b .nocookie
106 /* Clear the cookie again */ 115
116 /* The cookie is not reset. This must mean that the boot loader
117 has crashed. Let's start the original firmware immediately. */
118 lea 0x10017ffc,%a2
107 clr.l (%a2) 119 clr.l (%a2)
108 jmp 8 120 jmp 8
109 121
110.nocookie: 122.nocookie:
111 /* Set the cookie */ 123 /* Set the cookie */
112 move.l %d1,(%a2) 124 move.l %d1,(%a2)
113.ignorecookie: 125.imagefound:
114 126
115 /* Set up the DRAM controller. The refresh is based on the 11.2896MHz 127 /* Set up the DRAM controller. The refresh is based on the 11.2896MHz
116 clock (5.6448MHz bus frequency). We haven't yet started the PLL */ 128 clock (5.6448MHz bus frequency). We haven't yet started the PLL */
@@ -168,6 +180,38 @@ start:
168 move.l %d0,0x31000800 /* A12=1 means CASL=1 (a0 is not connected) */ 180 move.l %d0,0x31000800 /* A12=1 means CASL=1 (a0 is not connected) */
169 181
170 /* DACR0[IMRS] gets deactivated by the SDRAM controller */ 182 /* DACR0[IMRS] gets deactivated by the SDRAM controller */
183
184 /* Check if we have a Rockbox ROM image. For RAM image only cookie is
185 not set at all. But we could support also RAM images loading. */
186 lea 0x00100000,%a2
187 move.l (%a2),%d0
188 move.l #FLASH_MAGIC,%d1
189 cmp.l %d0,%d1
190 bne.b .noromimage
191
192 /* Check again if the cookie is present. */
193 lea 0x10017ffc,%a2
194 move.l (%a2),%d0
195 move.l #0xc0015a17,%d1
196 cmp.l %d0,%d1
197 bne.b .nocookie2
198
199 /* We have found Rockbox in ROM!
200 Clear the cookie and load the ROM image */
201 lea 0x10017ffc,%a2
202 clr.l (%a2)
203 lea 0x00100028+4,%a2
204 move.l (%a2),%sp
205 lea 0x00100028+8,%a2
206 move.l (%a2),%d0
207 move.l %d0,%a2
208 jmp (%a2)
209
210.nocookie2:
211 /* Set the cookie */
212 move.l %d1,(%a2)
213.noromimage:
214
171#endif /* BOOTLOADER */ 215#endif /* BOOTLOADER */
172 216
173 /* Invalicate cache */ 217 /* Invalicate cache */