在用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
后,编译通过。
总结:应该是代码写法与编译器有冲突,需要在代码中声明扩展指令段