I want to learn programming in assembler for PowerPC and ARM, but I'm unable to buy real hardware for this purpose. I'm thinking about using QEMU for that. However I'm not sure if it emulates both architectures enough well, that I'll compile and run my programs in native assembler on it?
我想学习PowerPC和ARM的汇编程序编程,但我无法为此目的购买真正的硬件。我正在考虑使用QEMU。但是我不确定它是否能够很好地模拟这两种体系结构,我将在本机汇编程序中编译和运行我的程序吗?
2 个解决方案
#1
8
QEMU works well for testing program correction (i.e. whether the code would properly run on an actual ARM or PowerPC) but it is not good for testing program efficiency: the emulation is not cycle accurate, and speed measured with QEMU cannot be reliably (or even unreliably) correlated with speed on true hardware.
QEMU适用于测试程序校正(即代码是否能在实际的ARM或PowerPC上正常运行)但是它不利于测试程序效率:仿真不是周期精确的,并且使用QEMU测量的速度不能可靠(甚至不均匀)不可靠地)与真实硬件的速度相关。
Also, QEMU will not trap unaligned memory accesses, which is not a problem for PowerPC emulation (the PowerPC tolerates unaligned accesses) but may be for ARM (an unaligned access, e.g. reading a 32-bit word in RAM from an address which is not a multiple of 4, will work fine with QEMU but would trigger an exception on a true ARM processor).
此外,QEMU不会捕获未对齐的内存访问,这对PowerPC仿真来说不是问题(PowerPC容忍未对齐的访问),但可能适用于ARM(未对齐访问,例如从一个地址读取RAM中的32位字) 4的倍数,可以与QEMU一起使用,但会在真正的ARM处理器上触发异常)。
Apart from these points, QEMU is fine for assembly development on ARM or MIPS (haven't tried PowerPC, because I found an old iBook on eBay for that; but I have done ARM and MIPS assembly with QEMU and then ran the resulting code on true hardware, and this worked). You can either emulate a whole system and run Debian in it (in which case the compiler, linker, text editor... will also run in emulation), or use the "user-mode emulation" where the ARM/MIPS executable is run directly, with a wrapper which converts system calls into those for the host PC (this assumes that the host is a PC running Linux). The latter is more convenient (you have access to your normal home directory, programming tools are native...) but requires installing cross-development tools. See buildroot for that (and link with -static
, this will avoid many headaches).
除了这些要点之外,QEMU适用于ARM或MIPS的组装开发(还没有尝试过PowerPC,因为我在eBay上发现了一个旧的iBook;但我已经用QEMU完成了ARM和MIPS组装,然后运行了生成的代码真正的硬件,这工作)。您可以模拟整个系统并在其中运行Debian(在这种情况下,编译器,链接器,文本编辑器......也将在模拟中运行),或者使用运行ARM / MIPS可执行文件的“用户模式模拟”直接使用包装器将系统调用转换为主机PC的调用(假设主机是运行Linux的PC)。后者更方便(您可以访问普通的主目录,编程工具是原生的......)但需要安装交叉开发工具。请参阅buildroot(并与-static链接,这将避免许多令人头疼的事)。
#2
#1
8
QEMU works well for testing program correction (i.e. whether the code would properly run on an actual ARM or PowerPC) but it is not good for testing program efficiency: the emulation is not cycle accurate, and speed measured with QEMU cannot be reliably (or even unreliably) correlated with speed on true hardware.
QEMU适用于测试程序校正(即代码是否能在实际的ARM或PowerPC上正常运行)但是它不利于测试程序效率:仿真不是周期精确的,并且使用QEMU测量的速度不能可靠(甚至不均匀)不可靠地)与真实硬件的速度相关。
Also, QEMU will not trap unaligned memory accesses, which is not a problem for PowerPC emulation (the PowerPC tolerates unaligned accesses) but may be for ARM (an unaligned access, e.g. reading a 32-bit word in RAM from an address which is not a multiple of 4, will work fine with QEMU but would trigger an exception on a true ARM processor).
此外,QEMU不会捕获未对齐的内存访问,这对PowerPC仿真来说不是问题(PowerPC容忍未对齐的访问),但可能适用于ARM(未对齐访问,例如从一个地址读取RAM中的32位字) 4的倍数,可以与QEMU一起使用,但会在真正的ARM处理器上触发异常)。
Apart from these points, QEMU is fine for assembly development on ARM or MIPS (haven't tried PowerPC, because I found an old iBook on eBay for that; but I have done ARM and MIPS assembly with QEMU and then ran the resulting code on true hardware, and this worked). You can either emulate a whole system and run Debian in it (in which case the compiler, linker, text editor... will also run in emulation), or use the "user-mode emulation" where the ARM/MIPS executable is run directly, with a wrapper which converts system calls into those for the host PC (this assumes that the host is a PC running Linux). The latter is more convenient (you have access to your normal home directory, programming tools are native...) but requires installing cross-development tools. See buildroot for that (and link with -static
, this will avoid many headaches).
除了这些要点之外,QEMU适用于ARM或MIPS的组装开发(还没有尝试过PowerPC,因为我在eBay上发现了一个旧的iBook;但我已经用QEMU完成了ARM和MIPS组装,然后运行了生成的代码真正的硬件,这工作)。您可以模拟整个系统并在其中运行Debian(在这种情况下,编译器,链接器,文本编辑器......也将在模拟中运行),或者使用运行ARM / MIPS可执行文件的“用户模式模拟”直接使用包装器将系统调用转换为主机PC的调用(假设主机是运行Linux的PC)。后者更方便(您可以访问普通的主目录,编程工具是原生的......)但需要安装交叉开发工具。请参阅buildroot(并与-static链接,这将避免许多令人头疼的事)。