alexanderbaev wrote on Friday, January 16, 2015:
Dear friends.
I have the following problem – my program ends in the HardFault_Handler.
I use STM32F429i-discovery board.
On the first place I took the demo project (CORTEX_M4F_STM32F407ZG-SK). I substituted several files and managed to run the kernel. Then I changed something (I really do not remember what) – and the problem occurred. I tried to do everything from scratch – nothing changed. Then I took template project presented by ST and added I suppose all necessary files for FreeRTOS (again from the ST package). All the code works properly before vTaskStartScheduler(); (I just display test string on the lcd).
I tried to use the code by Joseph Yiu and it helped me to determine the place in which the program goes to the HardFault. It is in the file – port_cm4.c
portBASE_TYPE xPortStartScheduler( void )
{
/* Make PendSV and SysTick the lowest priority interrupts. */
*(portNVIC_SYSPRI2) |= portNVIC_PENDSV_PRI;
*(portNVIC_SYSPRI2) |= portNVIC_SYSTICK_PRI;
/* Start the timer that generates the tick ISR. Interrupts are disabled
here already. */
prvSetupTimerInterrupt();
/* Initialise the critical nesting count ready for the first task. */
uxCriticalNesting = 0;
/* Ensure the VFP is enabled - it should be anyway. */
vPortEnableVFP();
/* Lazy save always. */
*( portFPCCR ) |= portASPEN_AND_LSPEN_BITS;
/* Start the first task. */
vPortStartFirstTask();
/* Should not get here! */
return 0;
}
After stepping through return 0 – program goes to the HardFault.
In the disassembly window returne 0 is represented by the following:
MOVS R0, #0
POP {R1, PC}
The value in the register R1 (again thanks to Joseph Yiu program) which then is loaded to PC points to the empty region (B55F38B9) – if I determined correctly it is 512 MB Block 5 FMC.
What should I check next?
PS: Demo project of ST with FreeRTOS works great, but it has much more then I need, and when I tried to remove certain parts I finished with compilation problems.
PPS. In the current project I had to add the following to the main.c module to pass the compilation:
void EndIdleMonitor(void)
{
}
void StartIdleMonitor(void)
{
}
void vApplicationTickHook(void)
{
}
void vApplicationMallocFailedHook(void)
{
}
void vApplicationIdleHook(void)
{
}