travfrog wrote on Monday, November 12, 2012:
Do you have a build map that shows the RAM and Flash usage for your project? I have found the HardFaultException was usually a bad pointer or bad array use - it did not ever seem to be related to the RTOS. In FreeRTOSConfig.h you allocate heap for the OS. It uses that to create your stacks and Queues (btw, I meant to ask for an example of the xCreateQueue call). If it can’t alloc what it needs, it will call the vApplicationMallocFailedHook (assuming you’ve enabled it). Point a break point in there and see if ever happens.
I also found the size of bytes and ints a bit of a struggle to figure out. when you are defining a stack size of a heap size, the number is the number of ints so the number of bytes is 4x that.
What is the structure of the data you are posting around in the messages?
Are you using vApplicationIdleHook - that’s really useful to see if you system is locking up somewhere as this is only serviced when there is nothing for the OS to handle.
Are you clearing the interrupt pending bit inside the interrupt handlers? If that bit remains set then as soon as the interrupt is complete it will run again and again - this can also lead to a hard fault.
What heap file are you using (heap_1,2 or 3). If you are using heap 3 with full malloc and free functionality and not freeing memory after allocating it at run time then you’ll blow up also.
Regards
travfrog