This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: redboot - eCos question


On Tue, 2001-10-02 at 04:21, Dmitry Ryzhkov wrote:
> Hi All,
> 
> Sorry for (may be) stuppied question, but it is my first try with eCos...
> 
> I've downloaded redboot for x86 (redboot.bin, ~56k) and I'm trying to 
> communicate with it from another (host) PC via minicom.
> 
> RedBoot presents himself through both videcard and com port, but understands 
> commands only from keyboard. As well as do not say on COM anything except 
> initial message, but uses videout instead. Of course, as result I can't load 
> nothing because it sends CCCCC$$... to videout instead of COM port...
> 
> It looks like it forgot about COMs just after startup...
> 
> May be you can help me with it? How to tell him that I wand to send commands 
> and data (load -r -m xMODEM ...) through com port? Because I can't type my 
> code on keyboard... :)
> 
> 
> Many thanks in advance!

The current version of RedBoot does not support this.  The attached 
patch will add an option to "load" to allow you to specify which I/O
channel to use.  In your case, I think you'll want to use:
  RedBoot> load -c 0 -m xm
to download using the serial port instead of the video console.

This patch should apply cleanly against the current anonCVS sources.

Index: redboot/current/ChangeLog
===================================================================
RCS file: /home/cvs/ecc/ecc/redboot/current/ChangeLog,v
retrieving revision 1.225
diff -u -5 -p -r1.225 ChangeLog
--- redboot/current/ChangeLog	1 Oct 2001 13:31:46 -0000	1.225
+++ redboot/current/ChangeLog	2 Oct 2001 00:44:03 -0000
@@ -1,5 +1,12 @@
+2001-10-02  Gary Thomas  <gthomas@redhat.com>
+
+	* src/xyzModem.h: 
+	* src/xyzModem.c (xyzModem_stream_open): 
+	* src/load.c (do_load): Add new option "-c <N>" to let the user
+	specify the I/O channel to use - xyModem only.
+
 2001-10-01  Gary Thomas  <gthomas@redhat.com>
 
 	* src/net/udp.c (__udp_recvfrom): Don't change server address (returned
 	by this function) until a packet has been received with no timeout.
 
Index: redboot/current/src/load.c
===================================================================
RCS file: /home/cvs/ecc/ecc/redboot/current/src/load.c,v
retrieving revision 1.38
diff -u -5 -p -r1.38 load.c
--- redboot/current/src/load.c	26 Sep 2001 10:46:36 -0000	1.38
+++ redboot/current/src/load.c	2 Oct 2001 00:42:02 -0000
@@ -290,15 +290,17 @@ do_load(int argc, char *argv[])
     char *hostname;
 #endif
 #ifdef CYGPKG_COMPRESS_ZLIB
     bool decompress;
 #endif
+    int chan = -1;
+    bool chan_set;
     unsigned long base = 0;
     unsigned long end = 0;
     char type[4];
     char *filename = 0;
-    struct option_info opts[6];
+    struct option_info opts[7];
 
 #ifdef CYGPKG_REDBOOT_NETWORKING
     memset((char *)&host, 0, sizeof(host));
     host.sin_len = sizeof(host);
     host.sin_family = AF_INET;
@@ -318,10 +320,15 @@ do_load(int argc, char *argv[])
     init_opts(&opts[2], 'b', true, OPTION_ARG_TYPE_NUM, 
               (void **)&base, (bool *)&base_addr_set, "load address");
     init_opts(&opts[3], 'm', true, OPTION_ARG_TYPE_STR, 
               (void **)&mode_str, (bool *)&mode_str_set, "download mode (TFTP, xyzMODEM, or disk)");
     num_options = 4;
+#if CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS > 1
+    init_opts(&opts[num_options], 'c', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&chan, (bool *)&chan_set, "I/O channel");
+    num_options++;
+#endif
 #ifdef CYGPKG_REDBOOT_NETWORKING
     init_opts(&opts[num_options], 'h', true, OPTION_ARG_TYPE_STR, 
               (void **)&hostname, (bool *)&hostname_set, "host name or IP address");
     num_options++;
 #endif
