gem5

Passing command line arguments to binary in gem5


I am trying to pass command line arguments to a binary that I am simulating on gem5. I want to simulate the following:

./binary 1

I have tried:

gem5.opt configs/learning_gem5/part1/two_level.py binary 1
gem5.opt configs/learning_gem5/part1/two_level.py binary --options '1'
gem5.opt configs/learning_gem5/part1/two_level.py --cmd binary --options '1'

Which are shown here and here but seem to be depreciated. Nearly all of these give error: unrecognized arguments: -options 1 or something similar.


Solution

  • the last command in your question:

    gem5.opt configs/learning_gem5/part1/two_level.py --cmd binary --options '1'

    is almost correct. You just need to modify it a little:

    gem5.opt configs/learning_gem5/part1/two_level.py --cmd=/path/to/binary --options="1 2 3"

    --options flag always needs "" for your arguments, and unless the binary is in the relative path it is always recommended to give the absolute path.

    Another way to format the same would be:

    gem5.opt configs/learning_gem5/part1/two_level.py -c /path/to/binary -o "1 2 3"

    Hope this helps!