最近在我的计算机课上,我们已经说过使用uVision ARM编译器。现在,我已经做了很多年java并且了解如何编程但是ARM给了我麻烦。
我打算创建的程序是将大写字母转换为小写字母的程序,反之亦然。
我的代码如下。除了两个if语句之外的所有内容都是由老师提供的。
AREA mydata,DATA
output SPACE 50
AREA mycode,CODE,ALIGN=2
THUMB
EXPORT __main
input DCB "The QUICK brown fOx",0
DCD 0
__main PROC
LDR R0,=input ;R0 has input ptr
LDR R1,=output ;R1 has output ptr
loop LDRB R2,[R0] ;R2 has the next character
CBZ R2,exit ;if r2 == 0 go to exit
STRB R2,[R1] ;store R2 @ R1 (output ptr)
if(R1>91 )
SUB R1, #32
else if(R1<91)
ADD R1, #32
B loop ;do the next character
exit MOV R2,#0 ;put in my byte of zero
STRB R2,[R1]
done B done ;end
ENDP
END
运行此命令会给我以下错误(减去文件名,因为它是我的全名):
*** Using Compiler 'V5.06 update 5 (build 528)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'Target 1'
assembling (fileName).s...
(fileName).s(12): error: A1854E: Unknown opcode 'CBZ', maybe wrong target CPU?
(fileName).s(14): error: A1163E: Unknown opcode if(R1>91 , expecting opcode or Macro
(fileName).s(15): error: A1859E: Flag preserving form of this instruction not available
(fileName).s(16): error: A1157E: Syntax error following directive
(fileName).s(17): error: A1859E: Flag preserving form of this instruction not available
(fileName).s(20): error: A1859E: Flag preserving form of this instruction not available
".\Objects\new.axf" - 6 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:00
我搜索过uVision的网站寻找解决方案,我似乎无法找到任何方向。请帮忙! Stack Overflow上的第一篇文章!希望我做得好!