Hi all,

The following patch fixes a type-punned pointer problem in the str9x
flash module.  I was seeing this a while back (and had a patch for it
floating around then), but it had disappeared off my radar for some
reason that I still can't explain (maybe different -O options?).

Cheers,

Zach

Index: src/flash/str9x.c
===================================================================
--- src/flash/str9x.c	(revision 1478)
+++ src/flash/str9x.c	(working copy)
@@ -194,6 +194,7 @@
 	int i;
 	u32 adr;
 	u32 status = 0;
+	u16 hstatus = 0;
 
 	if (bank->target->state != TARGET_HALTED)
 	{
@@ -212,10 +213,11 @@
 			{
 				return retval;
 			}
-			if ((retval=target_read_u16(target, adr, (u16*)&status))!=ERROR_OK)
+			if ((retval=target_read_u16(target, adr, &hstatus))!=ERROR_OK)
 			{
 				return retval;
 			}
+			status = hstatus;
 		}
 		else
 		{
@@ -237,10 +239,11 @@
 		{
 			return retval;
 		}
-		if ((retval=target_read_u16(target, adr, (u16*)&status))!=ERROR_OK)
+		if ((retval=target_read_u16(target, adr, &hstatus))!=ERROR_OK)
 		{
 			return retval;
 		}
+		status = hstatus;
 	}
 	
 	/* read array command */
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to