summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2006-11-16 00:48:53 +0000
committerimp <imp@FreeBSD.org>2006-11-16 00:48:53 +0000
commit48373925cf54856f051a5c1481bd523afcd26664 (patch)
treeff786053e703f489ae33d7f50a7aa9497d288edf /sys/boot
parentfc399b46b5ba0c632b1153cfccfb745ea5900216 (diff)
downloadFreeBSD-src-48373925cf54856f051a5c1481bd523afcd26664.zip
FreeBSD-src-48373925cf54856f051a5c1481bd523afcd26664.tar.gz
MFp4: Improvements, including the ability to download to an arbitrary
part of the spi flash.
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/arm/at91/boot0spi/main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/boot/arm/at91/boot0spi/main.c b/sys/boot/arm/at91/boot0spi/main.c
index c8cbf0f..fabc052 100644
--- a/sys/boot/arm/at91/boot0spi/main.c
+++ b/sys/boot/arm/at91/boot0spi/main.c
@@ -29,21 +29,23 @@
#include "at91rm9200_lowlevel.h"
#include "spi_flash.h"
-#define OFFSET 0
+#define LOADER_OFFSET 0
+#define FPGA_OFFSET (15 * FLASH_PAGE_SIZE)
+#define OFFSET LOADER_OFFSET
int
main(void)
{
int len, i, j, off;
- char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
- char *addr2 = (char *)SDRAM_BASE + (2 << 20); /* Load to base + 2MB */
- char *addr3 = (char *)SDRAM_BASE + (3 << 20); /* Load to base + 2MB */
+ char *addr = (char *)SDRAM_BASE + (1 << 20); /* download at + 1MB */
+ char *addr2 = (char *)SDRAM_BASE + (2 << 20); /* readback to + 2MB */
+ char *addr3 = (char *)SDRAM_BASE + (3 << 20); /* extra copy at + 3MB */
SPI_InitFlash();
printf("Waiting for data\n");
while ((len = xmodem_rx(addr)) == -1)
continue;
- printf("\nDownloaded %u bytes.\n", len);
+ // Need extra copy at addr3
memcpy(addr3, addr, (len + FLASH_PAGE_SIZE - 1) / FLASH_PAGE_SIZE * FLASH_PAGE_SIZE);
printf("Writing %u bytes to flash at %u\n", len, OFFSET);
for (i = 0; i < len; i+= FLASH_PAGE_SIZE) {
@@ -57,5 +59,6 @@ main(void)
if (j >= 10)
printf("Bad Readback at %u\n", i);
}
+ printf("Done\n");
return (1);
}
OpenPOWER on IntegriCloud