Hi Øyvind,

--- Øyvind Harboe <[email protected]> schrieb am Fr, 26.11.2010:

> Von: Øyvind Harboe <[email protected]>
> Betreff: Re: [Openocd-development] LPC2919 segmentation fault
> An: "MIroslav Dušek" <[email protected]>
> CC: [email protected]
> Datum: Freitag, 26. November, 2010 21:44 Uhr
> 2010/11/26 MIroslav Dušek <[email protected]>:
> > Hi ,
> > Thank you for help.
> > I am sorry, but what is openocd master branch?
> 
> 0.4 is quite old. Your problem may have been long fixed.
> 
> clone the openocd git repository, check out the master
> branch build OpenOCD.
>

The probe failure was expected for this (broken) device.
However, a repeated probe should have failed as well, but it didn't. The 
attached patch corrects this.

As this is my first attempt to send a git patch, please don't be too angry if I 
did something stupidly wrong...

Regards,
Rolf


From 39667c08349256b92e352d9577d01df05b2b4b76 Mon Sep 17 00:00:00 2001
From: Rolf Meeser <[email protected]>
Date: Fri, 26 Nov 2010 22:19:34 +0100
Subject: [PATCH 1/2] LPC2900 flash driver: Avoid false positive reprobing if first probing fails.

---
 src/flash/nor/lpc2900.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c
index e17823e..f18aab4 100644
--- a/src/flash/nor/lpc2900.c
+++ b/src/flash/nor/lpc2900.c
@@ -132,6 +132,11 @@
 struct lpc2900_flash_bank
 {
 	/**
+	 * This flag is set when the device has been successfully probed.
+	 */
+	bool is_probed;
+
+	/**
 	 * Holds the value read from CHIPID register.
 	 * The driver will not load if the chipid doesn't match the expected
 	 * value of 0x209CE02B of the LPC2900 family. A probe will only be done
@@ -255,7 +260,7 @@ static uint32_t lpc2900_is_ready( struct flash_bank *bank )
 {
 	struct lpc2900_flash_bank *lpc2900_info = bank->driver_priv;
 
-	if( lpc2900_info->chipid != EXPECTED_CHIPID )
+	if( lpc2900_info->is_probed )
 	{
 		return ERROR_FLASH_BANK_NOT_PROBED;
 	}
@@ -1050,6 +1055,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2900_flash_bank_command)
 
 	/* Chip ID will be obtained by probing the device later */
 	lpc2900_info->chipid = 0;
+	lpc2900_info->is_probed = false;
 
 	return ERROR_OK;
 }
@@ -1554,10 +1560,8 @@ static int lpc2900_probe(struct flash_bank *bank)
 		return ERROR_TARGET_NOT_HALTED;
 	}
 
-	/* We want to do this only once. Check if we already have a valid CHIPID,
-	 * because then we will have already successfully probed the device.
-	 */
-	if (lpc2900_info->chipid == EXPECTED_CHIPID)
+	/* We want to do this only once. */
+	if (lpc2900_info->is_probed)
 	{
 		return ERROR_OK;
 	}
@@ -1730,6 +1734,8 @@ static int lpc2900_probe(struct flash_bank *bank)
 		return ERROR_FLASH_OPERATION_FAILED;
 	}
 
+	lpc2900_info->is_probed = true;
+
 	return ERROR_OK;
 }
 
-- 
1.7.2.3

From b6fcc72b51769f1328c6a547cb0d8f51c8a099c8 Mon Sep 17 00:00:00 2001
From: Rolf Meeser <[email protected]>
Date: Fri, 26 Nov 2010 22:38:49 +0100
Subject: [PATCH 2/2] Remove a stray comment

---
 src/flash/nor/lpc2900.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c
index f18aab4..e22634c 100644
--- a/src/flash/nor/lpc2900.c
+++ b/src/flash/nor/lpc2900.c
@@ -517,8 +517,6 @@ static uint32_t lpc2900_calc_tr( uint32_t clock_var, uint32_t time_var )
 	/*           ((time[µs]/1e6) * f[Hz]) + 511
 	 * FPTR.TR = -------------------------------
 	 *                         512
-	 *
-	 * The result is the
 	 */
 
 	uint32_t tr_val = (uint32_t)((((time_var / 1e6) * clock_var) + 511.0) / 512.0);
-- 
1.7.2.3

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to