[C] 纯文本查看 复制代码 /*
*********************************************************************************************************
* OS INITIALIZATION HOOK
*
* Description: This function is called by OSInit() at the beginning of OSInit().
*
* Arguments : None.
*
* Note(s) : 1) When using hardware floating point please do the following during the reset handler:
* a) Set full access for CP10 & CP11 bits in CPACR register.
* b) Set bits ASPEN and LSPEN in FPCCR register.
*********************************************************************************************************
*/
void OSInitHook (void)
{
#if (OS_CPU_ARM_FP_EN > 0u)
CPU_INT32U reg_val;
#endif
/* 8-byte align the ISR stack. */
OS_CPU_ExceptStkBase = (CPU_STK *)(OSCfg_ISRStkBasePtr + OSCfg_ISRStkSize);
OS_CPU_ExceptStkBase = (CPU_STK *)((CPU_STK)(OS_CPU_ExceptStkBase) & 0xFFFFFFF8);
#if (OS_CPU_ARM_FP_EN > 0u)
reg_val = CPU_REG_FP_FPCCR; /* Check the floating point mode. */
if ((reg_val & CPU_REG_FPCCR_LAZY_STK) != CPU_REG_FPCCR_LAZY_STK) {
while (1u) { /* See Note (1). */
;
}
}
#endif
/* Set BASEPRI boundary from the configuration. */
OS_KA_BASEPRI_Boundary = (CPU_INT32U)(CPU_CFG_KA_IPL_BOUNDARY << (8u - CPU_CFG_NVIC_PRIO_BITS));
}
也就是说我如果要开启FPU,需要在复位中断设置 ASPEN and LSPEN均为1,这样就没问题了吧 |