Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.233
diff -u -r1.233 ChangeLog
--- ChangeLog	3 Sep 2005 13:35:08 -0000	1.233
+++ ChangeLog	8 Sep 2005 09:38:33 -0000
@@ -1,3 +1,9 @@
+2005-09-08  Stefan Sommerfeld  <sommerfeld@mikrom.com>
+   * src/flash.c: Fix usage of "fis create", more arguments are optional
+   * src/flash.c: Fix mem_base was set to flash_addr instead of mem_addr 
+   for a loaded image
+   * src/io.c: Add support for cursor-key editing using a ESC code filter
+
 2005-09-03  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* cdl/redboot.cdl: White space changes to aid readability. 
Index: src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.75
diff -u -r1.75 flash.c
--- src/flash.c	3 Sep 2005 13:10:22 -0000	1.75
+++ src/flash.c	8 Sep 2005 09:36:24 -0000
@@ -113,7 +113,7 @@
     );
 local_cmd_entry("create",
                 "Create an image",
-                "-b <mem_base> -l <image_length> [-s <data_length>]\n"
+                "[-b <mem_base>] [-l <image_length>] [-s <data_length>]\n"
                 "      [-f <flash_addr>] [-e <entry_point>] [-r <ram_addr>] [-n] <name>",
                 fis_create,
                 FIS_cmds
@@ -940,7 +940,7 @@
         memset(img, 0, sizeof(*img));
         strcpy(img->name, name);
         img->flash_base = flash_addr;
-        img->mem_base = exec_addr_set ? exec_addr : (flash_addr_set ? flash_addr : mem_addr);
+        img->mem_base = exec_addr_set ? exec_addr : (mem_addr_set ? mem_addr : flash_addr);
         img->entry_point = entry_addr_set ? entry_addr : (CYG_ADDRESS)entry_address;  // Hope it's been set
         img->size = length;
         img->data_length = img_size;
Index: src/io.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/io.c,v
retrieving revision 1.32
diff -u -r1.32 io.c
--- src/io.c	5 Dec 2003 12:51:55 -0000	1.32
+++ src/io.c	8 Sep 2005 09:49:29 -0000
@@ -353,6 +353,7 @@
     int _index = _cl_index;  // Last saved line
     char *xp;
 #endif
+    char esc_seq = 0;
 
     // Display current buffer data
     while (*eol) {
@@ -387,8 +388,40 @@
             mon_read_char(&c);
         }
         *eol = '\0';
-        switch (c) {
 #define CTRL(c) ((c)&0x1F)
+        if (c == 0x1b)			// got escape
+        {
+        	   esc_seq = 1;
+        	   continue;
+        }
+        else if ((c == '[') && (esc_seq == 1))
+        {
+        	   esc_seq = 2;
+        	   continue;
+        }
+        else if (esc_seq == 2)
+        {
+        	   switch(c)
+        	   {
+        	  	case 'A':			// up arrow
+        	  		c = CTRL('P');
+        	  		break;
+        	  	case 'B':			// down arrow
+        	  		c = CTRL('N');
+        	  		break;
+        	  	case 'C':			// left arrow
+        	  		c = CTRL('F');
+        	  		break;
+        	  	case 'D':			// right arrow
+        	  		c = CTRL('B');
+        	  		break;
+        	  	default:
+        	  		c = 0;			// kill ESC character
+        	   }
+        }
+        esc_seq = 0;
+        
+        switch (c) {
 #if CYGNUM_REDBOOT_CMD_LINE_EDITING != 0
         case CTRL('P'):
             // Fetch the previous line into the buffer
@@ -507,10 +540,10 @@
                 break;
             }
             // End of line
-	    if (console_echo) {
+            if (console_echo) {
                 mon_write_char('\r');
                 mon_write_char('\n');
-	    }
+            }
             last_ch = c;
 #if CYGNUM_REDBOOT_CMD_LINE_EDITING != 0
             if (cmd_history) {
@@ -518,11 +551,11 @@
 #ifdef CYGBLD_REDBOOT_CMD_LINE_HISTORY
 		expand_history(buf);
 #endif
-		if (*buf != '\0') {
-		    if (++_cl_index == _CL_NUM_LINES) _cl_index = 0;
-		    if (_cl_index > _cl_max_index) _cl_max_index = _cl_index;
-		    strcpy(_cl_lines[_cl_index], buf);
-		}
+                if (*buf != '\0') {
+                    if (++_cl_index == _CL_NUM_LINES) _cl_index = 0;
+                    if (_cl_index > _cl_max_index) _cl_max_index = _cl_index;
+                    strcpy(_cl_lines[_cl_index], buf);
+                }
             }
 #endif
             return _GETS_OK;
