AnsweredAssumed Answered

heap and stack crash issue.

Question asked by mrandreas on Jan 26, 2014
Latest reply on Jan 27, 2014 by Thomas Grieger


I’m currently troubleshooting a crash - hardfault that occurs after a day runtime.  I have a communication interface and a SPI interface reading continually an external device. When only the communication is activated the runtime is longer.


-I have debugged the issue with ETM trace and the last executed code is not doing anything “illegal”. 
-I have increased heap to 0x2000. I’m however not doing “new” objects onto the heap runtime (only during init) and I’m not using malloc. I cannot be sure what’s done in third party library.

-I have increased the stack to 0x1800. The build htm output states maximum stack size 1048 + untraceable function pointers.


I’m using Keil Ui with ulink pro.

1) a) If it's an heap issue could this cause an hardfault or only memfault?

    b) How can I debug heap issues?

    c) Is there a way to monitor the methods pushing to heap?

    d) Is it possible to clear the heap safe way?


2) b) Could stack issue cause an hardfault?

    a) How can I debug stack issues?

    c) I didn’t think that the stack could go full in this way, after a day work with the same chain being called, correct?


3 What other things can cause hardfault when the last executed code is totally ok?