I have the following problem.
The scenario first:
- Custom board (fully tested) with Kinetis K10 MCU
- Kinetis Design Studio 3.0.0
- Pemicro Multilink Universal debugger
- FreeRTOS 9.0.0 (I’m using the GCC / Cortex M3 port)
- I’m not using Processor Expert
The problem: when debugging a program with FreeRTOS, I can set breakpoints and step through code, but when I try to return from a function by stepping on its last instruction (i.e. closing curly bracket), gdb crashes. In the console I get the following errors:
Unable to go into background mode.
Error communicating to target processor - try a RESET.
PE-ERROR: TARGET IS RUNNING
The same program works as expected if I let it run without debugging. Please note that when I debug a program that doesn’t use FreeRTOS everything works like a charm.
In assembler, the offending instruction that causes the crash to happen is ‘mov sp,r7’. I noticed that at this point the PSP is used instead of MSP. After stepping on this instruction the crash occurs and the disassembly window shows: -__isr_vector followed by rows of : 0xffffffff.
Also, in FreeRTOSConfig.h, I have defined configTASK_RETURN_ADDRESS 0 /* return address of task is zero */ as suggested in some posts.
Thank you in advance for your help, which would be greatly appreciated.