make y-modem a separate config option
PATCH RESEND 1/1 make y-modem a separate config option
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
---
common/cmd_load.c | 28 +++++++++++++++------------- include/cmd_confdefs.h | 1 + 2 files changed, 16 insertions(+), 13 deletions(-)
common/cmd_load.c +15 -13
@@ -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 *cmdtpprintf ("## 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 */
include/cmd_confdefs.h +1 -0
@@ -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) */
PATCH RESEND 1/1 make y-modem a separate config option
Hi Anders,
Quoted 4 lines · Anders Larsen
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 optionCFG_CMD_LOADY, which can be disabled separately fromCFG_CMD_LOADBto 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?
Quoted 2 lines
Perhaps
CFG_CMD_LOADYshould even be added toCFG_CMD_NONSTDfor this reason?
Agreed, AFAIK the delta board is the only one to require loady.
Regards
Markus Klotzb?cher
PATCH RESEND 1/1 make y-modem a separate config option
Hi Markus,
Quoted 3 lines · Markus Klotzb?cher
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
PATCH RESEND 1/1 make y-modem a separate config option
Hi Anders,
Quoted 8 lines · Anders Larsen
Quoted 3 lines · Markus Klotzb?cher
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
PATCH RESEND 1/1 make y-modem a separate config option
Quoted 8 lines · Markus Klotzb?cher
Quoted 3 lines · Anders Larsen
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 (mainlycommon/xyzModem.candu-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