Re: [rfa] Add -m; Was: ARM sim patch: increase default target memory

Nick Clifton
2002-04-09T08:21:00Z

Hi Andrew,

> > I would also suggest that you consider adding support for a
> > megabyte postfix so that the user could do:
> > -m 6M
>
> Good idea, all the sims should do this. Any pointers for the code?

Nope - it was just an idea that popped into my head whilst reading
your code. It should be very straightforward though. Something like
the code attached to the end of this email maybe ?

> >> It also sets the default memory size back to something consistent
> >> with the other simulators.
> > This will stop the java tests from running, so maybe you should also
> > add the new switch to the java test harness so that they do not fail.
>
> Do you know which file?

Umm, not sure - libjava.exp maybe ? Anthony ?

Cheers
Nick

-------------------------------------------------------------------------
else if (argv[i][0] == '-' && argv[i][1] == 'm')
{
char * end_ptr;
const char * ptr;
unsigned long size;

if (argv[i][2] != '\0')
ptr = argv[i] + 2;
else
{
ptr = argv [++i];

if (ptr == NULL)
{
sim_callback->printf_filtered
(sim_callback,
"Missing argument to -m option\n");
return NULL;
}
}

size = strtoul (ptr, & end_ptr, 0);
if (end_ptr != ptr)
{
switch (* end_ptr)
{
case 'k':
case 'K':
size *= 1024;
break;
case 'm':
case 'M':
size *= 1024 * 1024;
break;
case 'g':
case 'G':
size *= 1024 * 1024 * 1024;
break;
case 0:
break;
default:
sim_callback->printf_filtered
(sim_callback,
"Unexpected characters at end of -m option\n");
break;
}
}

sim_size (size);
}