gpt4 book ai didi

assembly - 使用uVision ARM编译器的未知操作码 'CBZ'

转载 作者:行者123 更新时间:2023-12-02 10:46:15 24 4
gpt4 key购买 nike

最近,在我的计算机类(class)中,我们说过可以使用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网站上搜索了解决方案,但似乎找不到任何方向。请帮忙!
关于堆栈溢出的第一篇文章!希望我做得好!

最佳答案

您应该检查要编译的 objective-c PU。 CBZ仅在ARMv6T2及更高版本中可用,如其documentation所示。

关于assembly - 使用uVision ARM编译器的未知操作码 'CBZ',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48960410/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com