mbed rtx on LPC1115

09 Mar 2017

Hello,

I try to get working the rtx part of mbed os on a NXP LPC1115 (similar to LPC1114 but 64K Flash and 8k SRAM). I have set up a debug session in LPCXpresso with the led blink example. I can run the example without the wait(0.5) statement in main.cpp.. ;-) With that statement I will get a hard fault exception from the Cortex M0. The call stack is: - wait(0.5) - main.cpp - Thread::wait() - osDelay() - SVC_1_1(svcDelay, ..) in rt._CMSIS.c - SVC_Handler in HAL_CM0.S - osStatus svcDelay() in rt_CMSIS.c - SVC_Handler in HAL-CM0.S

Here I have a reproducable hard fault: SVC_Next: STR R2,[R3] /* os_tsk.run = os_tsk.new */

LDR R0,[R2,#TCB_TSTACK] /* os_tsk.new->tsk_stack */ ADDS R0,R0,#16 /* Adjust Start Address */ LDMIA R0!,{R4-R7} /* Restore new Context (R8-R11) */ MOV R8,R4 MOV R9,R5 MOV R10,R6 MOV R11,R7 MSR PSP,R0 /* Write PSP */ SUBS R0,R0,#32 /* Adjust Start Address */ LDMIA R0!,{R4-R7} /* Restore new Context (R4-R7) */ <- HARD FAULT on that LDMIA --<

So the SVC_Handler is executing the os-call (svcDelay()) correctly, returns back to the SVC_Handler and at the end of the Handler the hard fault occurs. I attach two images from my debug session with all register and memory values, one before the ahrd fault and one after. It would be great, if anyone can give me a hint, how to track down that.

Thanks! Nolte /media/uploads/Nolte/debug1.png

/media/uploads/Nolte/debug2.png