110458Sandreas.hansson@arm.comThis directory contains a demo of C++ configuration of gem5.  The intention
210458Sandreas.hansson@arm.comis to provide a mechanism to allow pre-generated config.ini files generated
310458Sandreas.hansson@arm.comby Python-based gem5 to be reloaded in library-base versions of gem5
410458Sandreas.hansson@arm.comembedded in other systems using C++ calls for simulation control.
510458Sandreas.hansson@arm.com
610458Sandreas.hansson@arm.comThis demo implements a few of the simulation control mechanisms of the Python
710458Sandreas.hansson@arm.comgem5 on top of a C++ configured system.
810458Sandreas.hansson@arm.com
910458Sandreas.hansson@arm.comRead main.cc for more details of the implementation.
1010458Sandreas.hansson@arm.com
1110458Sandreas.hansson@arm.comTo build:
1210458Sandreas.hansson@arm.com
1310458Sandreas.hansson@arm.comFirst build gem5 as a library with cxx-config support and (optionally)
1410458Sandreas.hansson@arm.comwithout python.  Also build a normal gem5 (cxx-config not needed, Python
1510458Sandreas.hansson@arm.comneeded):
1610458Sandreas.hansson@arm.com
1710458Sandreas.hansson@arm.com> cd ../..
1810458Sandreas.hansson@arm.com> scons build/ARM/gem5.opt
1910458Sandreas.hansson@arm.com> scons --with-cxx-config --without-python build/ARM/libgem5_opt.so
2010458Sandreas.hansson@arm.com> cd util/cxx_config
2110458Sandreas.hansson@arm.com
2211791Sjungma@eit.uni-kl.deNote: For MAC / OSX this command should be used:
2311791Sjungma@eit.uni-kl.de> scons --with-cxx-config --without-python build/ARM/libgem5_opt.dylib
2411791Sjungma@eit.uni-kl.de
2511791Sjungma@eit.uni-kl.deSet a proper LD_LIBRARY_PATH e.g. for bash:
2611791Sjungma@eit.uni-kl.de> export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/path/to/gem5/build/ARM/"
2711791Sjungma@eit.uni-kl.de
2811791Sjungma@eit.uni-kl.deor for MAC / OSX:
2911791Sjungma@eit.uni-kl.de> export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/path/to/gem5/build/ARM/"
3011791Sjungma@eit.uni-kl.de
3110458Sandreas.hansson@arm.comThen edit Makefile to set the paths for PYTHON and run make
3210458Sandreas.hansson@arm.com
3310458Sandreas.hansson@arm.com> make
3410458Sandreas.hansson@arm.com
3510458Sandreas.hansson@arm.comMake a config file for the C++-configured gem5 using normal gem5
3610458Sandreas.hansson@arm.com
3710458Sandreas.hansson@arm.com> ../../build/ARM/gem5.opt ../../configs/example/se.py -c \
3810458Sandreas.hansson@arm.com>       ../../tests/test-progs/hello/bin/arm/linux/hello
3910458Sandreas.hansson@arm.com
4010458Sandreas.hansson@arm.comThe binary 'gem5.opt.cxx' can now be used to load in the generated config
4110458Sandreas.hansson@arm.comfile from the previous normal gem5 run.
4210458Sandreas.hansson@arm.com
4310458Sandreas.hansson@arm.comTry:
4410458Sandreas.hansson@arm.com
4510458Sandreas.hansson@arm.com> ./gem5.opt.cxx m5out/config.ini
4610458Sandreas.hansson@arm.com
4710458Sandreas.hansson@arm.comThis should print:
4810458Sandreas.hansson@arm.com
4910458Sandreas.hansson@arm.com> Hello world!
5010458Sandreas.hansson@arm.com
5110458Sandreas.hansson@arm.comThe .ini file can also be read by the Python .ini file reader example:
5210458Sandreas.hansson@arm.com
5310458Sandreas.hansson@arm.com> ../../build/ARM/gem5.opt ../../configs/example/read_config.py m5out/config.ini
54