aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-03-09 09:24:26 +0000
committerDean Camera <dean@fourwalledcubicle.com>2013-03-09 09:24:26 +0000
commit63e1fc6e6c435dcdaa0ebc465c00b1df05f69ed4 (patch)
tree014ddf7ef9a203c705165a0ebcd1db6385681ef0
parentd5d9ff73e5216969aaa2915de3fa04f530ffe400 (diff)
downloadlufa-63e1fc6e6c435dcdaa0ebc465c00b1df05f69ed4.tar.gz
lufa-63e1fc6e6c435dcdaa0ebc465c00b1df05f69ed4.tar.bz2
lufa-63e1fc6e6c435dcdaa0ebc465c00b1df05f69ed4.zip
Make the VirtualFAT firmware file read from device flash when opened by the host in the incomplete Mass Storage class bootloader.
-rw-r--r--Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c
index 24df348f0..f5e5f840d 100644
--- a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c
+++ b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c
@@ -138,8 +138,10 @@ static void ReadBlock(const uint16_t BlockNumber)
default:
if ((BlockNumber >= 4) && (BlockNumber < (4 + (FIRMWARE_FILE_SIZE / SECTOR_SIZE_BYTES))))
{
- for (uint16_t i = 0; i < 512; i++)
- BlockBuffer[i] = 'A' + (i % 26);
+ uint32_t ReadFlashAddress = (uint32_t)(BlockNumber - 4) * SECTOR_SIZE_BYTES;
+
+ for (uint16_t i = 0; i < SECTOR_SIZE_BYTES; i++)
+ BlockBuffer[i] = pgm_read_byte_far(ReadFlashAddress++);
}
break;