aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpencer Oliver <spen@spen-soft.co.uk>2012-05-03 16:30:31 +0100
committerSpencer Oliver <spen@spen-soft.co.uk>2012-05-14 09:29:16 +0000
commitca53849045b9d505a13d9ec98ff6e58ce13b14f0 (patch)
tree910ca2149d87d9deb2efa2d24149b1198d4717a1 /src
parentd2d4f776d8e24e8e651d1c896c90c15c38633172 (diff)
downloadriscv-openocd-ca53849045b9d505a13d9ec98ff6e58ce13b14f0.zip
riscv-openocd-ca53849045b9d505a13d9ec98ff6e58ce13b14f0.tar.gz
riscv-openocd-ca53849045b9d505a13d9ec98ff6e58ce13b14f0.tar.bz2
cfi: check supported arch
check that the cfi driver supports the current target arch. Change-Id: I8a95908684de67bf1657d1956f2573662a641cc1 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/614 Tested-by: jenkins Reviewed-by: Aurelien Jacobs <aurel@gnuage.org>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/cfi.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c
index 398dd61..80d0455 100644
--- a/src/flash/nor/cfi.c
+++ b/src/flash/nor/cfi.c
@@ -1219,19 +1219,19 @@ static int cfi_intel_write_block(struct flash_bank *bank, uint8_t *buffer,
uint32_t target_code_size;
int retval = ERROR_OK;
- /* todo: if ( (!is_armv7m(target_to_armv7m(target)) && (!is_arm(target_to_arm(target)) )
- **/
- if (strncmp(target_type_name(target), "mips_m4k", 8) == 0) {
- LOG_ERROR("Your target has no flash block write support yet.");
- return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
+ /* check we have a supported arch */
+ if (is_arm(target_to_arm(target))) {
+ /* All other ARM CPUs have 32 bit instructions */
+ arm_algo.common_magic = ARM_COMMON_MAGIC;
+ arm_algo.core_mode = ARM_MODE_SVC;
+ arm_algo.core_state = ARM_STATE_ARM;
+ } else {
+ LOG_ERROR("Unknown architecture");
+ return ERROR_FAIL;
}
cfi_intel_clear_status_register(bank);
- arm_algo.common_magic = ARM_COMMON_MAGIC;
- arm_algo.core_mode = ARM_MODE_SVC;
- arm_algo.core_state = ARM_STATE_ARM;
-
/* If we are setting up the write_algorith, we need target_code_src
* if not we only need target_code_size. */