Stm32 cortex-m3 fpu指令硬故障

Stm32 cortex-m3 fpu指令硬故障,stm32,cortex-m3,Stm32,Cortex M3,我的stm32f103固件出现硬故障。 以下是导致执行崩溃的代码行: float shuntResistance = p[SHUNT_RESISTANCE]; 其中p-是浮点的全局数组: float p[CONFIG_NUM_PARAMS]; 调试时出现以下问题: 0800177c: ldr r3, [pc, #332] ; (0x80018cc <adcSetConstants+336>) 0800177e: vldr s10, [r3, #48]

我的stm32f103固件出现硬故障。 以下是导致执行崩溃的代码行:

 float shuntResistance = p[SHUNT_RESISTANCE];
其中p-是浮点的全局数组:

float p[CONFIG_NUM_PARAMS];
调试时出现以下问题:

0800177c:   ldr r3, [pc, #332]      ; (0x80018cc <adcSetConstants+336>)
0800177e:   vldr s10, [r3, #48]     ; 0x30 ; on that instruction program results in hard fault
链接器标志:

-Wl,--static,--gc-sections,-Map=${ProjName}.map,-T../stm32_flash.ld -fmessage-length=0 -mthumb -mcpu=cortex-m3 -ffunction-sections -fdata-sections -fsingle-precision-constant -Dprintf=iprintf -u _printf_float -lc -lnosys -lc
使用的编译器是launchpad的arm none eabi gcc。 使用的IDE是eclipse。 原因是什么

以下是编译器标志:

-c -fmessage-length=0 -mthumb -mcpu=cortex-m3 -mfloat-abi=softfp -ffunction-sections -fdata-sections -fsingle-precision-constant
-c-fmessage length=0-mthumb-mcpu=cortex-m3-mfloat abi=softfp


您的MCU是Cortex M3,没有FPU。您需要使用
-mfloat abi=soft
。“softfp”选项使用的FPU指令对您无效。

您能在硬故障后发布寄存器的内容吗?另外,请看这里:我的理解是cortex-m3没有FPU@德韦尔奇:这是正确的,但您仍然可以将软fpu库与cortex M3一起使用。您能否将代码简化为中断的代码?您还使用了哪些其他命令行选项?将命令行选项减少为仍然中断或工作的选项,然后评估您真正需要的或两个冲突的选项