malloc crushing M0 core

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by metraTec on Tue Mar 01 08:22:07 MST 2016

I'm working with a LPC Link2 board as evaluation board for the LPC 4370.
I recognized a problem with malloc on my system when changing the used core for a lib from M4 to M0App.

I reduced the problem to code only containing malloc (and a while-loop at the start to have time to get the debugger running on M0). When calling malloc the system crashed (Hardfaulthandler). But if the debugger is running and I'm stepping over malloc the interrupt does not appear. malloc also runs without any problem on the M0Sub and M4 core.

So it looks like some kind of timing thing to me but I've no idea how the malloc in main can be dependent on any timing. Found nothing on google or the forum so now it's time for help :)