[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: DEC 3000 problems



On Tue, Oct 19, 2004 at 07:00:44PM +0200, Jan-Benedict Glaw wrote:
> On Tue, 2004-10-19 00:22:32 +0200, Peter 'p2' De Schrijver <p2@mind.be>
> wrote in message <[🔎] 20041018222231.GB19273@mind.be>:
> > That's why I wanted to load a program in memory using DEPOSIT commands
> > and run the program using the START command. This program would then
> > download a new firmware image and flash it.
> 
> So you want to shift the whole flashing program plus the new ROM
> contents through the serial link into your alpha and START it?
> 

Basically yes, although I want to do it in 2 stages. stage 1 : small
program which does XMODEM. stage 2 : load the firmware and flash. stage
1 loader would be loaded using DEPOSIT.

> In this case, maybe it's the easiest thing to just squeeze the firmware
> update MOP image into it and start it. It should basically be a PIC
> image, so that should work.
> 

Good idea ! I guess the tftp image should work as well, at least I don't
see why it would not.

> If it fscks up your box, we can still take the soldering iron.
> 
> > > 	  http://cvs.sourceforge.net/viewcvs.py/linux-vax/usr/firmware_dumper/)
> > 
> > Good idea.
> 

Ok.

> Send me the patch once it's done:-)
> 

See attachement. It probably needs more testing though :)

Cheers,

Peter (p2).
diff -uN usr/firmware_dumper/backend_alpha.c firmware_dumper.alpha/backend_alpha.c
--- usr/firmware_dumper/backend_alpha.c	1970-01-01 01:00:00.000000000 +0100
+++ firmware_dumper.alpha/backend_alpha.c	2004-10-19 00:16:29.000000000 +0200
@@ -0,0 +1,97 @@
+#include <stdio.h>
+#include <string.h>
+#include "main.h"
+#include <unistd.h>
+#include "serial.h"
+
+int
+alpha_init (int fd)
+{
+	unsigned char one_byte;
+	int ret;
+
+	serial_send_break (fd, 0);
+	do {
+		ret = serial_read_byte (fd, &one_byte, 1, 0);
+	} while (ret == 0);
+	sleep (3);
+	do {
+		ret = serial_read_byte (fd, &one_byte, 1, 0);
+	} while (ret == 0);
+
+	return 0;
+}
+
+int
+alpha_get_byte (int fd, unsigned char *output, unsigned long long int address)
+{
+	unsigned char output_buffer[100];
+	unsigned char input_buffer[200];
+	unsigned char *ptr;
+	int ret;
+	int input_len = 0;
+
+	sprintf (output_buffer, "EXAMINE -B -PM -U %016llx\r\n",  address);
+	serial_write (fd, output_buffer, strlen (output_buffer));
+
+	bzero (input_buffer, sizeof (input_buffer));
+	do {
+		ret = serial_read_byte (fd, &input_buffer[input_len], 1, 0);
+		if (ret == 0)
+			input_len++;
+	} while (ret == 0 && input_len < sizeof (input_buffer) && !strstr (input_buffer, ">>> "));
+
+	if (ret)
+		return -1;
+
+	ptr = input_buffer;
+	/* Over-read first line */
+	while (*ptr != '\n' && *ptr != '\r')
+		ptr++;
+	while (*ptr == '\n' || *ptr == '\r')
+		ptr++;
+	ptr++;
+
+	/* Strip leading spaces of second line */
+	while (*ptr == ' ')
+		ptr++;
+
+	/* Over-read 'P' */
+	ptr+=5;
+
+	/* Strip leading spaces of second line */
+	while (*ptr == ' ')
+		ptr++;
+
+	/* Strip address */
+	while (			((*ptr >= '0') && (*ptr <= '9'))
+			||	((*ptr >= 'a') && (*ptr <= 'z'))
+			||	((*ptr >= 'A') && (*ptr <= 'Z'))
+			||	(*ptr == '.'))
+		*ptr++;
+
+	/* Strip leading spaces */
+	while (*ptr == ' ')
+		ptr++;
+
+	/* Now get the byte */
+	if (*ptr >= 'A' && *ptr <= 'Z')
+		*ptr = *ptr - 'A' + 'a';
+	if (*ptr >= '0' && *ptr <= '9')
+		*output = *ptr - '0';
+	else
+		*output = *ptr - 'a' + 10;
+
+	*output <<= 4;
+	ptr++;
+
+	if (*ptr >= 'A' && *ptr <= 'Z')
+		*ptr = *ptr - 'A' + 'a';
+	if (*ptr >= '0' && *ptr <= '9')
+		*output |= *ptr - '0';
+	else
+		*output |= *ptr - 'a' + 10;
+
+	return 0;
+}
+
diff -uN usr/firmware_dumper/main.c firmware_dumper.alpha/main.c
--- usr/firmware_dumper/main.c	2004-10-05 13:49:52.000000000 +0200
+++ firmware_dumper.alpha/main.c	2004-10-19 00:01:37.000000000 +0200
@@ -43,6 +43,12 @@
 		.init		= &vax_init,
 		.get_byte	= &vax_get_byte,
 	},
+	{
+		.name		= "alpha",
+		.wordsize	= 64,
+		.init		= &alpha_init,
+		.get_byte	= &alpha_get_byte,
+	},
 };
 
 
diff -uN usr/firmware_dumper/main.h firmware_dumper.alpha/main.h
--- usr/firmware_dumper/main.h	2004-07-23 19:44:47.000000000 +0200
+++ firmware_dumper.alpha/main.h	2004-10-19 00:02:09.000000000 +0200
@@ -5,4 +5,7 @@
 extern int vax_get_byte (int fd, unsigned char *output, unsigned long long int address);
 extern int vax_fini (int fd);
 
+extern int alpha_init (int fd);
+extern int alpha_get_byte (int fd, unsigned char *output, unsigned long long int address);
+
 #endif /* _MAIN_H */
diff -uN usr/firmware_dumper/Makefile firmware_dumper.alpha/Makefile
--- usr/firmware_dumper/Makefile	2004-07-23 19:44:47.000000000 +0200
+++ firmware_dumper.alpha/Makefile	2004-10-19 00:00:29.000000000 +0200
@@ -2,6 +2,7 @@
 
 OBJECTS=	main.o		\
 		backend_vax.o	\
+		backend_alpha.o	\
 		serial.o
 
 all:	dumper

Attachment: signature.asc
Description: Digital signature


Reply to: