赞
踩
用的stm32f407芯片,定义了一个float型变量,总是进入硬件中断,按照正点原子的移植方法,修改函数也不行,从网上参考了许多方法,说是UCOS-III不支持FPU,按照说明修改了函数都不行,不经不行,而且程序完全不能运行了。
后来看到有人说要在启动文件中开启FPU,按照方法修改了启动文件的Reset_Handler函数后,可以正常运行了。可能是UCOS-III的版本不一样,其他地方都不用改,只修改启动文件就可以了
Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 IF {FPU} != "SoftVFP" ; Enable Floating Point Support at reset for FPU LDR.W R0, =0xE000ED88 ; Load address of CPACR register LDR R1, [R0] ; Read value at CPACR ORR R1, R1, #(0xF <<20) ; Set bits 20-23 to enable CP10 and CP11 coprocessors ; Write back the modified CPACR value STR R1, [R0] ; Wait for store to complete DSB ; Disable automatic FP register content ; Disable lazy context switch LDR.W R0, =0xE000EF34 ; Load address to FPCCR register LDR R1, [R0] AND R1, R1, #(0x3FFFFFFF) ; Clear the LSPEN and ASPEN bits STR R1, [R0] ISB ; Reset pipeline now the FPU is enabled ENDIF LDR R0, =__main BX R0 ENDP
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。