PERFORCE change 106179 for review
Warner Losh
imp at FreeBSD.org
Fri Sep 15 17:05:04 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=106179
Change 106179 by imp at imp_lighthouse on 2006/09/16 00:04:58
Allow for downloading and resetting from the loader...
silly, I know, but useful for devel
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/Makefile.inc#22 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#22 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/Makefile.inc#22 (text+ko) ====
@@ -5,7 +5,7 @@
__at91_boot_Makefile.inc__:
-CFLAGS=-O2 -mcpu=arm9 -ffreestanding \
+CFLAGS=-Os -mcpu=arm9 -ffreestanding \
-I${.CURDIR}/../libat91 \
-I${.CURDIR}/../../../.. \
-I${.CURDIR}/../../../../arm \
==== //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#22 (text+ko) ====
@@ -117,6 +117,8 @@
if (c)
*s++ = c;
for (;;) {
+ c = getc(10000);
+
switch (c = getc(10000)) {
case 0:
break;
@@ -207,6 +209,30 @@
}
#endif
+#define XMODEM_DL
+#ifdef XMODEM_DL
+#define FLASH_OFFSET (0 * FLASH_PAGE_SIZE)
+#define FPGA_OFFSET (15 * FLASH_PAGE_SIZE)
+#define FPGA_LEN (212608)
+#define KERNEL_OFFSET (220 * FLASH_PAGE_SIZE)
+#define KERNEL_LEN (6 * 1024 * FLASH_PAGE_SIZE)
+
+static void
+UpdateFlash(int offset)
+{
+ char *addr = (char *)0x20000000 + (1 << 20); /* Load to base + 1MB */
+ int len, i, off;
+
+ while ((len = xmodem_rx(addr)) == -1)
+ continue;
+ printf("\nDownloaded %u bytes.\n", len);
+ for (i = 0; i < len; i+= FLASH_PAGE_SIZE) {
+ off = i + offset;
+ SPI_WriteFlash(off, addr + i, FLASH_PAGE_SIZE);
+ }
+}
+#endif
+
int
main(void)
{
@@ -248,12 +274,18 @@
printf("\nDefault: %s\nboot: ", kname);
if (!autoboot || (c = getc(2)) != -1)
getstr(c);
- else if (!autoboot)
- xputchar('\n');
+ xputchar('\n');
autoboot = 0;
c = 0;
+ printf("cmd is '%s'\n", cmd);
if (parse())
xputchar('\a');
+#ifdef XMODEM_DL
+ else if (*cmd == '*')
+ UpdateFlash(FLASH_OFFSET);
+ else if (*cmd == '#')
+ reset();
+#endif
else
load();
}
More information about the p4-projects
mailing list