flash: use correct device_id mask
[fw/openocd] / src / flash / nor / ecos.c
index b216903948a6d892792b83aea6ff97fb202693bf..cae89358db529a6b7f363718c38e4e2bd83d6e89 100644 (file)
@@ -111,8 +111,7 @@ FLASH_BANK_COMMAND_HANDLER(ecosflash_flash_bank_command)
 
        if (CMD_ARGC < 7)
        {
-               LOG_WARNING("incomplete flash_bank ecosflash configuration");
-               return ERROR_FLASH_BANK_INVALID;
+               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
        info = malloc(sizeof(struct ecosflash_flash_bank));
@@ -173,7 +172,6 @@ static int loadDriver(struct ecosflash_flash_bank *info)
        for (i = 0; i < image.num_sections; i++)
        {
                void *buffer = malloc(image.sections[i].size);
-               int retval;
                if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK)
                {
                        free(buffer);
@@ -209,7 +207,7 @@ static int runCode(struct ecosflash_flash_bank *info,
        struct target *target = info->target;
 
        struct reg_param reg_params[3];
-       struct armv4_5_algorithm armv4_5_info;
+       struct arm_algorithm armv4_5_info;
        armv4_5_info.common_magic = ARM_COMMON_MAGIC;
        armv4_5_info.core_mode = ARM_MODE_SVC;
        armv4_5_info.core_state = ARM_STATE_ARM;
@@ -265,7 +263,7 @@ static int eCosBoard_erase(struct ecosflash_flash_bank *info, uint32_t address,
 
        if (flashErr != 0x0)
        {
-               LOG_ERROR("Flash erase failed with %d (%s)\n", (int)flashErr, flash_errmsg(flashErr));
+               LOG_ERROR("Flash erase failed with %d (%s)", (int)flashErr, flash_errmsg(flashErr));
                return ERROR_FAIL;
        }
 
@@ -305,7 +303,6 @@ static int eCosBoard_flash(struct ecosflash_flash_bank *info, void *data, uint32
                        t = chunk;
                }
 
-               int retval;
                retval = target_write_buffer(target, buffer, t, ((uint8_t *)data) + i);
                if (retval != ERROR_OK)
                        return retval;
@@ -324,7 +321,7 @@ static int eCosBoard_flash(struct ecosflash_flash_bank *info, void *data, uint32
 
                if (flashErr != 0x0)
                {
-                       LOG_ERROR("Flash prog failed with %d (%s)\n", (int)flashErr, flash_errmsg(flashErr));
+                       LOG_ERROR("Flash prog failed with %d (%s)", (int)flashErr, flash_errmsg(flashErr));
                        return ERROR_FAIL;
                }
        }
@@ -431,14 +428,15 @@ static int ecosflash_handle_gpnvm_command(struct command_context *cmd_ctx, char
 #endif
 
 struct flash_driver ecosflash_flash = {
-               .name = "ecosflash",
-               .flash_bank_command = &ecosflash_flash_bank_command,
-               .erase = &ecosflash_erase,
-               .protect = &ecosflash_protect,
-               .write = &ecosflash_write,
-               .probe = &ecosflash_probe,
-               .auto_probe = &ecosflash_probe,
-               .erase_check = &default_flash_blank_check,
-               .protect_check = &ecosflash_protect_check,
-               .info = &ecosflash_info
-       };
+       .name = "ecosflash",
+       .flash_bank_command = ecosflash_flash_bank_command,
+       .erase = ecosflash_erase,
+       .protect = ecosflash_protect,
+       .write = ecosflash_write,
+       .read = default_flash_read,
+       .probe = ecosflash_probe,
+       .auto_probe = ecosflash_probe,
+       .erase_check = default_flash_blank_check,
+       .protect_check = ecosflash_protect_check,
+       .info = ecosflash_info
+};