ARM7TDMI不支持请求专用寄存器 [英] ARM7TDMI does not support requested special purpose register

查看:520
本文介绍了ARM7TDMI不支持请求专用寄存器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将一些code。与ARMASM编译GCC(code的Sourcery GCC-4.6.2 EABI)。我用一个ARM7TDMI和我的编译参数是

I need to convert some code compiled with ARMASM to gcc(code sourcery GCC-4.6.2 eabi). I use a ARM7TDMI and my compilations arguments are

arm-none-eabi-gcc -c -march=armv4t -mcpu=arm7tdmi -mlittle-endian -g -O1 

(我省略了-I和-D参数...)

(I omitted the -I and -D arguments...)

在我的文件我有这个code,将不能编译:

In one of my files I have this code that won't compile :

extern inline void ngEnable( void)
{
    int tmp;
    asm volatile(
        "msr %[tmp], CPSR\n\t"
        "bic %[tmp], %[tmp], #0xC0\n\t"
        "msr CPSR_c, %[tmp]"
        : [tmp] "+r" (tmp)
    );
}

我得到这个错误:

I get this error :

C:\DOCUME~1\MALLAR~1.ISC\LOCALS~1\Temp\ccA9cCgQ.s: Assembler messages:
C:\DOCUME~1\MALLAR~1.ISC\LOCALS~1\Temp\ccA9cCgQ.s:267: Error: selected processor does not support requested special purpose register -- `msr r3,CPSR'
make: *** [cdbini.o] Error 1

根据这个帖子

回复:麻烦构建Linux-Linaro的-3.0-2011.08- 0 我已经使用不使用-march的解决方法(我在Windows上构建的,但问题可能是一样的吗?)=所有...

according to this post Re: trouble building linux-linaro-3.0-2011.08-0 (I build on windows, but the problem could be the same?) I'm already using the workaround of not using -march=all...

我的问题是什么你知道吗?

Any idea of what my problem is?

推荐答案

要读专用寄存器,你应该使用夫人指令:

To read a special purpose register, you should use the mrs instruction:

extern inline void ngEnable(void)
{
  int tmp;
  asm volatile(
    "mrs %[tmp], CPSR\n\t"
    "bic %[tmp], %[tmp], #0xC0\n\t"
    "msr CPSR_c, %[tmp]"
    : [tmp] "=r" (tmp)
  );
}

此修复程序后,code为我工作就好了。

After this fix, the code works for me just fine.

此外,由于不使用 TMP 的价值,你实际上甚至不设置它,你应该使用 = - [R (仅输出),而不是 + R (输入输出)。

Also, since you don't use the value of tmp, and you don't in fact even set it, you should use =r (output only) instead of +r (input-output).

这篇关于ARM7TDMI不支持请求专用寄存器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