Getting unaligned exception on CM4 without FPU

jvgediya wrote on Tuesday, September 19, 2017:


I am getting unaligned exception(Usage fault) in function vListInsertEnd exaclty at below mentioned statement,

pxNewListItem->pxPrevious = pxIndex->pxPrevious;

However when i remove portYIELD_FROM_ISR and taskYIELD from my task code, the frequency of the above exception reduces.

I am developing a product related to networking and i am receiving high number of interrupts. I offload the packet processing to the task from the interrupt handler using Queues.

Do anyone have any idea about the possible issue? I suspect memory corruption but i am not getting any pointers to move ahead in debugging.


rtel wrote on Tuesday, September 19, 2017:

Yes, I expect memory corruption too, accessing pxNewListItem or writing
to pxNewListItem->pxPrevious, or accessing pxIndex must be causing the
exception, which would indicate that one of those three have been corrupted.

First the normal pointers, which I suspect you will have looked at already:

  • Do you have configASSERT() defined?

  • Do you have stack overflow checking set to 2?

  • Are you using a recent version of FreeRTOS, as the more recent the
    more assert() points there are to catch interrupt priority problems.
    The head revision from SVN is recommended there as it will assert() on
    just about all misconigurations now.

Links can be found on this page:

Then, are you sure your interrupt stack is large enough? Interrupts use
the same stack as main(), so the stack set up by your C run time, often
in the linker script (depending on the tools). Overflows in the stack
used by interrupts will not be caught by the stack overflow detection.