summaryrefslogtreecommitdiff
path: root/src/flash/flash.c
diff options
context:
space:
mode:
authordrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2006-09-07 17:36:34 +0000
committerdrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2006-09-07 17:36:34 +0000
commit3f74f764c7c7b9e22906d2885666d844768c4351 (patch)
tree3cac502e962a6ce1755ab12d57ebaa725d673467 /src/flash/flash.c
parent028f59ede54917d59f8183e6feac43cb0a6f3546 (diff)
downloadopenocd+libswd-3f74f764c7c7b9e22906d2885666d844768c4351.tar.gz
openocd+libswd-3f74f764c7c7b9e22906d2885666d844768c4351.tar.bz2
openocd+libswd-3f74f764c7c7b9e22906d2885666d844768c4351.tar.xz
openocd+libswd-3f74f764c7c7b9e22906d2885666d844768c4351.zip
- integrated patch from Magnus Lundin that fixes at91sam7 flash timing bugs and possible endianness problems (big endian hosts)
- correctly write trailing bytes on str7x flashes - speed up str7x flash writing by offloading the algorithm to the target git-svn-id: svn://svn.berlios.de/openocd/trunk@95 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash/flash.c')
-rw-r--r--src/flash/flash.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/flash/flash.c b/src/flash/flash.c
index 6f0523d0..7d199cfc 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -25,6 +25,7 @@
#include "command.h"
#include "log.h"
#include "target.h"
+#include "time_support.h"
#include <string.h>
#include <unistd.h>
@@ -526,6 +527,8 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
if ((retval = p->driver->write(p, buffer, offset, buf_cnt)) != ERROR_OK)
{
+ command_print(cmd_ctx, "failed writing file %s to flash bank %i at offset 0x%8.8x",
+ args[1], strtoul(args[0], NULL, 0), strtoul(args[2], NULL, 0));
switch (retval)
{
case ERROR_TARGET_NOT_HALTED:
@@ -553,14 +556,16 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
command_print(cmd_ctx, "unknown error");
}
}
+ else
+ {
+ gettimeofday(&end, NULL);
+ timeval_subtract(&duration, &end, &start);
+
+ command_print(cmd_ctx, "wrote file %s to flash bank %i at offset 0x%8.8x in %is %ius", args[1], strtoul(args[0], NULL, 0), strtoul(args[2], NULL, 0), duration.tv_sec, duration.tv_usec);
+ }
+
free(buffer);
fclose(binary);
- gettimeofday(&end, NULL);
- timeval_subtract(&duration, &end, &start);
-
- command_print(cmd_ctx, "wrote file %s to flash bank %i at offset 0x%8.8x in %is %ius", args[1], strtoul(args[0], NULL, 0), strtoul(args[2], NULL, 0), duration.tv_sec, duration.tv_usec);
-
return ERROR_OK;
-
}