使用keil uvision 3的问题
我正在尝试使用 Keil uvision 3 编译 C 代码。只有当我通过选择选项 xdata 作为目标来使用大内存模型时,整个代码才会被编译。要使用这个模型,我必须使用外部数据 RAM,由于某些原因,这对我来说是不可能的。
所以我决定使用 pdata 选项。有人可以帮我了解使用 pdata 的具体步骤吗?我用的是89V51RD2。我对 BL51 MISC、BL51 Locate 等选项很困惑。
I am trying to compile a C code using Keil uvision 3. The entire code gets compiled only if I use large memory model by choosing option xdata for target. To use this model I have to use external data RAM which is not possible for me due to some reasons.
So I decided to go with pdata option. Can anybody please help me with the exact steps to be carried out for using pdata? I am using 89V51RD2. I am much confused with the options like BL51 MISC, BL51 Locate etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能会更好地在 Keil 官方论坛上发布此内容,网址为
http://www.keil.com/forum
根据数据表,NXP P89V51RD2 是 8051 的衍生产品, 1KB 片上 RAM。如果您的程序无法容纳那么多空间,您将必须添加外部RAM。
PDATA 允许您使用“P”方式访问 XDATA。它不是额外的内存。如果您需要更多空间,您应该真正考虑优化内存使用,否则您将不得不添加额外的 XDATA 资源。
参考:C51:使用 PDATA 内存
披露:我为 Keil 工作/ARM
You may have better luck posting this on the official Keil forum at
http://www.keil.com/forum
The NXP P89V51RD2 is an 8051 derivative with, according to the data sheet, 1KB of on-chip RAM. If your program will not fit in that much space, you will have to add external RAM.
PDATA lets you use "P"aged access to XDATA. It is not additional memory. If you need more space, you should really look at optimizing your memory usage, or you will have to add additional XDATA resources.
Reference: C51: USING PDATA MEMORY
Disclosure: I work for Keil/ARM
如果您确实没有任何可用的外部数据 RAM,那么 PDATA 选项将无济于事。 PDATA 驻留在与 XDATA 不同的逻辑地址空间中,但使用相同的物理空间。
例如,您使用的微控制器包含 1kB RAM。所有 1024 字节都可以作为 XDATA 存储器进行访问(地址 XDATA:0x0000 到 XDATA:0x03FF)。 256 字节(一次)可作为 PDATA 存储器进行访问(地址 PDATA:0x00 至 PDATA:0xFF)。假设您将微控制器设置为使用 RAM 的前 256 字节作为 PDATA 内存。这意味着 PDATA:0x00 和 XDATA:0x0000 指向 RAM 的同一物理字节。如果您不小心,您将尝试在同一物理内存中存储两个不同的值,其中一个将被覆盖并丢失。
如果您已经使用了所有 XDATA 内存,则需要使用 DATA 内存或 IDATA 内存来获取更多内存。如果您确实使用 IDATA 内存,则需要非常小心留出足够的空空间,以便您存储的值不会被从 IDATA:0xFF 开始并不断增长的堆栈意外覆盖向下走向 IDATA:0x00
编辑:抱歉,我没有注意到这个问题已经有两年了。不过,希望这对某人有帮助。
If you truly do not have any external data RAM available, then the PDATA option will not help you. PDATA resides in a different Logical address space from XDATA, but uses the same Physical Space.
For example, the micro-controller that you're using contains 1kB of RAM. All 1024 bytes can be accessed as XDATA memory (Addresses XDATA:0x0000 to XDATA:0x03FF). 256 bytes (at a time) can be accessed as PDATA memory (Addresses PDATA:0x00 to PDATA:0xFF). Let's assume that you set up the micro-controller to use the first 256 bytes of RAM as PDATA memory. That means that PDATA:0x00 and XDATA:0x0000 point to the same physical byte of RAM. If you're not careful, you will try to store two different values in the same physical piece of memory and one of them will be overwritten and lost.
If you are already using all of your XDATA memory, you will need to use the DATA memory or the IDATA memory to get more. If you do use IDATA memory, you will need to be very careful that you leave enough space empty so that the values you are storing aren't accidentally overwritten by the stack which starts at IDATA:0xFF and grows down towards IDATA:0x00
Edit: Sorry, I didn't notice that this question was two years old. Hopefully this helps someone, though.