如何在ARM汇编中编写至少两个`area`? [英] How to write at least two `area`s in ARM assembly?
问题描述
我正在尝试编写一个区域来定义我在 RAM 上的数据,以及一个用于我的代码的区域.我试图这样做,但我无法让它发挥作用.我也尝试过使用 EXPORT
和 IMPORT
但在使用它们时我无法解决各种错误.
I'm trying to write an area which defines my data on the RAM, and an area for my code. I tried to do that, but I just can't make it work. I also tried using EXPORT
and IMPORT
but I couldn't solve various errors while using them.
AREA HEAP, READWRITE, ALIGN=3
MYSTR DCB "JaVid",0
AREA RESET, CODE, READONLY
;IMPORT MYSTR
ENTRY
ADR R0, MYSTR ;STRING POINTER
NEXT LDRB R1, [R0] ;CHARACTER HOLDER
CMP R1, #'a'
BLT OK
CMP R1, #'z'
BGT OK
;WE NEED TO SWITCH
SUB R1, #'a'-'A'
OK STRB R1, [R0], #1
B NEXT
END
你能给我一个例子来说明它是如何完成的吗?
Would you please give me an example of how it's done?
推荐答案
我怀疑您可能遇到了问题,因为您无法使用 ADR
来引用另一个 AREA
中的符号>.参见本节精装手册
I suspect you may be having problems because you cannot use ADR
to refer to a symbol in another AREA
. See this section of the fine manual
您可能想改用 LDR r0, =MYSTR
.
此外,您的循环似乎并未终止.
Also, your loop does not seem to terminate.
[注意:如果您显示了您收到的确切错误消息以及您在上面的代码中使用的命令行,将会很有帮助.]
[Note: It would be helpful it you showed the exact error message you are getting and the command lines you are using with the code above.]
这篇关于如何在ARM汇编中编写至少两个`area`?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!