From f02e24e7b5615dcedb0df617da29a86464361877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Fri, 27 Feb 2009 19:36:50 +0000 Subject: [PATCH] [ 2645787 ] Bypass verify stage of flashmem cmd git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1444 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 5 +++++ jtag/include/flash.h | 4 ++-- jtag/src/cmd/flashmem.c | 20 ++++++++++++++------ jtag/src/flash/flash.c | 17 +++++++++++++---- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 890d4191..14c9415a 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,8 @@ +2009-02-27 Arnim Laeuger + + * src/cmd/flashmem.c, src/flash/flash.c, include/flash.h: + [ 2645787 ] Bypass verify stage of flashmem cmd (Jeff Wittrock) + 2009-02-26 Arnim Laeuger * data/Makefile.am, data/MANUFACTURERS, data/ti/PARTS, diff --git a/jtag/include/flash.h b/jtag/include/flash.h index 54100daf..21586ea2 100644 --- a/jtag/include/flash.h +++ b/jtag/include/flash.h @@ -80,8 +80,8 @@ typedef struct { void detectflash( bus_t *bus, uint32_t adr ); -void flashmem( bus_t *bus, FILE *f, uint32_t addr ); -void flashmsbin( bus_t *bus, FILE *f ); +void flashmem( bus_t *bus, FILE *f, uint32_t addr, int ); +void flashmsbin( bus_t *bus, FILE *f, int ); /* end of original brux/flash.h */ diff --git a/jtag/src/cmd/flashmem.c b/jtag/src/cmd/flashmem.c index 311df528..b58ce213 100644 --- a/jtag/src/cmd/flashmem.c +++ b/jtag/src/cmd/flashmem.c @@ -37,10 +37,12 @@ static int cmd_flashmem_run( chain_t *chain, char *params[] ) { int msbin; + int noverify = 0; uint32_t adr = 0; FILE *f; + int paramc = cmd_params( params ); - if (cmd_params( params ) != 3) + if (paramc < 3) return -1; if (!bus) { @@ -52,15 +54,20 @@ cmd_flashmem_run( chain_t *chain, char *params[] ) if (!msbin && cmd_get_number( params[1], &adr )) return -1; + if (paramc > 3) + noverify = strcasecmp( "noverify", params[3] ) == 0; + else + noverify = 0; + f = fopen( params[2], "rb" ); if (!f) { printf( _("Unable to open file `%s'!\n"), params[2] ); return 1; } if (msbin) - flashmsbin( bus, f ); + flashmsbin( bus, f, noverify ); else - flashmem( bus, f, adr ); + flashmem( bus, f, adr, noverify ); fclose( f ); return 1; @@ -72,18 +79,19 @@ cmd_flashmem_help( void ) int i; printf( _( - "Usage: %s ADDR FILENAME\n" - "Usage: %s FILENAME\n" + "Usage: %s ADDR FILENAME [noverify]\n" + "Usage: %s FILENAME [noverify]\n" "Program FILENAME content to flash memory.\n" "\n" "ADDR target address for raw binary image\n" "FILENAME name of the input file\n" "%-10s FILENAME is in MS .bin format (for WinCE)\n" + "%-10s if specified, verification is skipped\n" "\n" "ADDR could be in decimal or hexadecimal (prefixed with 0x) form.\n" "\n" "Supported Flash Memories:\n" - ), "flashmem", "flashmem msbin", "msbin" ); + ), "flashmem", "flashmem msbin", "msbin", "noverify" ); for (i = 0; flash_drivers[i]; i++) printf( _("%s\n %s\n"), _(flash_drivers[i]->name), _(flash_drivers[i]->description) ); diff --git a/jtag/src/flash/flash.c b/jtag/src/flash/flash.c index 8f4241f5..c6cfe176 100644 --- a/jtag/src/flash/flash.c +++ b/jtag/src/flash/flash.c @@ -94,7 +94,7 @@ set_flash_driver( void ) } void -flashmsbin( bus_t *bus, FILE *f ) +flashmsbin( bus_t *bus, FILE *f, int noverify ) { uint32_t adr; cfi_query_structure_t *cfi; @@ -173,6 +173,11 @@ flashmsbin( bus_t *bus, FILE *f ) flash_driver->readarray( cfi_array ); + if (noverify) { + printf( _("verify skipped\n") ); + return; + } + fseek( f, 15, SEEK_SET ); printf( _("verify:\n") ); @@ -241,7 +246,7 @@ find_block( cfi_query_structure_t *cfi, int adr, int bus_width, int chip_width, } void -flashmem( bus_t *bus, FILE *f, uint32_t addr ) +flashmem( bus_t *bus, FILE *f, uint32_t addr, int noverify ) { uint32_t adr; cfi_query_structure_t *cfi; @@ -325,11 +330,17 @@ flashmem( bus_t *bus, FILE *f, uint32_t addr ) } } + free( erased ); printf( _("addr: 0x%08X\n"), adr - flash_driver->bus_width); flash_driver->readarray( cfi_array ); + if (noverify) { + printf( _("verify skipped\n") ); + return; + } + fseek( f, 0, SEEK_SET ); printf( _("verify:\n") ); fflush( stdout ); @@ -366,8 +377,6 @@ flashmem( bus_t *bus, FILE *f, uint32_t addr ) } } printf( _("addr: 0x%08X\nDone.\n"), adr - flash_driver->bus_width); - - free( erased ); } void