]> git.sur5r.net Git - openocd/commitdiff
armv7m: use ARM_MODE_THREAD core mode for algoorithm's
authorSpencer Oliver <spen@spen-soft.co.uk>
Fri, 1 Feb 2013 15:50:20 +0000 (15:50 +0000)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Sat, 2 Feb 2013 16:22:25 +0000 (16:22 +0000)
This makes sure we are using privileged mode when executing any loaders.

Change-Id: I18bf32ec92e1c76a66ab25e3712652bc3650b332
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1108
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
src/flash/nor/cfi.c
src/flash/nor/efm32.c
src/flash/nor/em357.c
src/flash/nor/fm3.c
src/flash/nor/lpc2000.c
src/flash/nor/lpcspifi.c
src/flash/nor/stellaris.c
src/flash/nor/stm32f1x.c
src/flash/nor/stm32f2x.c
src/flash/nor/stm32lx.c
src/target/armv7m.c

index 81a58cec6569773bf0476ce5ff5713e8f9ed4f45..cb05021573f51e66b7067f9b5d30a944557bf57e 100644 (file)
@@ -1778,7 +1778,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
 
        if (is_armv7m(target_to_armv7m(target))) {      /* armv7m target */
                armv7m_algo.common_magic = ARMV7M_COMMON_MAGIC;
-               armv7m_algo.core_mode = ARM_MODE_ANY;
+               armv7m_algo.core_mode = ARM_MODE_THREAD;
                arm_algo = &armv7m_algo;
        } else if (is_arm(target_to_arm(target))) {
                /* All other ARM CPUs have 32 bit instructions */
index 52e732d6d889e8e25cf4ff06e52608f192bd2a08..295c70700f3c85453b5343684f1ebbcccf8e7959 100644 (file)
@@ -610,7 +610,7 @@ static int efm32x_write_block(struct flash_bank *bank, uint8_t *buf,
        buf_set_u32(reg_params[4].value, 0, 32, address);
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        ret = target_run_flash_async_algorithm(target, buf, count, 4,
                        0, NULL,
index e93af2f02ab482243d9e0f045e4f38b4c66c82a4..cbb71fc0629524b76c1aea5719a505849b25187f 100644 (file)
@@ -522,7 +522,7 @@ static int em357_write_block(struct flash_bank *bank, uint8_t *buffer,
        ;
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
        init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);
index aa5d58d10de9f6e681e49b66b9f2194e6856b340..9b52f151829925e7c76dcd13799f7cc37ead79bd 100644 (file)
@@ -502,7 +502,7 @@ static int fm3_write_block(struct flash_bank *bank, uint8_t *buffer,
        }
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT); /* source start address */
        init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT); /* target start address */
index 1aa3b91477b35aefd944c65bb5e72f7c91d66e88..36f0bfa903497caa5fc279f6d668e72a0b31b2ca 100644 (file)
@@ -309,7 +309,7 @@ static int lpc2000_iap_call(struct flash_bank *bank, struct working_area *iap_wo
        switch (lpc2000_info->variant) {
                case lpc1700:
                        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-                       armv7m_info.core_mode = ARM_MODE_ANY;
+                       armv7m_info.core_mode = ARM_MODE_THREAD;
                        iap_entry_point = 0x1fff1ff1;
                        break;
                case lpc2000_v1:
index 89e8f0376ec6e22e822af8c9af4f35b5692e1531..2b4d6f6155b672b15a4d559bfdf8d02ada50e461 100644 (file)
@@ -182,7 +182,7 @@ static int lpcspifi_set_hw_mode(struct flash_bank *bank)
        };
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
 
        LOG_DEBUG("Allocating working area for SPIFI init algorithm");
@@ -519,7 +519,7 @@ static int lpcspifi_erase(struct flash_bank *bank, int first, int last)
        };
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
 
        /* Get memory for spifi initialization algorithm */
@@ -726,7 +726,7 @@ static int lpcspifi_write(struct flash_bank *bank, uint8_t *buffer,
        };
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        init_reg_param(&reg_params[0], "r0", 32, PARAM_IN_OUT);         /* buffer start, status (out) */
        init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);            /* buffer end */
index cd0311a49a20eeeb322dd5aa359aa92346347616..54536f6ffaa9b6aec4688d759002bd281a362176 100644 (file)
@@ -1045,7 +1045,7 @@ static int stellaris_write_block(struct flash_bank *bank,
                        (uint8_t *) stellaris_write_code);
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
        init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);
index 6ca814a7d33314b7b7bb473951e2fd6b50a2c299..17df121b7c56802192cdde0695cd01686dfa5617 100644 (file)
@@ -656,7 +656,7 @@ static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer,
        buf_set_u32(reg_params[4].value, 0, 32, address);
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        retval = target_run_flash_async_algorithm(target, buffer, count, 2,
                        0, NULL,
index 22cc9cf1600457ed47b1e4c6800928ae2f8a5f98..7a4352fdd8a8aa98abda841adf0a8886c3718843 100644 (file)
@@ -558,7 +558,7 @@ static int stm32x_write_block(struct flash_bank *bank, uint8_t *buffer,
        };
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        init_reg_param(&reg_params[0], "r0", 32, PARAM_IN_OUT);         /* buffer start, status (out) */
        init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);            /* buffer end */
index 8b09387ed051c6ff989bea0fe37cca33e1c57f69..ebc7534e8645ca92ee813ae6fa428f568dd08a37 100644 (file)
@@ -283,7 +283,7 @@ static int stm32lx_write_half_pages(struct flash_bank *bank, uint8_t *buffer,
        }
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
        init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
        init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);
        init_reg_param(&reg_params[2], "r2", 32, PARAM_OUT);
index 9740a28c5790e6caafe5537e8d594601e0d84a8c..0f447237f22e71202ad489aa8902348e98282dd4 100644 (file)
@@ -661,7 +661,7 @@ int armv7m_checksum_memory(struct target *target,
                goto cleanup;
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        init_reg_param(&reg_params[0], "r0", 32, PARAM_IN_OUT);
        init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);
@@ -721,7 +721,7 @@ int armv7m_blank_check_memory(struct target *target,
                return retval;
 
        armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
-       armv7m_info.core_mode = ARM_MODE_ANY;
+       armv7m_info.core_mode = ARM_MODE_THREAD;
 
        init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
        buf_set_u32(reg_params[0].value, 0, 32, address);