[U-Boot-Users] [PATCH] 1/5: cmd_boot

Wolfgang Denk wd at denx.de
Mon Mar 31 16:47:32 CEST 2003


In message <20030331141607.GI7702 at pengutronix.de> you wrote:
>
> Wolfgang, the code has been in that file for ages. The only thing I did
> is to move it to the right location, which is _before_ the printf() in
> load_serial_bin(), not _after_ the function returned. Please explain why
> moving code changes the binary size. 

You patch does not delete code, but  it  adds  code,  increasing  the
size:

--- u-boot/common/cmd_boot.c	2003-03-31 08:34:19.000000000 +0200
+++ u-boot-ptx/common/cmd_boot.c	2003-03-31 08:39:33.000000000 +0200
@@ -163,10 +163,10 @@
 		printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
 	}
 	printf ("\n"
-		"ip_addr       = ");
+		"ip_addr     = ");
 	print_IPaddr (bd->bi_ip_addr);
 	printf ("\n"
-		"baudrate      = %d bps\n", bd->bi_baudrate);
+		"baudrate    = %d bps\n", bd->bi_baudrate);
 
 	return 0;
 }
@@ -575,6 +575,7 @@
 #define XON_CHAR        17
 #define XOFF_CHAR       19
 #define START_CHAR      0x01
+#define ETX_CHAR	0x03
 #define END_CHAR        0x0D
 #define SPACE           0x20
 #define K_ESCAPE        0x23
@@ -687,11 +688,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);
...


Let's wait a day if anybody speaks up who has the same  problem  like
you. if not, I will ignore this.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
If it happens once, it's a bug.
If it happens twice, it's a feature.
If it happens more than twice, it's a design philosophy.




More information about the U-Boot mailing list