public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH][RESEND] make y-modem a separate config option
@ 2006-11-28 15:11 Anders Larsen
  2006-11-28 20:05 ` Markus Klotzbücher
  0 siblings, 1 reply; 5+ messages in thread
From: Anders Larsen @ 2006-11-28 15:11 UTC (permalink / raw)
  To: u-boot

Hi,

the loady command (which was introduced this april) bloats the size of
U-Boot by almost 4K on my at91 board.
The patch below introduces a new option CFG_CMD_LOADY, which can be
disabled separately from CFG_CMD_LOADB to save precious space
(loadb + loady together take up about 2.5 times as much code space as
loadb alone).

Perhaps CFG_CMD_LOADY should even be added to CFG_CMD_NONSTD for this
reason?

Cheers
 Anders

CHANGELOG:
  Optionally disable the y-modem protocol
  Patch by Anders Larsen, 06 Jul 2006

Signed-off-by: Anders Larsen <al@alarsen.net>

---

 common/cmd_load.c      |   28 +++++++++++++++-------------
 include/cmd_confdefs.h |    1 +
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/common/cmd_load.c b/common/cmd_load.c
index f63b8e8..5f06129 100644
--- a/common/cmd_load.c
+++ b/common/cmd_load.c
@@ -33,7 +33,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if (CONFIG_COMMANDS & CFG_CMD_LOADB)
+#if (CONFIG_COMMANDS & CFG_CMD_LOADY)
 static ulong load_serial_ymodem (ulong offset);
 #endif
 
@@ -404,7 +404,7 @@ write_record (char *buf)
 #endif	/* CFG_CMD_LOADS */
 
 
-#if (CONFIG_COMMANDS & CFG_CMD_LOADB)  /* loadb command (load binary) included */
+#if (CONFIG_COMMANDS & (CFG_CMD_LOADB | CFG_CMD_LOADY))  /* loadb command (load binary) included */
 
 #define XON_CHAR        17
 #define XOFF_CHAR       19
@@ -476,16 +476,7 @@ int do_load_serial_bin (cmd_tbl_t *cmdtp
 		}
 	}
 
-	if (strcmp(argv[0],"loady")==0) {
-		printf ("## Ready for binary (ymodem) download "
-			"to 0x%08lX at %d bps...\n",
-			offset,
-			load_baudrate);
-
-		addr = load_serial_ymodem (offset);
-
-	} else {
-
+	if (strcmp(argv[0],"loadb")==0) {
 		printf ("## Ready for binary (kermit) download "
 			"to 0x%08lX at %d bps...\n",
 			offset,
@@ -500,6 +491,15 @@ int do_load_serial_bin (cmd_tbl_t *cmdtp
 			printf ("## Start Addr      = 0x%08lX\n", addr);
 			load_addr = addr;
 		}
+#if (CONFIG_COMMANDS & CFG_CMD_LOADY)
+	} else {
+		printf ("## Ready for binary (ymodem) download "
+			"to 0x%08lX at %d bps...\n",
+			offset,
+			load_baudrate);
+
+		addr = load_serial_ymodem (offset);
+#endif
 	}
 	if (load_baudrate != current_baudrate) {
 		printf ("## Switch baudrate to %d bps and press ESC ...\n",
@@ -1086,7 +1086,7 @@ U_BOOT_CMD(
 #endif	/* CFG_CMD_LOADS */
 
 
-#if (CONFIG_COMMANDS & CFG_CMD_LOADB)
+#if (CONFIG_COMMANDS & (CFG_CMD_LOADB | CFG_CMD_LOADY))
 U_BOOT_CMD(
 	loadb, 3, 0,	do_load_serial_bin,
 	"loadb   - load binary file over serial line (kermit mode)\n",
@@ -1095,6 +1095,7 @@ U_BOOT_CMD(
 	" with offset 'off' and baudrate 'baud'\n"
 );
 
+#if (CONFIG_COMMANDS & CFG_CMD_LOADY)
 U_BOOT_CMD(
 	loady, 3, 0,	do_load_serial_bin,
 	"loady   - load binary file over serial line (ymodem mode)\n",
@@ -1102,6 +1103,7 @@ U_BOOT_CMD(
 	"    - load binary file over serial line"
 	" with offset 'off' and baudrate 'baud'\n"
 );
+#endif	/* CFG_CMD_LOADY */
 
 #endif	/* CFG_CMD_LOADB */
 
diff --git a/include/cmd_confdefs.h b/include/cmd_confdefs.h
index cf36583..72b6969 100644
--- a/include/cmd_confdefs.h
+++ b/include/cmd_confdefs.h
@@ -75,6 +75,7 @@
 #define CFG_CMD_FPGA	0x0000010000000000ULL	/* FPGA configuration Support	*/
 #define CFG_CMD_HWFLOW	0x0000020000000000ULL	/* RTS/CTS hw flow control	*/
 #define CFG_CMD_SAVES	0x0000040000000000ULL	/* save S record dump		*/
+#define CFG_CMD_LOADY	0x0000080000000000ULL	/* loady (implies loadb)	*/
 #define CFG_CMD_SPI	0x0000100000000000ULL	/* SPI utility			*/
 #define CFG_CMD_FDOS	0x0000200000000000ULL	/* Floppy DOS support		*/
 #define CFG_CMD_VFD	0x0000400000000000ULL	/* VFD support (TRAB)		*/

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot-Users] [PATCH][RESEND] make y-modem a separate config option
  2006-11-28 15:11 [U-Boot-Users] [PATCH][RESEND] make y-modem a separate config option Anders Larsen
@ 2006-11-28 20:05 ` Markus Klotzbücher
  2006-11-28 20:25   ` Anders Larsen
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Klotzbücher @ 2006-11-28 20:05 UTC (permalink / raw)
  To: u-boot

Hi Anders,

Anders Larsen <al@alarsen.net> writes:

> the loady command (which was introduced this april) bloats the size of
> U-Boot by almost 4K on my at91 board.
> The patch below introduces a new option CFG_CMD_LOADY, which can be
> disabled separately from CFG_CMD_LOADB to save precious space

If we do "waste" a config option on this, wouldn't it make sense to
separate loadb and loady completely, so that either can be chosen
independently?

> Perhaps CFG_CMD_LOADY should even be added to CFG_CMD_NONSTD for this
> reason?

Agreed, AFAIK the delta board is the only one to require loady.

Regards

Markus Klotzb?cher

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] [PATCH][RESEND] make y-modem a separate config option
  2006-11-28 20:05 ` Markus Klotzbücher
