Gem5的編譯及執行測試程式

2021-06-14 14:04:18 字數 906 閱讀 9075

原文有小錯,已改。

1、編譯之前,首先安裝庫檔案:

以ubuntu1201系統為例,安裝庫檔案如下:

$:sudo apt-get install mercurial scons swig gcc m4 python python-dev libgoogle-perftools-dev g++libprotobuf-dev

此外,還需要安裝好編譯環境:

sudo apt-get install build-essential

$: hg clone

3、編譯gem5的各個架構:

在根目錄下執行:$:scons build/arm/gem5.opt

其中arm可以換成x86,mips等等,編譯完成後就可以執行測試程式。

4、執行測試程式:

$: cd ~/gem5      //進入gem5原始碼根目錄

$:build/arm/gem5.opt configs/example/se.py -c tests/test-progs/hello/bin/arm/linux/hello 

hack: be nice to actually delete the event here

exiting @ tick 3107500 because target called exit()

以上紅色部分就是程式執行的結果。

5、看下測試程式的原始碼:

$:cd ~/gem5

$: gedit  tests/test-progs/hello/src/hello.c

開啟可以看到,就是乙個helloworld測試程式。

note:如果你想重新寫個測試程式,注意想在什麼架構下執行,如果在arm架構下執行,需要用arm toolchain ,如果想執行mips架構的測試程式,需要用mips的交叉工具鏈編譯測試程式。

gem5的安裝 編譯及執行

推薦gem5官網 1.安裝各類庫檔案 當純環境寫的 以ubuntu14.04為例,其他的版本也是基本上差不多的 sudo apt get install mercurial scons swig gcc m4 python python dev libgoogle perftools dev g l...

gem5 一)配置Gem5執行環境

系統環境 ubuntu 18.04 1.安裝相關的依賴庫 通過命令sudo apt install 安裝下列的依賴庫 git,build essential,scons,python dev,swig,libprotobuf dev,python protobuf,protobuf compiler...

在gem5上執行Splash benchmarks

有2種方式在gem5上執行splash 2,即fs full system 模式和se syscall emulation 模式 最穩定的方法是使用parmacs macros的乙個pthreads實現來編譯benchmarks,然後鏈結標準linux pthreads library並在m5上以f...