summaryrefslogtreecommitdiff
path: root/src/target/target.h
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2010-04-04 00:42:05 -0700
committerDavid Brownell <dbrownell@users.sourceforge.net>2010-04-04 00:42:05 -0700
commit876bf9bf4cd5fc2640d91811fb69c0d36f9e2c18 (patch)
tree5baff955b5886bd71d66bc950677448d672182a0 /src/target/target.h
parent88fcb5a9ef971e54166de7cd16a3b0be20113b82 (diff)
downloadopenocd+libswd-876bf9bf4cd5fc2640d91811fb69c0d36f9e2c18.tar.gz
openocd+libswd-876bf9bf4cd5fc2640d91811fb69c0d36f9e2c18.tar.bz2
openocd+libswd-876bf9bf4cd5fc2640d91811fb69c0d36f9e2c18.tar.xz
openocd+libswd-876bf9bf4cd5fc2640d91811fb69c0d36f9e2c18.zip
target: are we running algorithm code?
Fixing one bug can easily uncover another .... in this case, making sure that we properly invalidate some cached NOR state when resuming arbitrary target code turned up an issue when the code wasn't quite arbitrary (and we couldn't know that, but some parts of OpenOCD assumed the cache would not be invalidated. Specifically: some flash drivers (like CFI) update that state in loops with downloaded algorithms, thus invalidating the state as it's probed. + Add a new target state flag, to record whether the target is running downloaded algorithm code. + Use that flag to add a special case: "trust" downloaded algorithms not to corrupt that cached state, bypassing cache invalidation. Also update some of the documentation to stipulate that this flavor of trustworthiness is now *required* ... not just a fortuitous acident. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/target/target.h')
-rw-r--r--src/target/target.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/target/target.h b/src/target/target.h
index 7400b7e1..562724ba 100644
--- a/src/target/target.h
+++ b/src/target/target.h
@@ -117,6 +117,14 @@ struct target
*/
bool examined;
+ /** true iff the target is currently running a downloaded
+ * "algorithm" instetad of arbitrary user code. OpenOCD code
+ * invoking algorithms is trusted to maintain correctness of
+ * any cached state (e.g. for flash status), which arbitrary
+ * code will have no reason to know about.
+ */
+ bool running_alg;
+
struct target_event_action *event_action;
int reset_halt; /* attempt resetting the CPU into the halted mode? */