@ 2006-11-28 20:25   ` Anders Larsen
  2006-11-28 21:49     ` Markus Klotzbücher
  0 siblings, 1 reply; 5+ messages in thread
From: Anders Larsen @ 2006-11-28 20:25 UTC (permalink / raw)
  To: u-boot

Hi Markus,

On 2006-11-28 21:05:53, Markus Klotzb?cher wrote:
> If we do "waste" a config option on this, wouldn't it make sense to
> separate loadb and loady completely, so that either can be chosen
> independently?

I fully agree - but since loadb and loady share a fair amount of
common code, separating them isn't trivial (without duplicating that
code, which should be avoided).

Cheers
 Anders

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] [PATCH][RESEND] make y-modem a separate config option
  2006-11-28 20:25   ` Anders Larsen
@ 2006-11-28 21:49     ` Markus Klotzbücher
  2006-11-28 23:24       ` Anders Larsen
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Klotzbücher @ 2006-11-28 21:49 UTC (permalink / raw)
  To: u-boot

Hi Anders,

Anders Larsen <al@alarsen.net> writes:

> On 2006-11-28 21:05:53, Markus Klotzb?cher wrote:
>> If we do "waste" a config option on this, wouldn't it make sense to
>> separate loadb and loady completely, so that either can be chosen
>> independently?
>
> I fully agree - but since loadb and loady share a fair amount of
> common code, separating them isn't trivial (without duplicating that
> code, which should be avoided).

Are you sure? The only common code I see is the command entry point
do_load_serial(). Apart from that loady seems it use its own code
exclusively (mainly common/xyzModem.c and u-boot-orig/common/crc16.c)

Regards

Markus Klotzb?cher

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] [PATCH][RESEND] make y-modem a separate config option
  2006-11-28 21:49     ` Markus Klotzbücher
@ 2006-11-28 23:24       ` Anders Larsen
  0 siblings, 0 replies; 5+ messages in thread
From: Anders Larsen @ 2006-11-28 23:24 UTC (permalink / raw)
  To: u-boot

On 2006-11-28 22:49:54, Markus Klotzb?cher wrote:
> Anders Larsen <al@alarsen.net> writes:
> > I fully agree - but since loadb and loady share a fair amount of
> > common code, separating them isn't trivial (without duplicating that
> > code, which should be avoided).
> 
> Are you sure? The only common code I see is the command entry point
> do_load_serial(). Apart from that loady seems it use its own code
> exclusively (mainly common/xyzModem.c and u-boot-orig/common/crc16.c)

Hi,

looking more closely I suddently realised that there are actually _three_
different loaders in that module (loadb, loads/saves and loady) - looks
like a major rework is needed...

Cheers
 Anders

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-11-28 23:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-28 15:11 [U-Boot-Users] [PATCH][RESEND] make y-modem a separate config option Anders Larsen
2006-11-28 20:05 ` Markus Klotzbücher
2006-11-28 20:25   ` Anders Larsen
2006-11-28 21:49     ` Markus Klotzbücher
2006-11-28 23:24       ` Anders Larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox