summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Oliver <ntfreak@users.sourceforge.net>2011-01-06 10:35:59 +0000
committerSpencer Oliver <ntfreak@users.sourceforge.net>2011-01-06 10:35:59 +0000
commitaa61a3b3d8b6acad19050987835ec05f3d298bdb (patch)
tree9fc64a755093f39d9728c1f04a0ff00952246728
parent7351eecf6a6f1bf271c581f7f75525c3f9f44039 (diff)
downloadopenocd+libswd-aa61a3b3d8b6acad19050987835ec05f3d298bdb.tar.gz
openocd+libswd-aa61a3b3d8b6acad19050987835ec05f3d298bdb.tar.bz2
openocd+libswd-aa61a3b3d8b6acad19050987835ec05f3d298bdb.tar.xz
openocd+libswd-aa61a3b3d8b6acad19050987835ec05f3d298bdb.zip
cfi: use safer arch detection
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
-rw-r--r--src/flash/nor/cfi.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c
index b55e6699..4fc800d4 100644
--- a/src/flash/nor/cfi.c
+++ b/src/flash/nor/cfi.c
@@ -29,6 +29,7 @@
#include "cfi.h"
#include "non_cfi.h"
#include <target/arm.h>
+#include <target/arm7_9_common.h>
#include <target/armv7m.h>
#include <helper/binarybuffer.h>
#include <target/algorithm.h>
@@ -1644,18 +1645,23 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
0xeafffffe /* b 8204 <sp_8_done> */
};
- if(strcmp("cortex_m3", target_type_name(target)) == 0) /* Cortex-M3 target */
+ if (is_armv7m(target_to_armv7m(target))) /* Cortex-M3 target */
{
armv4_5_info.common_magic = ARMV7M_COMMON_MAGIC;
armv4_5_info.core_mode = ARMV7M_MODE_HANDLER;
armv4_5_info.core_state = ARM_STATE_ARM;
}
- else /* right now is only armv4_5 target */
+ else if (is_arm7_9(target_to_arm7_9(target)))
{
armv4_5_info.common_magic = ARM_COMMON_MAGIC;
armv4_5_info.core_mode = ARM_MODE_SVC;
armv4_5_info.core_state = ARM_STATE_ARM;
}
+ else
+ {
+ /* fallback to slow writes */
+ return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
+ }
int target_code_size;
const uint32_t *target_code_src;