1, data type default issue caused enter “hard fault during debug”
void HardFault_Handler(void)
{
/* if Hard Fault exception occurs, go to infinite loop */
if(CoreDebug->DHCSR & 1)
{//check c DEBUGEN == 1 -> Debugger connected
__breakpoint(0); //halt program excuation here
}
while (1);
}
1.1 Compile report the below issue
#warning “Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)“
1.2 solution. add setting in keil/ C++
,__FPU_PRESENT,__FPU_USED