From 62b32254f363730a11b9a4cb376ff4e6161646ba Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 21 Dec 1994 21:02:56 +0000 Subject: [PATCH] * monitor.c: Now supports xmodem as a remoteloadprotocol. --- gdb/ChangeLog | 4 ++++ gdb/monitor.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index eb3c31e8a28..6efb4be55bf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +Wed Dec 21 14:00:26 1994 Rob Savoye + + * monitor.c: Now supports xmodem as a remoteloadprotocol. + Tue Dec 20 23:01:17 1994 Stu Grossman (grossman@cygnus.com) * config/mips/xm-irix4.h, config/mips/xm-irix5.h: #define diff --git a/gdb/monitor.c b/gdb/monitor.c index 031c0e3073d..6e02e13b39e 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -1058,22 +1058,33 @@ monitor_load (file, fromtty) if (STREQ (loadtype_str, "default")) { /* default, load a binary */ gr_load_image (file, fromtty); /* by writing it into memory */ + return; + } + + /* load an srecord by converting */ + if ((STREQ (loadtype_str, "srec")) && STREQ (loadproto_str, "xmodem")) { + monitor_load_srec(file, XMODEM); + return; } if (STREQ (loadtype_str, "srec")) { /* load an srecord by converting */ monitor_load_srec(file, 0); /* if from a binary */ + return; } if (STREQ (loadtype_str, "none")) { /* load an srecord by converting */ error ("Unimplemented"); + return; } if (STREQ (loadproto_str, "none")) { /* load an srecord file */ monitor_load_ascii_srec(file, fromtty); /* if from a binary */ + return; } if (STREQ (loadproto_str, "xmodem")) { /* load an srecord using the */ monitor_load_srec(file, XMODEM); + return; } } @@ -1239,9 +1250,14 @@ monitor_load_srec (args, protocol) write_monitor (packet, XMODEM_PACKETSIZE+1); /* send it again */ if (GETACK) /* ACKnowledged, get next data chunk */ break; + } else { /* assume we got an ACK */ + if (hashmark) + printf_filtered ("#"); + debuglogs (3, "Got an ACK, sending next packet"); + break; } } - if (retries >= 4) { /* too many tries, must be hosed */ + if (retries >= 4) { /* too many tries, must be hosed */ printf_monitor ("%c", EOT); error ("Never got a ACK after sending an xmodem packet"); } @@ -1265,8 +1281,14 @@ monitor_load_srec (args, protocol) write a type 7 terminator record. no data for a type 7, and there is no data, so len is 0. */ - monitor_make_srec (srec, 7, abfd->start_address, "", 0); - printf_monitor ("%s\n", srec); + if (protocol == XMODEM) { /* send a packet using xmodem */ + monitor_make_srec (srec, 7, abfd->start_address, "", 0); + make_xmodem_packet (packet, srec, XMODEM_DATASIZE); + write_monitor (packet, XMODEM_PACKETSIZE+1); + } else { + monitor_make_srec (srec, 7, abfd->start_address, "", 0); + printf_monitor ("%s\n", srec); + } if (protocol == XMODEM) { printf_monitor ("%c", EOT); if (!GETACK) @@ -1460,9 +1482,10 @@ make_xmodem_packet (packet, data, len) packet[XMODEM_PACKETSIZE] = sum & 0xff; /* add the checksum */ - if (sr_get_debug() > 4) + if (sr_get_debug() > 4) { debuglogs (4, "The xmodem checksum is %d (0x%x)\n", sum & 0xff, sum & 0xff); print_xmodem_packet (packet); + } } /* -- 2.30.2