context_gcc.s:110: Error: thumb conditional instruction should be in IT block `vstmdbeq r1!,{d8-d15}

RT-Thread 移植过程中,编译 libcpu/arm/cortex-m4/context_gcc.s (RT-Thread 启动文件)时出现如下错误:
rt-thread/libcpu/arm/cortex-m4/context_gcc.s:110: Error: thumb conditional instruction should be in IT block – vstmdbeq r1!,{d8-d15}' rt-thread/libcpu/arm/cortex-m4/context_gcc.s:119: Error: thumb conditional instruction should be in IT block --moveq r4,#0x01’
rt-thread/libcpu/arm/cortex-m4/context_gcc.s:140: Error: thumb conditional instruction should be in IT block – `vldmiane r1!,{d8-d15}’

/opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc -x assembler-with-cpp -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F429xx -DHAVE_CCONFIG_H -DRT_USING_MINILIBC -DRT_USING_NEWLIB -Iboard -ICORE -IHALLIB/Inc -IHALLIB/Inc/Legacy -Ihardware/CAN -Ihardware/KEY -Ihardware/LCD -Ihardware/LED -Ihardware/SDRAM -Irt-thread/components/finsh -Irt-thread/include -Irt-thread/include/libc -ISYSTEM/delay -ISYSTEM/sys -ISYSTEM/usart -IUSER  -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/context_gcc.d" rt-thread/libcpu/arm/cortex-m4/context_gcc.s -o build/context_gcc.o
rt-thread/libcpu/arm/cortex-m4/context_gcc.s: Assembler messages:
rt-thread/libcpu/arm/cortex-m4/context_gcc.s:110: Error: thumb conditional instruction should be in IT block -- `vstmdbeq r1!,{d8-d15}'
rt-thread/libcpu/arm/cortex-m4/context_gcc.s:119: Error: thumb conditional instruction should be in IT block -- `moveq r4,#0x01'
rt-thread/libcpu/arm/cortex-m4/context_gcc.s:140: Error: thumb conditional instruction should be in IT block -- `vldmiane r1!,{d8-d15}'
rt-thread/libcpu/arm/cortex-m4/context_gcc.s:148: Error: thumb conditional instruction should be in IT block -- `bicne lr,lr,#0x10'
make: *** [Makefile:180:build/context_gcc.o] 错误 1

context_gcc.s:110: Error: thumb conditional instruction should be in IT block `vstmdbeq r1!,{d8-d15}_第1张图片
主要原因是编译参数的问题,在makefile中进行修改即可解决。
错误

FLOAT-ABI = -mfloat-abi=hard
#FLOAT-ABI = -mfloat-abi=softfp
 #FLOAT-ABI = -mfloat-abi=soft

正确

#FLOAT-ABI = -mfloat-abi=hard
#FLOAT-ABI = -mfloat-abi=softfp
FLOAT-ABI = -mfloat-abi=soft

context_gcc.s:110: Error: thumb conditional instruction should be in IT block `vstmdbeq r1!,{d8-d15}_第2张图片
context_gcc.s:110: Error: thumb conditional instruction should be in IT block `vstmdbeq r1!,{d8-d15}_第3张图片

然后进行编译

context_gcc.s:110: Error: thumb conditional instruction should be in IT block `vstmdbeq r1!,{d8-d15}_第4张图片

编译成功。

网上说float-abi是关于CPU浮点计算的编译参数,但是我记得M4是支持浮点的,使用了 ‘hard’和’softfp’两种参数都提示错误,最后换成 'soft’或者直接去掉这个参数可以编译成功,应该不加 ‘-mfload-abi=arg’这个参数默认值就是’soft’吧,在网上查了一圈,没有查到相关结果。网上的说法是,soft是软、硬浮点编译的一个中间值。'hard’和’softfp’是纯硬件和纯软件编译。

后面发现还有第二种解决办法,不需要修改float-abi参数。需要在编译时增加一个参数,ASFLAGS += -Wa,-mimplicit-it=thumb
context_gcc.s:110: Error: thumb conditional instruction should be in IT block `vstmdbeq r1!,{d8-d15}_第5张图片

你可能感兴趣的:(RT-Thread)