大家好,
我想通过eclipse 编译neon汇编代码,同时通过remote system explorer 在arm 板卡上的linux系统中调试neon汇编代码,我使用的是linaro编译器gcc-linaro-arm-linux-gnueabihf-4.9-2014.09,
但是编译的时候出错了:
Info: Internal Builder is used for build
arm-linux-gnueabihf-gcc -O0 -g3 -Wall -c -fmessage-length=0 -march=armv7-a -mfpu=neon -mfloat-abi=hard -o main.o "..\\main.c"
..\main.c: In function 'main':
..\main.c:17:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
arm-linux-gnueabihf-as -o dequant.o "..\\dequant.S"
..\dequant.S: Assembler messages:
..\dequant.S:30: Error: selected processor does not support ARM mode `vpush {q4-q7}'
..\dequant.S:38: Error: selected processor does not support ARM mode `vdup.32 q2,r6'
..\dequant.S:41: Error: selected processor does not support ARM mode `vld1.16 {d0},[r0]!'
..\dequant.S:42: Error: selected processor does not support ARM mode `vmov.16 d1[0],r2'
..\dequant.S:43: Error: selected processor does not support ARM mode `vdup.32 q1,r5'
..\dequant.S:44: Error: selected processor does not support ARM mode `vmlal.s16 q1,d0,d1[0]'
..\dequant.S:46: Error: selected processor does not support ARM mode `vshl.s32 q3,q1,q2'
..\dequant.S:47: Error: selected processor does not support ARM mode `vqmovn.s32 d0,q3'
..\dequant.S:48: Error: selected processor does not support ARM mode `vst1.16 d0,[r0]!'
..\dequant.S:54: Error: selected processor does not support ARM mode `vpop {q4-q7}'
交叉编译工具gcc的信息:
C:\Program Files (x86)\Linaro\gcc-linaro-arm-linux-gnueabihf-4.9-2014.09\bin>arm
-linux-gnueabihf-gcc.exe -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc.exe
COLLECT_LTO_WRAPPER=c:/program\ files\ (x86)/linaro/gcc-linaro-arm-linux-gnueabi
hf-4.9-2014.09/bin/../libexec/gcc/arm-linux-gnueabihf/4.9.2/lto-wrapper.exe
Target: arm-linux-gnueabihf
Configured with: /cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-wi
n32/.build/src/gcc-linaro-4.9-2014.09/configure --build=i686-build_pc-linux-gnu
--host=i586-host_pc-mingw32msvc --target=arm-linux-gnueabihf --prefix=/cbuild/sl
aves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-win32/install --with-sysroot=
/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-win32/install/arm-l
inux-gnueabihf/libc --enable-languages=c,c++,fortran --disable-multilib --enable
-multiarch --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with
-float=hard --with-pkgversion='crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro G
CC 4.9-2014.09' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --enable-__c
xa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/cbuil
d/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-win32/.build/arm-linux-gn
ueabihf/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/arm-li
nux-gnueabihf-win32/.build/arm-linux-gnueabihf/build/static --with-mpc=/cbuild/s
laves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-win32/.build/arm-linux-gnuea
bihf/build/static --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-
gnueabihf-win32/.build/arm-linux-gnueabihf/build/static --with-cloog=/cbuild/sla
ves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-win32/.build/arm-linux-gnueabi
hf/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux
-gnueabihf-win32/.build/arm-linux-gnueabihf/build/static --enable-threads=posix
--disable-libstdcxx-pch --enable-linker-build-id --enable-gold --with-local-pref
ix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-win32/install/ar
m-linux-gnueabihf/libc --enable-c99 --enable-long-long --with-mode=thumb --disab
le-multilib --with-float=hard
Thread model: posix
gcc version 4.9.2 20140904 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.09
- Linaro GCC 4.9-2014.09)
你好,谢谢你的回复,我在编译选项中加了-marm后编译还是一样的结果,以下是控制台输出信息:
arm-linux-gnueabihf-gcc -O0 -g3 -Wall -c -fmessage-length=0 -march=armv7-a -mfpu=neon -mfloat-abi=hard -marm -o main.o "..\\main.c"
arm-linux-gnueabihf-as -o dequant.o "..\\dequant.S" 这个是编译这个汇编文件的命令?
你先在dequant.S 这个文件的头部找找看,有没有.arm类似的directive,这样好确认该文件是ARM mode。在加上 -marm这个选项,你先单独编译这个文件呢?
另外根据selected processor does not support ARM mode信息,你用的是什么平台呢?看看这个平台有没有什么特殊的模式
我用的是A15 的核, arm-linux-gnueabihf-as -o dequant.o "..\\dequant.S" 我觉得这个是编译这个汇编文件的命令, 这个命令是否还需要加其他的参数?因为这个是默认的选项。我的dequant.S汇编前面的这样的:
.text
.code 32
.syntax unified
.global dequant_neon
dequant_neon:
push {r4-r12,lr}
vpush {q4-q7}
mov r4, #1
sub r5, r3, r4
lsl r5, r4, r5 @r5 = add
......
A15的话,一般没有什么特殊的地方,ARM/Thumb都支持。
.code 32 就表明这个文件是ARM mode的。有的时候,传递给C文件的编译选项,不能正确传递到汇编器。你试试 "arm-linux-gnueabihf-as -marm -o dequant.o "..\\dequant.S"呢?
编译器不识别 -marm
arm-linux-gnueabihf-as -marm -o dequant.o "..\\dequant.S"
Assembler messages:
Error: unrecognized option -marm
我用别的文件试验了一下,只用arm-linux-gnueabihf-as -o dequant.o "..\\dequant.S" 这个命令是不行的,汇编器会报错。
你需要添加 -march=armv7-a -mfpu=neon -mfloat-abi=hard -marm 这些才行。
arm-linux-gnueabihf-as 加上这些参数就可以了 -march=armv7-a -mfpu=neon -mfloat-abi=hard, 不能使用-marm, 非常感谢