有适合与 C 链接的开源 ARM7 模拟器吗?

发布于 2024-09-15 20:31:14 字数 718 浏览 5 评论 0原文

我有一个开源 Atari 2600 模拟器 (Z26),我想添加对包含嵌入式 ARM 处理器(NXP 21xx 系列)的卡式盒的支持。这个想法是模拟 6507,直到它尝试读取或写入一个字节的内存(每 841 纳秒就会执行一次)。如果6507执行写操作,则将地址和数据放在ARM的一些I/O端口上,让ARM代码运行20个周期,确认ARM正在浮动其数据总线,然后让ARM再运行38个周期。如果6507执行读取,则将地址放在ARM的I/O端口上,让ARM运行38个周期,从ARM的I/O端口抓取数据(希望ARM软件将其放在那里),然后让ARM 再运行 20 个周期。

ARM7 似乎很容易实现;我不需要模拟大量的硬件功能。有什么想法吗?

编辑 我想到的是一个例程,它将保存机器状态的结构和指向内存访问例程的指针作为参数。调用时,例程将模拟 ARM 的指令引擎,生成适当的读取、写入和代码提取。然后,我可以编写内存访问例程,将适当的区域视为闪存(具有大致近似的等待状态)、RAM、I/O 端口和定时器寄存器。其他一些区域将被标记为无关,并且访问任何其他区域将标记错误并停止模拟器。

也许 QEMU 在内部使用了这样的东西。由于 ARM 仿真将集成到一个已经存在的仿真引擎中(我没有编写也没有完全理解——我修补的 Z26 的唯一部分是内存读/写逻辑),我需要占地面积相当小的东西。

知道 QEMU 内部是如何工作的吗?如果我只使用 QEMU 中 2% 的代码,您知道 GPL 许可证需要什么吗?我是否必须捆绑整个代码,或者只是我使用的部分,或者什么?

I have an open-source Atari 2600 emulator (Z26), and I'd like to add support for cartridges containing an embedded ARM processor (NXP 21xx family). The idea would be to simulate the 6507 until it tries to read or write a byte of memory (which it will do every 841ns). If the 6507 performs a write, put the address and data on some of the ARM's I/O ports and let the ARM code run 20 cycles, confirm that the ARM is floating its data bus, and let the ARM run for another 38 cycles. If the 6507 performs a read, put the address on the ARM's I/O ports, let the ARM run 38 cycles, grab the data from the ARM's I/O port (hopefully the ARM software will have put it there), and let the ARM run another 20 cycles.

The ARM7 seems pretty straightforward to implement; I don't need to simulate a whole lot of hardware features. Any thoughts?

Edit
What I have in mind would be a routine that would take as a parameter a struct holding the machine state and pointers to a memory access routine. When called, the routine would emulate the ARM's instruction engine, generating appropriate reads, writes, and code fetches. I could then write the memory access routine to regard appropriate areas as flash (with roughly-approximated wait states), RAM, I/O ports, and timer registers. Some other areas would be marked as don't-care, and accesses to any other areas would flag an error and stop the emulator.

Perhaps QEMU uses such a thing internally. Since the ARM emulation would be integrated into an already-existing emulation engine (which I didn't write and don't fully understand--the only parts of Z26 I've patched have been the memory read/write logic) I would need something with a fairly small footprint.

Any idea how QEMU works inside? Any idea what the GPL licence would require if I just use 2% of the code in QEMU--whether I'd have to bundle the code for the whole thing, or just the part that I use, or what?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小ぇ时光︴ 2024-09-22 20:31:14

尝试QEMU

Try QEMU.

那一片橙海, 2024-09-22 20:31:14

通过一些工作,您可以让我的模拟器执行您想要的操作。它是为ARM920编写的,Thumb指令集还没有完成。 MMU/缓存接口也不是。另外,它很慢,因为它是一个解释器。好的一面是,它都是用 C99 编写的。

http://code.google.com/p/gp2xemu/

我没有工作过已经使用了一段时间(svn trunk 已有 2 年历史),但如果您要使用该代码,我很乐意帮助您解决缺少的功能。它获得 MIT 许可,因此与广泛的 BSD 许可相同。

With some work, you can make my emulator do what you want. It was written for ARM920, and the Thumb instruction set isn't done yet. Neither is the MMU/cache interface. Also, it's slow because it is an interpreter. On the bright side, it's all written in C99.

http://code.google.com/p/gp2xemu/

I haven't worked on it for a while (The svn trunk is 2 years old), but if you're going to use the code, I'll be glad to help you out with the missing features. It is licensed under MIT, so it's just the same as the broad BSD license.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文