From 237e894805dd757cc24029af1b4b1e824c51712b Mon Sep 17 00:00:00 2001 From: drath Date: Tue, 29 May 2007 11:23:42 +0000 Subject: - split fileio handling into fileio part and image handling - reworked etm/etb into a generic etm part with trace capture drivers (currently only etb supported) - added XScale debug handler binary to repository - added Thumb disassembling (thanks to Vincent Palatin for this patch) - added support for non-CFI compatible flashes to cfi driver (currently only SST39VFxxx devices supported) This checkin is experimental, not suitable for general use git-svn-id: svn://svn.berlios.de/openocd/trunk@155 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/flash/flash.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/flash/flash.c') diff --git a/src/flash/flash.c b/src/flash/flash.c index f5c83f80..6af29825 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -35,6 +35,7 @@ #include #include +#include /* command handlers */ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); @@ -493,9 +494,7 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha u8 *buffer; u32 buf_cnt; - fileio_t file; - fileio_image_t image_info; - enum fileio_sec_type sec_type; + image_t image; duration_t duration; char *duration_text; @@ -511,7 +510,12 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha duration_start_measure(&duration); - fileio_identify_image_type(&sec_type, (argc == 4) ? args[3] : NULL); + identify_image_type(&image.type, (argc == 4) ? args[3] : NULL); + + image.base_address_set = 1; + image.base_address = strtoul(args[1], NULL, 0); + + image.start_address_set = 0; offset = strtoul(args[2], NULL, 0); p = get_flash_bank_by_num(strtoul(args[0], NULL, 0)); @@ -521,20 +525,16 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha return ERROR_OK; } - image_info.base_address = strtoul(args[2], NULL, 0); - image_info.has_start_address = 0; - - if (fileio_open(&file, args[1], FILEIO_READ, - FILEIO_IMAGE, &image_info, sec_type) != ERROR_OK) + if (image_open(&image, args[1], FILEIO_READ) != ERROR_OK) { - command_print(cmd_ctx, "flash write error: %s", file.error_str); + command_print(cmd_ctx, "flash write error: %s", image.error_str); return ERROR_OK; } - binary_size = file.size; + binary_size = image.size; buffer = malloc(binary_size); - fileio_read(&file, binary_size, buffer, &buf_cnt); + image_read(&image, binary_size, buffer, &buf_cnt); if ((retval = p->driver->write(p, buffer, offset, buf_cnt)) != ERROR_OK) { @@ -571,12 +571,12 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha { duration_stop_measure(&duration, &duration_text); command_print(cmd_ctx, "wrote file %s to flash bank %i at offset 0x%8.8x in %s", - file.url, strtoul(args[0], NULL, 0), offset, duration_text); + args[1], strtoul(args[0], NULL, 0), offset, duration_text); free(duration_text); } free(buffer); - fileio_close(&file); + image_close(&image); return ERROR_OK; } -- cgit v1.2.3