Add the support for the armv7m arch.
[openocd.git] / src / flash / nor / aduc702x.c
index c223ec470169acd348f560cd6fba1b9a005876b5..2005b78fc6ad35135bb4625c643e5223d346dd0e 100644 (file)
@@ -27,7 +27,7 @@
 #include <helper/binarybuffer.h>
 #include <helper/time_support.h>
 #include <target/algorithm.h>
-#include <target/armv4_5.h>
+#include <target/arm.h>
 
 
 static int aduc702x_build_sector_list(struct flash_bank *bank);
@@ -112,7 +112,7 @@ static int aduc702x_erase(struct flash_bank *bank, int first, int last)
 
                 if (aduc702x_check_flash_completion(target, 3500) != ERROR_OK)
                {
-                       LOG_ERROR("mass erase failed\n");
+                       LOG_ERROR("mass erase failed");
                         aduc702x_set_write_enable(target, 0);
                        return ERROR_FLASH_OPERATION_FAILED;
                }
@@ -132,7 +132,7 @@ static int aduc702x_erase(struct flash_bank *bank, int first, int last)
 
                         if (aduc702x_check_flash_completion(target, 50) != ERROR_OK)
                         {
-                                LOG_ERROR("failed to erase sector at address 0x%08lX\n", adr);
+                                LOG_ERROR("failed to erase sector at address 0x%08lX", adr);
                                 aduc702x_set_write_enable(target, 0);
                                 return ERROR_FLASH_SECTOR_NOT_ERASED;
                         }
@@ -165,7 +165,7 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32
        struct working_area *source;
        uint32_t address = bank->base + offset;
        struct reg_param reg_params[6];
-       struct armv4_5_algorithm armv4_5_info;
+       struct arm_algorithm armv4_5_info;
        int retval = ERROR_OK;
 
        if (((count%2)!=0)||((offset%2)!=0))
@@ -188,7 +188,7 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32
         r6 - set to 2, used to write flash command
 
         */
-        uint32_t aduc702x_flash_write_code[] = {
+        static const uint32_t aduc702x_flash_write_code[] = {
         //<_start>:
                 0xe3a05008,    // mov  r5, #8  ; 0x8
                 0xe5845004,    // str  r5, [r4, #4]
@@ -227,7 +227,7 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32
        }
 
        /* memory buffer */
-       while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK)
+       while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK)
        {
                buffer_size /= 2;
                if (buffer_size <= 256)
@@ -241,8 +241,8 @@ static int aduc702x_write_block(struct flash_bank *bank, uint8_t *buffer, uint32
                }
        }
 
-       armv4_5_info.common_magic = ARMV4_5_COMMON_MAGIC;
-       armv4_5_info.core_mode = ARMV4_5_MODE_SVC;
+       armv4_5_info.common_magic = ARM_COMMON_MAGIC;
+       armv4_5_info.core_mode = ARM_MODE_SVC;
        armv4_5_info.core_state = ARM_STATE_ARM;
 
        init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
@@ -330,7 +330,7 @@ static int aduc702x_write_single(struct flash_bank *bank, uint8_t *buffer, uint3
 
                 if (aduc702x_check_flash_completion(target, 1) != ERROR_OK)
                 {
-                       LOG_ERROR("single write failed for address 0x%08lX\n", (unsigned long)(offset + x));
+                       LOG_ERROR("single write failed for address 0x%08lX", (unsigned long)(offset + x));
                         aduc702x_set_write_enable(target, 0);
                        return ERROR_FLASH_OPERATION_FAILED;
                }
@@ -343,7 +343,7 @@ static int aduc702x_write_single(struct flash_bank *bank, uint8_t *buffer, uint3
        return ERROR_OK;
 }
 
-int aduc702x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
+static int aduc702x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
 {
        int retval;
 
@@ -412,14 +412,15 @@ static int aduc702x_check_flash_completion(struct target* target, unsigned int t
 }
 
 struct flash_driver aduc702x_flash = {
-               .name = "aduc702x",
-               .flash_bank_command = &aduc702x_flash_bank_command,
-               .erase = &aduc702x_erase,
-               .protect = &aduc702x_protect,
-               .write = &aduc702x_write,
-               .probe = &aduc702x_probe,
-               .auto_probe = &aduc702x_probe,
-               .erase_check = &default_flash_blank_check,
-               .protect_check = &aduc702x_protect_check,
-               .info = &aduc702x_info
-       };
+       .name = "aduc702x",
+       .flash_bank_command = aduc702x_flash_bank_command,
+       .erase = aduc702x_erase,
+       .protect = aduc702x_protect,
+       .write = aduc702x_write,
+       .read = default_flash_read,
+       .probe = aduc702x_probe,
+       .auto_probe = aduc702x_probe,
+       .erase_check = default_flash_blank_check,
+       .protect_check = aduc702x_protect_check,
+       .info = aduc702x_info
+};

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)