[quote user="Fredrik"]From disassembly(when I mouse over &_lock it shows _lock = 0x000000:[/quote]The run time start up code initializes the _lock pointer to point at the _nop function.
Since the _lock pointer is zero it suggests the _lock pointer has been corrupted in some way, e.g. the code wrote off the end of an array or their was insufficient stack space.
Try setting a hardware watchpoint in the CCS debugger to watch a write to the _lock pointer, so try and find what is corrupting it.