Our current project includes FreeRTOS, and I added --use_frame_pointer to Keil uVision’s ARMGCC compiler option. But after loading firmware into STM32F104 chip, then runs it, it crashed. Without --use_frame_pointer, everything is OK. The hard fault handler shows that faultStackAddress is 0x40FFFFDC, which points to a reserved area. Does anyone has any idea of this error? Thanks a lot.
I’m afraid without reading the compiler documentation, or inspecting the changes to the generated assembler code, I don’t know why this would be. The code assumes the compiler generates ARM EABI compliant code, maybe using the frame pointer changes that? Why do you need that compiler option?
We’d like to unwind ARM Cortex M3 stack when crash happened, so we need to save FP(Frame Pointer) to the stack. That’s why we add --use_frame_pointer to Keil uVision’s ARMGCC compiler option.
The timer task is a standard task, written in C, so there is nothing special about it that I am aware of. It does however give a big clue as to where you could focus your debugging. See how far you get through the function - it is actually quite small.
Another odd thing is that if I debug it and step into the TimerTask’s portYIELD_WITHIN_API() function call, then resume the application. It does not crash. So my guess is that this might due to certain time sequence. But I could not find the root cause of it.