指点成金-最美分享吧

登录

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

佚名 举报

篇首语:本文由小编为大家整理,主要介绍了使用uVision ARM编译器的未知操作码"CBZ"相关的知识,希望对你有一定的参考价值。

最近在我的计算机课上,我们已经说过使用uVision ARM编译器。现在,我已经做了很多年java并且了解如何编程但是ARM给了我麻烦。

我打算创建的程序是将大写字母转换为小写字母的程序,反之亦然。

我的代码如下。除了两个if语句之外的所有内容都是由老师提供的。

            AREA mydata,DATAoutput  SPACE 50          AREA mycode,CODE,ALIGN=2          THUMB          EXPORT __maininput     DCB   "The QUICK brown fOx",0          DCD   0__main   PROC         LDR R0,=input  ;R0 has input ptr         LDR R1,=output ;R1 has output ptrloop     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 characterexit    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_v5ARMARMCCBin"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".Objectsew.axf" - 6 Error(s), 0 Warning(s).Target not created.Build Time Elapsed:  00:00:00

我搜索过uVision的网站寻求解决方案,我似乎无法找到任何方向。请帮忙! Stack Overflow上的第一篇文章!希望我做得好!

答案

您应该检查要编译的目标CPU。 CBZ仅适用于ARMv6T2及更高版本,可在其documentation中看到。

以上是关于使用uVision ARM编译器的未知操作码"CBZ"的主要内容,如果未能解决你的问题,请参考以下文章