summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Buren <braewoods+rb@braewoods.net>2020-10-26 02:29:01 +0000
committerJames Buren <braewoods+rb@braewoods.net>2020-10-26 02:29:01 +0000
commitdd3ea521ad48b6e409cdc72a88919cadfc1920e0 (patch)
treebdfda32fcc465829a8115e39d4292216a3f2777f
parentc5d7cd5f9f4712150957143efc7cf797495c081d (diff)
downloadrockbox-dd3ea521ad48b6e409cdc72a88919cadfc1920e0.tar.gz
rockbox-dd3ea521ad48b6e409cdc72a88919cadfc1920e0.zip
iriver_flash: correctly calculate when to stop erasing the bootloader
It was originally hard-coded at 0x200 which is 512 sectors. This only works for the H100 and H120. The larger ROM of the H300 is 1024 sectors in size. In either case the bootloader starts 16 sectors before the end of the ROM so rely on this fact to correctly calculate where to stop the bootloader erasure. Change-Id: Iec4112ebf24379f80a7bf1363035e005c434907e
-rw-r--r--apps/plugins/iriver_flash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c
index 2ef6872c7d..2004840531 100644
--- a/apps/plugins/iriver_flash.c
+++ b/apps/plugins/iriver_flash.c
@@ -514,7 +514,7 @@ int flash_bootloader(const char *filename)
514 cfi_program_word(FB + i, p16[i]); 514 cfi_program_word(FB + i, p16[i]);
515 515
516 /* Erase the bootloader flash section. */ 516 /* Erase the bootloader flash section. */
517 for (i = BOOTLOADER_ENTRYPOINT/SEC_SIZE; i < 0x200; i++) 517 for (i = BOOTLOADER_ERASEGUARD; i < BOOTLOADER_ERASEGUARD+16; i++)
518 /*rc =*/ cfi_erase_sector(FB + (SEC_SIZE/2) * i); 518 /*rc =*/ cfi_erase_sector(FB + (SEC_SIZE/2) * i);
519 519
520 pos = BOOTLOADER_ENTRYPOINT/2; 520 pos = BOOTLOADER_ENTRYPOINT/2;