exit (1);
}
+/* Override the default processor with the one specified
+ * on the command line */
+static void
+_setProcessor (char *_processor)
+{
+ port->processor = _processor;
+ fprintf(stderr,"Processor: %s\n",_processor);
+}
+
static void
_validatePorts (void)
{
port = _ports[0];
}
+/* search through the command line options for the processor */
+static void
+_findProcessor (int argc, char **argv)
+{
+ while (argc--)
+ {
+ if (!strncmp (*argv, "-p", 2))
+ {
+ _setProcessor (*argv + 2);
+ return;
+ }
+ argv++;
+ }
+
+ /* no error if processor was not specified. */
+}
+
/*-----------------------------------------------------------------*/
/* printVersionInfo - prints the version info */
/*-----------------------------------------------------------------*/
werror (W_UNSUPPORTED_MODEL, sz, port->target);
}
-static void
-_setProcessor (char *_processor)
-{
- port->processor = _processor;
- fprintf(stderr,"Processor: %s\n",_processor);
-}
-
/** Gets the string argument to this option. If the option is '--opt'
then for input of '--optxyz' or '--opt xyz' returns xyz.
*/
break;
case 'm':
- /* Used to select the port */
- _setPort (argv[i] + 2);
+ /* Used to select the port. But this has already been done. */
break;
case 'p':
- /* Used to select the processor in port */
- _setProcessor (getStringArg("-p", argv, &i, argc));
+ /* Used to select the processor in port. But this has
+ * already been done. */
break;
case 'c':
exit (1);
}
+ /* Before parsing the command line options, do a
+ * search for the port and processor and initialize
+ * them if they're found. (We can't gurantee that these
+ * will be the first options specified).
+ */
+
_findPort (argc, argv);
+
#ifdef JAMIN_DS390
if (strcmp(port->target, "mcs51") == 0) {
printf("DS390 jammed in A\n");
ds390_jammed = 1;
}
#endif
+
+ _findProcessor (argc, argv);
+
/* Initalise the port. */
if (port->init)
port->init ();