开始使用Fast Models

来源:互联网 发布:皮具行业 知乎 编辑:程序博客网 时间:2024/05/20 07:17

ARM Cortex-A15 KVM总结Part1on Fast Models

Project has started foraround 1 month, and the environment with a fast models simulator, anandroid host OS, and a guest Android OS has been installed with thehelp of Qemu. The annoying part is the installation and exploitationof benchmark, and the most frustrating thing is, I almost forget thesteps that I have done. Well, time to write them down.

首先,项目的目标是基于ARMCortex-A15改进KVM的性能,KVM处于HostOs之中,与GuestOsQemu进行交互,这种情况下的GuestOsCPU性能接近native,但是IO的性能很差。

然而,现在ARMCortex-A15的开发板不可用(三星基于Cortex-A15的开发板在这时候已经出来了,由于研究经费问题),因此,在使用之时,我们采用了ARM提供的FastModelsX86的机器上模拟ARM的环境。

整体的思路如下:

  1. 安装建立模拟平台,使用ARM Fast Models

  2. 建立Host系统,编译ARMLinux内核,这个内核可以在模拟平台上运行;

  3. Host系统中加入KVM支持,然后建立可以bootGuest OsQemu

  4. Boot Guest VM

Ok,关于环境的安装基于ARM提供的一个文档,地址为http://www.virtualopensystems.com/media/kvm-resources/kvm-arm-guide.pdf

然后很巧的是,在csdn上已经发现了一篇关于平台搭建的文章,地址为:http://blog.csdn.net/kurama_sai/article/details/8237307

估计也是我们小组的成员的博文,目测是组长写的(she'sreally awesome),重复的内容不想写,上面博客中有图片介绍,因此更加直观。

在此简单描述使用到的FastModels的功能:

FastModels是一个为了更容易地创建虚拟平台的模型的环境,FastModels利用CT(CodeTranslation)模型,生成(构建)的平台在典型的工作站上的速度在100-500MIPS范围内,比如,使用sgcanvas打开FastModels之后,可以构建一个新的平台,如在项目中使用的是RTSM_VE_Cortex-A15x1.sgproj文件构建,而Build(构建)之后生成的包含一个.cadi文件,cadiComponetArchitecture Debug Interface的缩写,它可以独立运行,也可已通过兼容的debugger运行,FastModels会自动提供对于独立平台和集成平台的接口。FastModels中只包含一个项目文件.sgproj,代表singleproject file,生成.cadi文件;ComponentArchitecture DebugInterface是一个C++API可以为复杂的SoC模拟平台提供方便和准确的Debugging服务,它可以为一个调用者caller,通常是一个Debugger提供如下功能:连接一个已经存在的模拟平台或者实例化一个新的模拟平台;attachto one of the simulationtargets;控制被连接目标的执行;观察和操作模拟的硬件资源;显示模拟target中寄存器和内存的内容;包含valuabledisassembly or profilinginformationCADI提供了很多技术的支持,包括semi-hostingsemi-hosting建立一个在target上运行的application的管道,管道可以用来对application进行IO操作,因此caller调用者可以与target进行交互,或者将targetIO重定向到HostOSIO上。

在项目中,通过model_shell命令来运行.cadi文件,这里,model_shell命令的格式为:

model_shell[options]model[application_list]

model_shell[options]-mmodel[application_list]

model_shell-mmodel-aapp1.axf [options]

仅对用到的参数简单解释:

model.cadi文件名(含扩展名),如cadi_system_Linux-Release-GCC-4.1.so,这里model之前的-m并非是必要的如果model1)在命令的结尾2)倒数第二个命令,并且最后的是applicationfilemodel文件的扩展名是.so或者.dll

application文件则以.axf为后缀;

-a –applicationfilename,格式中的application_list是为了加载模型的一个application或者一系列的applications,如果application_list处在命令的结束处,-a可以省略,另外,可以使用-ainstance=filename为一个特定的系统instance加载applicationapplication.axf为后缀;

-C set a parameter to thespecified valueuse-C instance.parameter=value to set a parameter for a specific systeminstance.

比如,下面命令的作用是启动HostAndroid

model_shellcadi_system_Linux-Release-GCC-4.1.so \

-acluster.cpu0=linux-system-semi.axf \

-Cmotherboard.vis.rate_limit-enable=0 \

-Cmotherboard.mmc.p_mmc_file="disk.img" \

-Ccluster.cpu0.semihosting-cmd_line="--kernel uImage --console=ttyAMA0 mem=2048M mem=2048@0x880000000 root=/dev/mmcblk0 rwandroidboot.console=ttyAMA3 init=/init"


cadi_system_Linux-Release-GCC-4.1.somodel文件,linux-system-semi.axfapplication文件,这个application文件为cluster.cpu0而加载,-C设置特定的系统参数,如motherboard.vis.rate_limit-ebable, motherboard.mmc.p_mmc_filecluster.cpu0.semihosting-cmd_line,一般来说,-C是以instance.parameter=value的形式出现的,value的形式为string或者boolean(0/1或者true/fasle);关于cluster.cpu0.semihosting-cmd_line,我的理解如下:可以用sgcanvas打开RTSM_VE_Cortex_A15x1.sgproj文件,在source窗口下,可以看到componentRTSM_VE_Cortex_A15x1中定义了compositioncluster,并且可以看到这里的cluster的定义改变了ARMCortexA15x1CT中的cluster的值(部分默认值),然后打开(extern)component ARMCortexA15x1CT,可以看到其中定义的Processorcomponent parameters中包含了很多项,如:PARAMETER{ name("cpu0.semihosting-cmd_line"), type(string),default("") } cpu0_semihosting_cmd_line;