From 82d2633b5f550115e9e7c7d0520babb6680aa38f Mon Sep 17 00:00:00 2001 From: drath Date: Mon, 17 Jul 2006 14:13:27 +0000 Subject: - Added support for native MinGW builds (thanks to Spencer Oliver and Michael Fischer) - you still need to install GiveIO (not part of OpenOCD) - Added state-move support to ftd2xx and bitbang JTAG drivers (required for XScale, possibly useful for other targets, too) - various fixes git-svn-id: svn://svn.berlios.de/openocd/trunk@78 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/target/target.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/target/target.c') diff --git a/src/target/target.c b/src/target/target.c index 34dc60a7..8b9939af 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -17,7 +17,10 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif + #include "target.h" #include "log.h" @@ -1507,7 +1510,7 @@ int handle_load_binary_command(struct command_context_s *cmd_ctx, char *cmd, cha u8 *buffer; u32 buf_cnt; - struct timeval start, end; + struct timeval start, end, duration; target_t *target = get_current_target(cmd_ctx); @@ -1526,7 +1529,7 @@ int handle_load_binary_command(struct command_context_s *cmd_ctx, char *cmd, cha return ERROR_OK; } - if (!(binary = fopen(args[0], "r"))) + if (!(binary = fopen(args[0], "rb"))) { ERROR("couldn't open %s: %s", args[0], strerror(errno)); command_print(cmd_ctx, "error accessing file %s", args[0]); @@ -1550,7 +1553,8 @@ int handle_load_binary_command(struct command_context_s *cmd_ctx, char *cmd, cha free(buffer); - command_print(cmd_ctx, "downloaded %lli byte in %is %ius", (long long) binary_stat.st_size, end.tv_sec - start.tv_sec, end.tv_usec - start.tv_usec); + timeval_subtract(&duration, &end, &start); + command_print(cmd_ctx, "downloaded %lli byte in %is %ius", (long long) binary_stat.st_size, duration.tv_sec, duration.tv_usec); fclose(binary); @@ -1576,7 +1580,7 @@ int handle_dump_binary_command(struct command_context_s *cmd_ctx, char *cmd, cha address = strtoul(args[1], NULL, 0); size = strtoul(args[2], NULL, 0); - if (!(binary = fopen(args[0], "w"))) + if (!(binary = fopen(args[0], "wb"))) { ERROR("couldn't open %s for writing: %s", args[0], strerror(errno)); command_print(cmd_ctx, "error accessing file %s", args[0]); -- cgit v1.2.3