@@ -391,10 +398,24 @@ do_load(int argc, char *argv[])
         diag_printf("File name missing\n");
         diag_printf("usage: load %s\n", usage);
         return;
     }
 #endif
+#if CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS > 1
+    if (chan_set) {
+        if ((mode != MODE_XMODEM) && (mode != MODE_YMODEM) && (mode != MODE_ZMODEM)) {
+            diag_printf("I/O channel can only be used with {xyz}Modem\n");
+            return;
+        }
+        if (chan >= CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS) {
+            diag_printf("Invalid I/O channel: %d\n", chan);
+            return;
+        }
+    } else {
+        chan = -1;
+    }
+#endif
 #ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS
     if (base_addr_set &&
         ((base < (unsigned long)user_ram_start) ||
          (base > (unsigned long)user_ram_end))) {
         if (!verify_action("Specified address (%p) is not believed to be in RAM", (void*)base))
@@ -424,11 +445,11 @@ do_load(int argc, char *argv[])
         }
         redboot_getc_init(disk_stream_read, verbose);
     }
 #endif
     else {
-        res = xyzModem_stream_open(filename, mode, &err);
+        res = xyzModem_stream_open(filename, mode, chan, &err);
         if (res < 0) {
             diag_printf("Can't load '%s': %s\n", filename, xyzModem_error(err));
             return;
         }
         // Suppress verbosity when using xyz modem download
Index: redboot/current/src/xyzModem.c
===================================================================
RCS file: /home/cvs/ecc/ecc/redboot/current/src/xyzModem.c,v
retrieving revision 1.12
diff -u -5 -p -r1.12 xyzModem.c
--- redboot/current/src/xyzModem.c	24 Aug 2001 16:35:33 -0000	1.12
+++ redboot/current/src/xyzModem.c	2 Oct 2001 00:38:34 -0000
@@ -293,11 +293,11 @@ xyzModem_get_hdr(void)
     // If we get here, the message passes [structural] muster
     return 0;
 }
 
 int 
-xyzModem_stream_open(char *filename, int mode, int *err)
+xyzModem_stream_open(char *filename, int mode, int chan, int *err)
 {
     int console_chan, stat;
     int retries = xyzModem_MAX_RETRIES;
     int crc_retries = xyzModem_MAX_RETRIES_WITH_CRC;
 
@@ -307,11 +307,15 @@ xyzModem_stream_open(char *filename, int
         return -1;
     }
 
     // Set up the I/O channel.  Note: this allows for using a different port in the future
     console_chan = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
-    CYGACC_CALL_IF_SET_CONSOLE_COMM(console_chan);
+    if (chan >= 0) {
+        CYGACC_CALL_IF_SET_CONSOLE_COMM(chan);
+    } else {
+        CYGACC_CALL_IF_SET_CONSOLE_COMM(console_chan);
+    }
     xyz.__chan = CYGACC_CALL_IF_CONSOLE_PROCS();
     CYGACC_CALL_IF_SET_CONSOLE_COMM(console_chan);
     CYGACC_COMM_IF_CONTROL(*xyz.__chan, __COMMCTL_SET_TIMEOUT, xyzModem_CHAR_TIMEOUT);
     xyz.len = 0;
     xyz.crc_mode = true;
Index: redboot/current/src/xyzModem.h
===================================================================
RCS file: /home/cvs/ecc/ecc/redboot/current/src/xyzModem.h,v
retrieving revision 1.3
diff -u -5 -p -r1.3 xyzModem.h
--- redboot/current/src/xyzModem.h	24 Aug 2001 16:35:33 -0000	1.3
+++ redboot/current/src/xyzModem.h	2 Oct 2001 00:31:40 -0000
@@ -60,11 +60,11 @@
 #define xyzModem_sequence -8
 
 #define xyzModem_close 1
 #define xyzModem_abort 2
 
-int   xyzModem_stream_open(char *filename, int mode, int *err);    
+int   xyzModem_stream_open(char *filename, int mode, int chan, int *err);    
 void  xyzModem_stream_close(int *err);    
 void  xyzModem_stream_terminate(int method, int (*getc)(void));    
 int   xyzModem_stream_read(char *buf, int size, int *err);    
 char *xyzModem_error(int err);
 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]