summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-04-04 13:47:38 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-04-04 13:47:38 +0000
commit35b3c95299a97c05078f7dd662d66c89a356869d (patch)
treeb908855a11539228608f57c61d46e06ae208f544 /src/flash
parent7abe97565e77d5a9c34099ea15ad1608567b1581 (diff)
downloadopenocd+libswd-35b3c95299a97c05078f7dd662d66c89a356869d.tar.gz
openocd+libswd-35b3c95299a97c05078f7dd662d66c89a356869d.tar.bz2
openocd+libswd-35b3c95299a97c05078f7dd662d66c89a356869d.tar.xz
openocd+libswd-35b3c95299a97c05078f7dd662d66c89a356869d.zip
- reverted some of the changes that possibly broke arm926ejs. Waiting
for a bit more info before I can tell with confidence whether or not this would have any effect. - worked on error propagation and output for flash git-svn-id: svn://svn.berlios.de/openocd/trunk@539 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/ecos.c7
-rw-r--r--src/flash/flash.c18
2 files changed, 11 insertions, 14 deletions
diff --git a/src/flash/ecos.c b/src/flash/ecos.c
index f467b74d..8b64b2d7 100644
--- a/src/flash/ecos.c
+++ b/src/flash/ecos.c
@@ -211,10 +211,9 @@ int loadDriver(ecosflash_flash_bank_t *info)
int retval;
if ((retval = image_read_section(&image, i, 0x0, image.sections[i].size, buffer, &buf_cnt)) != ERROR_OK)
{
- LOG_ERROR("image_read_section failed with error code: %i", retval);
free(buffer);
image_close(&image);
- return ERROR_FLASH_BANK_INVALID;
+ return retval;
}
target_write_buffer(target, image.sections[i].base_address, buf_cnt, buffer);
image_size += buf_cnt;
@@ -303,7 +302,7 @@ int eCosBoard_erase(ecosflash_flash_bank_t *info, u32 address, u32 len)
if (flashErr != 0x0)
{
LOG_ERROR("Flash erase failed with %d (%s)\n", flashErr, flash_errmsg(flashErr));
- return ERROR_JTAG_DEVICE_ERROR;
+ return ERROR_FAIL;
}
return ERROR_OK;
@@ -362,7 +361,7 @@ int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, u32 address, u32 l
if (flashErr != 0x0)
{
LOG_ERROR("Flash prog failed with %d (%s)\n", flashErr, flash_errmsg(flashErr));
- return ERROR_JTAG_DEVICE_ERROR;
+ return ERROR_FAIL;
}
}
return ERROR_OK;
diff --git a/src/flash/flash.c b/src/flash/flash.c
index 96077258..850dcd4c 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -618,13 +618,12 @@ int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cm
if (argc < 1)
{
return ERROR_COMMAND_SYNTAX_ERROR;
-
}
if (!target)
{
LOG_ERROR("no target selected");
- return ERROR_OK;
+ return ERROR_FAIL;
}
duration_start_measure(&duration);
@@ -649,7 +648,6 @@ int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cm
}
retval = flash_write(target, &image, &written, auto_erase);
-
if (retval != ERROR_OK)
{
image_close(&image);
@@ -659,9 +657,9 @@ int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cm
duration_stop_measure(&duration, &duration_text);
if (retval == ERROR_OK)
{
- command_print(cmd_ctx, "wrote %u byte from file %s in %s (%f kb/s)",
- written, args[0], duration_text,
- (float)written / 1024.0 / ((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0)));
+ command_print(cmd_ctx, "wrote %u byte from file %s in %s (%f kb/s)",
+ written, args[0], duration_text,
+ (float)written / 1024.0 / ((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0)));
}
free(duration_text);
@@ -923,7 +921,7 @@ int flash_erase_address_range(target_t *target, u32 addr, u32 length)
/* write (optional verify) an image to flash memory of the given target */
int flash_write(target_t *target, image_t *image, u32 *written, int erase)
{
- int retval;
+ int retval=ERROR_OK;
int section;
u32 section_offset;
@@ -1039,14 +1037,14 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
if (retval != ERROR_OK)
{
- return retval; /* abort operation */
- }
+ return retval; /* abort operation */
+ }
if (written != NULL)
*written += run_size; /* add run size to total written counter */
}
- return ERROR_OK;
+ return retval;
}
int handle_flash_auto_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)