PERFORCE change 96610 for review
Warner Losh
imp at FreeBSD.org
Wed May 3 19:39:57 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=96610
Change 96610 by imp at imp_hammer on 2006/05/03 19:39:25
round the size to burn/compare to be a full flash page.
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/boot0spi/main.c#10 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/boot0spi/main.c#10 (text) ====
@@ -41,6 +41,9 @@
#define BURN_FPGA 1
+//#define OFFSET (15 * FLASH_PAGE_SIZE)
+#define OFFSET 0
+
int
main(void)
{
@@ -52,18 +55,19 @@
#endif
SPI_InitFlash();
+ printf("Waiting for data\r\n");
while ((len = xmodem_rx(addr)) == -1)
continue;
#ifdef BURN_FPGA
printf("\r\nDownloaded %u bytes.\r\n", len);
- p_memcpy(addr3, addr, len);
- printf("Writing %u bytes to flash\r\n", len);
+ p_memcpy(addr3, addr, (len + FLASH_PAGE_SIZE - 1) / FLASH_PAGE_SIZE * FLASH_PAGE_SIZE);
+ printf("Writing %u bytes to flash at %u\r\n", len, OFFSET);
for (i = 0; i < len; i+= FLASH_PAGE_SIZE) {
for (j = 0; j < 10; j++) {
- off = i + 15 * FLASH_PAGE_SIZE;
+ off = i + OFFSET;
SPI_WriteFlash(off, addr + i, FLASH_PAGE_SIZE);
SPI_ReadFlash(off, addr2 + i, FLASH_PAGE_SIZE);
- if (p_memcmp(addr3 + off, addr2 + off, FLASH_PAGE_SIZE) == 0)
+ if (p_memcmp(addr3 + i, addr2 + i, FLASH_PAGE_SIZE) == 0)
break;
}
if (j >= 10)
More information about the p4-projects
mailing list