Hi Giovanni,
thx for the hint. So I was mostly right in my last post about the makeup. So for the M3 (without FPU), it is:
Code: Select all
struct intctx {
regarm_t r4;
regarm_t r5;
regarm_t r6;
regarm_t r7;
regarm_t r8;
regarm_t r9;
regarm_t r10;
regarm_t r11;
regarm_t lr;
};
Unfortunately, my code is still not working 100%: gdb shows me the current Point of execution, but the backtraces do not work:
Code: Select all
(gdb) info threads
8 Thread 536907216 (shell : : WTQUEUE) chSchGoSleepS (newstate=32 ' ') at ../../os/kernel/src/chschd.c:122
7 Thread 536904464 (http : : WTSEM) chSchGoSleepS (newstate=32 ' ') at ../../os/kernel/src/chschd.c:122
6 Thread 536905776 (No Name : : WTSEM) chSchGoSleepS (newstate=32 ' ') at ../../os/kernel/src/chschd.c:122
5 Thread 536901760 (lwipthread : : WTOREVT) chSchGoSleepS (newstate=32 ' ') at ../../os/kernel/src/chschd.c:122
4 Thread 536899024 (blinker : : SLEEPING) chSchGoSleepS (newstate=32 ' ') at ../../os/kernel/src/chschd.c:122
3 Thread 536901456 (usb_lld_pump : : SUSPENDED) chSchGoSleepS (newstate=32 ' ') at ../../os/kernel/src/chschd.c:122
2 Thread 536899336 (idle : : CURRENT) _idle_thread (p=0x0) at ../../os/kernel/src/chsys.c:61
* 1 Thread 536873296 (main : : WTOREVT) chSchGoSleepS (newstate=32 ' ') at ../../os/kernel/src/chschd.c:122
Code: Select all
(gdb) thread apply 4 bt
Thread 4 (Thread 536899024):
#0 chSchGoSleepS (newstate=32 ' ') at ../../os/kernel/src/chschd.c:122
#1 0x06000000 in ?? ()
Backtrace stopped: frame did not save the PC
I guess my problem lies in how I restore the lr and pc register. What I am currently doing is using the saved lr register as Program counter and as lr I use the register above that - which is probably wrong. The openocd register configuration looks like this:
Code: Select all
static const struct stack_register_offset rtos_chibios_Cortex_M3_stack_offsets[] = {
// {offset from head, width}
// (-1 not available, -2 Stackpointer)
{ -1, 32 }, /* r0 */
{ -1, 32 }, /* r1 */
{ -1, 32 }, /* r2 */
{ -1, 32 }, /* r3 */
{ 0x00, 32 }, /* r4 */
{ 0x04, 32 }, /* r5 */
{ 0x08, 32 }, /* r6 */
{ 0x0c, 32 }, /* r7 */
{ 0x10, 32 }, /* r8 */
{ 0x14, 32 }, /* r9 */
{ 0x18, 32 }, /* r10 */
{ 0x1c, 32 }, /* r11 */
{ -1, 32 }, /* r12 */
{ -2, 32 }, /* sp */
{ 0x24, 32 }, /* lr */
{ 0x20, 32 }, /* pc */
{ -1, 96 }, /* FPA1 */
{ -1, 96 }, /* FPA2 */
{ -1, 96 }, /* FPA3 */
{ -1, 96 }, /* FPA4 */
{ -1, 96 }, /* FPA5 */
{ -1, 96 }, /* FPA6 */
{ -1, 96 }, /* FPA7 */
{ -1, 96 }, /* FPA8 */
{ -1, 32 }, /* FPS */
{ -1, 32 }, /* xPSR */
};
Any Ideas what I'm doing wrong?