Commit f8cd20e2 authored by oharboe's avatar oharboe
Browse files

Rick Altherr <kc8apf@kc8apf.net> - fix support for old target syntax

git-svn-id: svn://svn.berlios.de/openocd/trunk@1108 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent df77b450
...@@ -3878,24 +3878,36 @@ jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) ...@@ -3878,24 +3878,36 @@ jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
} }
if( target_types[x] ){ if( target_types[x] ){
/* YES IT IS OLD SYNTAX */ /* YES IT IS OLD SYNTAX */
int chain_position_offset;
Jim_Obj *new_argv[10]; Jim_Obj *new_argv[10];
int new_argc; int new_argc;
/* target_old_syntax /* target_old_syntax
* *
* argv[0] typename (above) * It appears that there are 2 old syntaxes:
* argv[1] endian
* argv[2] reset method, deprecated/ignored
* argv[3] = old param
* argv[4] = old param
* *
* We will combine all "old params" into a single param. * target <typename> <endian> <chain position> <variant>
* Then later, split them again. *
* and
*
* target <typename> <endian> <reset mode> <chain position> <variant>
*
* The following uses the number of arguments to switch between them.
*/ */
if( argc < 4 ){ if( argc < 5 ){
Jim_WrongNumArgs( interp, 1, argv, "[OLDSYNTAX] ?TYPE? ?ENDIAN? ?RESET? ?old-params?"); Jim_WrongNumArgs( interp, 1, argv, "[OLDSYNTAX] ?TYPE? ?ENDIAN? ?CHAIN-POSITION? ?VARIANT?");
return JIM_ERR; return JIM_ERR;
} }
/* Use the correct argument offset for the chain position */
if (argc < 6) {
/* target <type> <endian> <chain position> <variant> */
chain_position_offset = 2;
} else {
chain_position_offset = 3;
/* target <type> <endian> <reset mode> <chain position> <variant> */
}
/* the command */ /* the command */
new_argv[0] = argv[0]; new_argv[0] = argv[0];
new_argv[1] = Jim_NewStringObj( interp, "create", -1 ); new_argv[1] = Jim_NewStringObj( interp, "create", -1 );
...@@ -3908,10 +3920,11 @@ jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) ...@@ -3908,10 +3920,11 @@ jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
new_argv[4] = Jim_NewStringObj( interp, "-endian", -1 ); new_argv[4] = Jim_NewStringObj( interp, "-endian", -1 );
new_argv[5] = goi.argv[1]; new_argv[5] = goi.argv[1];
new_argv[6] = Jim_NewStringObj( interp, "-chain-position", -1 ); new_argv[6] = Jim_NewStringObj( interp, "-chain-position", -1 );
new_argv[7] = goi.argv[3]; new_argv[7] = goi.argv[chain_position_offset];
new_argv[8] = Jim_NewStringObj( interp, "-variant", -1 ); new_argv[8] = Jim_NewStringObj( interp, "-variant", -1 );
new_argv[9] = goi.argv[4]; new_argv[9] = goi.argv[chain_position_offset + 1];
new_argc = 10; new_argc = 10;
/* /*
* new arg syntax: * new arg syntax:
* argv[0] = command * argv[0] = command
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment