Content originally posted in LPCWare by CodeRedSupport on Thu Mar 25 07:43:53 MST 2010
This is most likely caused by stack corruption. There is no stack checking on the Cortex-M families, so you have to be careful where you place the stack, program data, and the heap (malloc space).
If you are using the standard linker scripts, stack is placed at the top of RAM, program data is at the bottom on RAM, and the heap immediately after that.
If you are using a lot of stack, it can grow into the heap or even the program data space. If the stack has 'overflowed' into those spaces, when you write to the heap/program data it can overwrite values on the stack and thus corrupt it.
The stack is used for both your application AND any interrupts that may be firing (including nested interrupt), so you need to ensure there is enough space for the worst-case scenario.
Also, check that you are not allocating large amounts of data on the stack (e.g. allocating a local array, as this will be placed on the stack).
I see you are building for an LPC1114. This only has 8k of RAM, so you will not have a lot to play with.