[ 2645787 ] Bypass verify stage of flashmem cmd

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1444 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 16 years ago
parent 5269e4b6f3
commit f02e24e7b5

@ -1,3 +1,8 @@
2009-02-27 Arnim Laeuger <arniml@users.sourceforge.net>
* 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 <arniml@users.sourceforge.net>
* data/Makefile.am, data/MANUFACTURERS, data/ti/PARTS,

@ -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 */

@ -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) );

@ -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

Loading…
Cancel
Save