[U-Boot-Users] [PATCH] 4/4: kermit fixes

Robert Schwebel robert at schwebel.de
Wed Mar 19 14:03:25 CET 2003


- clarify some address outputs to be hex
- changed default size of print_num / print_str to 14 characters
  to make all outputs alligned
- added $loadaddr / CFG_LOAD_ADDR support to loadb
- moved "ignoring trailing characters" to a place _before_ u-boot 
  wants to print out diagnostics messages; removes bogus characters
  at the end of transmission
- added README hint

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
-------------- next part --------------
diff -urNb -x CVS -x ptx-patches u-boot/common/cmd_boot.c u-boot-ptx/common/cmd_boot.c
--- u-boot/common/cmd_boot.c	Sun Nov  3 01:49:22 2002
+++ u-boot-ptx/common/cmd_boot.c	Wed Mar 19 13:43:02 2003
@@ -124,9 +124,9 @@
 	print_num ("boot_params",	(ulong)bd->bi_boot_params);
 
 	for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
-		printf ("DRAM:%02d.start = %08lX\n",
+		printf ("DRAM:%02d.start = 0x%08lX\n",
 			i, bd->bi_dram[i].start);
-		printf ("DRAM:%02d.size  = %08lX\n",
+		printf ("DRAM:%02d.size  = 0x%08lX\n",
 			i, bd->bi_dram[i].size);
 	}
 
@@ -147,13 +147,13 @@
 
 static void print_num(const char *name, ulong value)
 {
-	printf ("%-12s= 0x%08lX\n", name, value);
+	printf ("%-14s= 0x%08lX\n", name, value);
 }
 
 #ifndef	CONFIG_ARM
 static void print_str(const char *name, const char *str)
 {
-	printf ("%-12s= %6s MHz\n", name, str);
+	printf ("%-14s= %6s MHz\n", name, str);
 }
 #endif	/* CONFIG_ARM */
 
@@ -577,9 +577,17 @@
 
 	ulong offset = 0;
 	ulong addr;
-	int i;
 	int load_baudrate, current_baudrate;
 	int rcode = 0;
+	char *s;
+
+	/* pre-set offset from CFG_LOAD_ADDR */
+	offset = CFG_LOAD_ADDR;
+	
+	/* pre-set offset from $loadaddr */
+	if ((s = getenv("loadaddr")) != NULL) {
+		offset = simple_strtoul(s, NULL, 16);
+	}	       
 
 	load_baudrate = current_baudrate = gd->baudrate;
 
@@ -606,22 +614,11 @@
 				break;
 		}
 	}
-	printf ("## Ready for binary (kermit) download ...\n");
 
+	printf ("## Ready for binary (kermit) download ");
+	printf ("to 0x%08lx at %i baud...\n",offset,current_baudrate);
 	addr = load_serial_bin (offset);
 
-	/*
-	 * Gather any trailing characters (for instance, the ^D which
-	 * is sent by 'cu' after sending a file), and give the
-	 * box some time (100 * 1 ms)
-	 */
-	for (i=0; i<100; ++i) {
-		if (serial_tstc()) {
-			(void) serial_getc();
-		}
-		udelay(1000);
-	}
-
 	if (addr == ~0) {
 		load_addr = 0;
 		printf ("## Binary (kermit) download aborted\n");
@@ -660,11 +657,24 @@
 
 static ulong load_serial_bin (ulong offset)
 {
-	int size;
+	int size, i;
 	char buf[32];
 
 	set_kerm_bin_mode ((ulong *) offset);
 	size = k_recv ();
+
+	/*
+	 * Gather any trailing characters (for instance, the ^D which
+	 * is sent by 'cu' after sending a file), and give the
+	 * box some time (100 * 1 ms)
+	 */
+	for (i=0; i<100; ++i) {
+		if (serial_tstc()) {
+			(void) serial_getc();
+		}
+		udelay(1000);
+	}
+
 	flush_cache (offset, size);
 
 	printf("## Total Size      = 0x%08x = %d Bytes\n", size, size);
diff -urNb -x CVS -x ptx-patches u-boot/README u-boot-ptx/README
--- u-boot/README	Wed Mar 12 15:27:30 2003
+++ u-boot-ptx/README	Wed Mar 19 13:43:23 2003
@@ -1549,6 +1549,7 @@
 
 
 Low Level (hardware related) configuration options:
+---------------------------------------------------
 
 - CFG_CACHELINE_SIZE:
 		Cache Line Size of the CPU.
@@ -1928,7 +1929,7 @@
   ipaddr	- IP address; needed for tftpboot command
 
   loadaddr	- Default load address for commands like "bootp",
-		  "rarpboot", "tftpboot" or "diskboot"
+		  "rarpboot", "tftpboot", "loadb" or "diskboot"
 
   loads_echo	- see CONFIG_LOADS_ECHO
 


More information about the U-Boot mailing list