错误:错误指令'rfe lr'arm交叉编译器

时间:2018-03-13 16:12:12

标签: linux compiler-errors arm embedded

尝试编译第三方引导程序,其中包括一些汇编.S代码,它们为Cortex A5 mpu提供了工具(gcc-linaro-arm-linux-gnueabihf-4.7-2013.03,使用arm-linux-gnueabihf-),但是我遇到了错误的指示:

rfe lr

似乎支持rfe,所以我想知道它是否是编译器问题? 他们声称他们可以使用相同的工具进行编译,但更新过时了。他们的指南包括:

1. sudo apt-get install build-essential git-core libncurses5-dev
2. sudo apt-get install flex bison texinfo zip unzip zlib1g-dev gettext
3. sudo apt-get install gperf libsdl-dev libesd0-dev libwxgtk2.6-dev
4. sudo apt-get install uboot-mkimage
5. sudo apt-get install g++ xz-utils

但是我能找到的最终结果是:

  1. “libwxgtk2.6-dev”替换为“libwxgtk3.0-dev”
  2. “uboot-mkimage”替换为“u-boot-tools”
  3. 必须添加“lib32z1”
  4. 其他一切安装得很好。 (使用Ubuntu 16.04)

    输出:

    ~/at91bootstrap$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper
      CLEAN        obj and misc files!
      CLEAN        configuration files!
      CLEAN        binary files!
    
    
    ~/at91bootstrap$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sama5d4eksd_uboot_defconfig
    #
    # configuration written to .config
    #
    #
    # make dependencies written to .auto.deps
    # See top of this file before playing with this auto-preprequisites!
    #
    
    ~/at91bootstrap$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
    CC
    ========
    arm-linux-gnueabihf-gcc 4.7.3
    
    as FLAGS
    ========
    ... 
    .
    .
    .
    AS        ~/at91bootstrap/driver/svc_handler.S
    CC        ~/at91bootstrap/driver/svc_mgr.c
    AS        ~/at91bootstrap/driver/monitor/mon_init.S
    AS        ~/at91bootstrap/driver/monitor/mon_switch.S
    ~/at91bootstrap/driver/monitor/mon_switch.S
    ~/at91bootstrap/driver/monitor/mon_switch.S: Assembler messages:
    ~/at91bootstrap/driver/monitor/mon_switch.S:94: Error: bad instruction `rfe lr'
    ~/at91bootstrap/driver/monitor/mon_switch.S:170: Error: bad instruction `rfe lr'
    Makefile:297: recipe for target ~/at91bootstrap/driver/monitor/mon_switch.o' failed
    make: *** [~/at91bootstrap/driver/monitor/mon_switch.o] Error 1
    

1 个答案:

答案 0 :(得分:-1)

我能够重现你的问题。过程:创建名为rfe.S

的文件
.text
.thumb
 rfe lr
.end

gcc 4.7.3:

/opt/linaro/4.7.3/bin/arm-linux-gnueabihf-gcc -dumpversion 
4.7.3
/opt/linaro/4.7.3/bin/arm-linux-gnueabihf-gcc -march=armv7-a -mtune=cortex-a5 -c -o rfe.o rfe.S
rfe.S: Assembler messages:
rfe.S:3: Error: bad instruction `rfe lr'

好消息是7.2.1工作正常,在最坏的情况下,您可以使用7.2.1修改构建过程以编译违规的.S文件:

/opt/linaro/gcc-linaro-7.2.1-2017.11-x86_64_arm-eabi/bin/arm-eabi-gcc -dumpversion
7.2.1
/opt/linaro/gcc-linaro-7.2.1-2017.11-x86_64_arm-eabi/bin/arm-eabi-gcc -march=armv7-a -mtune=cortex-a5 -c -o rfe.o rfe.S
/opt/linaro/gcc-linaro-7.2.1-2017.11-x86_64_arm-eabi/bin/arm-eabi-objdump -d rfe.o

rfe.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <.text>:
   0:   e99e c000       rfeia   lr

当使用32位指令集时,rfe.S也会进行汇编:

.text
.arm
 rfe lr
.end


/opt/linaro/gcc-linaro-7.2.1-2017.11-x86_64_arm-eabi/bin/arm-eabi-objdump -d rfe.o

rfe.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <.text>:
   0:   f89e0a00        rfeia   lr

这可能是一个symtom,您尝试编译的代码确实需要与您认为需要的代码不同的替代品。

我建议尝试使用7.2.1 Linaro toolchain,如果幸运的话,你的代码将按原样编译。如果没有,尝试使用7.2.1组合有问题的文件。

我希望这个答案可以帮助你。