namcho wrote on Wednesday, February 24, 2016:
Hello,
I’m using stm32f429 which is cortex-m4 based also it has got **hardware FPU **unit. I’m using Eclipse Luna 4.4.2 with ARM GNU GCC C++ compiler and GNU-ARM plugin. The version of GNU GCC is 5_2-2015q4.
I’m choosing GCC/ARM_CM4F as porting files and my freertos version is 8.2.3.
The completion is done without any errors but in run-time when I trying to create any task and let it to start than program suddenly goes into HardFault_Handler().
Here is my simple code:
static LedClass led1(LED1, 300), led2(LED2, 600);
int
main(int argc, char* argv[])
{
HAL_Init();
/* Configure the system clock */
SystemInit();
SystemClock_Config();
MX_GPIO_Init();
led1.Create("LED1", configMINIMAL_STACK_SIZE, 1);
led2.Create("LED2", configMINIMAL_STACK_SIZE, 1);
FreertosAbstract::PortSysTickHandler();
while(1){
//Error handler
}
}
/*
* @brief : 1ms systick timer
*/
void SysTick_Handler(void)
{
HAL_IncTick();
FreertosAbstract::PortSysTickHandler();
}
The problem occurs after PortSysTickHandler() function was executed.
Here is the other simple code which is working well: Leds are blinking…
int
main(int argc, char* argv[])
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
led1.Create("LED1", configMINIMAL_STACK_SIZE, 1);
led2.Create("LED2", configMINIMAL_STACK_SIZE, 1);
//FreertosAbstract::TaskStartScheduler();
while(1){
HAL_Delay(100);
led1.LedOff(LED1);
HAL_Delay(200);
led1.LedOn(LED1);
}
}
/*
* @brief : 1ms systick timer
*/
void SysTick_Handler(void)
{
HAL_IncTick();
// FreertosAbstract::PortSysTickHandler();
}
Other problemed example is:
int
main(int argc, char* argv[])
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
led1.Create("LED1", configMINIMAL_STACK_SIZE, 1);
led2.Create("LED2", configMINIMAL_STACK_SIZE, 1);
//FreertosAbstract::TaskStartScheduler();
FreertosAbstract::PortSysTickHandler(); //Program is going to HardFault after this statement
while(1){
HAL_Delay(100);
led1.LedOff(LED1);
HAL_Delay(200);
led1.LedOn(LED1);
}
}
/*
* @brief : 1ms systick timer
*/
void SysTick_Handler(void)
{
HAL_IncTick();
// FreertosAbstract::PortSysTickHandler();
}
So the problem’s cause is the xPortSysTickHandler() function.
Compiler Settings are:
Float ABI: FP Instruction hard
FPU Type: fpv4-sp-d16
I can share my whole code if necessary.