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

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

[cpp]  view plain copy
  1. Error: selected processor does not support ARM mode `smc #0  

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

1.

[cpp]  view plain copy
  1. replacing in arch/arm/mach-omap2/Makefile:  
  2.   
  3. AFLAGS_sleep24xx.o                      :=-Wa,-march=armv6  
  4. AFLAGS_sleep34xx.o                      :=-Wa,-march=armv7-a  
  5.   
  6. to:  
  7.   
  8. AFLAGS_sleep24xx.o                      :=-Wa,-march=armv6  
  9. AFLAGS_sleep34xx.o                      :=-Wa,-march=armv7-a$(plus_sec)  
  10.   
  11. 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:
   
     
     
     
     
[cpp] view plain copy
  1.  ...  
  2.   CC      arch/arm/kernel/sysfs_v7.o  
  3. /tmp/ccwkv7On.s: Assembler messages:  
  4. /tmp/ccwkv7On.s:249: Error: selected processor does not support ARM mode `smc #0'  
  5. /tmp/ccwkv7On.s:289: Error: selected processor does not support ARM mode `smc #0'  
  6. 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:
   
     
     
     
     
[cpp] view plain copy
  1. --- arch/arm/kernel/sysfs_v7.c.ORIG   2011-01-27 11:47:54.000000000 +0100  
  2. +++ arch/arm/kernel/sysfs_v7.c   2011-05-10 08:51:58.953252638 +0200  
  3. @@ -76,7 +76,8 @@  
  4.     asm ("mrc p15, 0, %0, c1, c0, 1" : "=r"(val));  
  5.     SETBITS(val, 0xff8, new);  
  6.     val &= ~2;  
  7. -   asm ("mov r0,  %0   \n\t"  
  8. +   asm (".arch_extension sec\n\t"  
  9. +        "mov r0,  %0   \n\t"  
  10.          "mov r12, #3   \n\t"  
  11.          "smc #0      \n\t"  
  12.          :: "r"(val) : "r0""r12");  
  13. @@ -107,7 +108,8 @@  
  14.    
  15.     asm ("mrc p15, 1, %0, c9, c0, 2" : "=r"(val));  
  16.     SETBITS(val, 0xbc00000, new);  
  17. -   asm ("mov r0,  %0   \n\t"  
  18. +   asm (".arch_extension sec\n\t"  
  19. +        "mov r0,  %0   \n\t"  
  20.          "mov r12, #2   \n\t"  
  21.          "smc #0      \n\t"  
  22.          :: "r"(val) : "r0""r12");  
在代码中添加
.arch_extension sec
后,编译通过。

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

你可能感兴趣的:(linux内核调试与优化)