解决编译“ Error: selected processor does not support ARM mode `smc #0”问题

在用arm2011.09编译器编译pandaboard的x-loader时遇到如下编译问题:

 Error: selected processor does not support ARM mode `smc #0

google了一下,貌似这样的问题还是挺多的,有几种方法,一一实验。

1.

replacing in arch/arm/mach-omap2/Makefile:

AFLAGS_sleep24xx.o                      :=-Wa,-march=armv6
AFLAGS_sleep34xx.o                      :=-Wa,-march=armv7-a

to:

AFLAGS_sleep24xx.o                      :=-Wa,-march=armv6
AFLAGS_sleep34xx.o                      :=-Wa,-march=armv7-a$(plus_sec)

helps compiling (see also: https://patchwork.kernel.org/patch/369681/)

在config.mk中修改后,实验无效,

$(plus_sec)
为空,无效。

2. uboot的faq,http://www.denx.de/wiki/ELDK-5/FrequentlyAskedQuestionsAndAnswers,标题Cannot compile Linux kernel version 2.6.32 for armv7a

Question:
I want to compile a vendor-provided old Linux kernel tree (kernel version 2.6.32) with ELDK 5.0 for the armv7a configuration. Unfortunately this fails with errors like this one:
 ...
  CC      arch/arm/kernel/sysfs_v7.o
/tmp/ccwkv7On.s: Assembler messages:
/tmp/ccwkv7On.s:249: Error: selected processor does not support ARM mode `smc #0'
/tmp/ccwkv7On.s:289: Error: selected processor does not support ARM mode `smc #0'
make[1]: *** [arch/arm/kernel/sysfs_v7.o] Error 1

Answer:
Your kernel tree is too old for the ELDK 5.0 tool chain.You can work around this problem by applying the following patch to your kernel tree:
--- arch/arm/kernel/sysfs_v7.c.ORIG   2011-01-27 11:47:54.000000000 +0100
+++ arch/arm/kernel/sysfs_v7.c   2011-05-10 08:51:58.953252638 +0200
@@ -76,7 +76,8 @@
    asm ("mrc p15, 0, %0, c1, c0, 1" : "=r"(val));
    SETBITS(val, 0xff8, new);
    val &= ~2;
-   asm ("mov r0,  %0   \n\t"
+   asm (".arch_extension sec\n\t"
+        "mov r0,  %0   \n\t"
         "mov r12, #3   \n\t"
         "smc #0      \n\t"
         :: "r"(val) : "r0", "r12");
@@ -107,7 +108,8 @@
 
    asm ("mrc p15, 1, %0, c9, c0, 2" : "=r"(val));
    SETBITS(val, 0xbc00000, new);
-   asm ("mov r0,  %0   \n\t"
+   asm (".arch_extension sec\n\t"
+        "mov r0,  %0   \n\t"
         "mov r12, #2   \n\t"
         "smc #0      \n\t"
         :: "r"(val) : "r0", "r12");

在代码中添加
.arch_extension sec
后,编译通过。

总结:应该是代码写法与编译器有冲突,需要在代码中声明扩展指令段

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值