_sched_start_internal crash (svc)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

_sched_start_internal crash (svc)

1,021 Views
mruetti
Contributor III

Hi there

I have a custom board with an MK60DX256 / 4N22D. The project (bsp/psp) is derived from the TWR-K60D100M and, to sort out the linker file, I took the one from the TWR-K40X256 project as a blue print. I'm using the cw10gcc compiler collection with cw10.6 and MQX 4.1.

My hardware is starting up and running into the _mqx() function. There at the end the scheduler should be started by the function

_sched_start_internal(); /* WILL NEVER RETURN FROM HERE */

that calls

ASM_LABEL(_sched_start_internal)

    svc SVC_RUN_SCHED

    bx lr

ASM_PUBLIC_END(_sched_start_internal)

When I step through the code I can see that the "svc" call behaves badly. It jumps to a strange location and the debugger says:

No source available for "0xBCBD2F46 (0xBCBD2F46)() "

Afterwards the system resets and the RCM_SRS1 register is set to "Reset caused by core LOCKUP event".

Could this be caused by an incorrect linker file (.ld)? Or any other ideas?

Thanks

Mario

0 Kudos
3 Replies

635 Views
mruetti
Contributor III

If found the problem using this little snippet from the mcuoneclipse homepage..

      __asm volatile (

        " movs r0,#4       \n"

        " movs r1, lr      \n"

        " tst r0, r1       \n"

        " beq _MSP         \n"

        " mrs r0, psp      \n"

        " b _HALT          \n"

      "_MSP:               \n"

        " mrs r0, msp      \n"

      "_HALT:              \n"

        " ldr r1,[r0,#20]  \n"

        " bkpt #0          \n"

      );

The r1 register contains the address of the last function before the crash. This did help a lot!!

Thanks to all

Mario

635 Views
Martin_
NXP Employee
NXP Employee

Hi,

it might be incorrect location of the vector table. At runtime, check VTOR register. It tells the offset from address 0x0 where the vector table is located. Then open debugger memory window at VTOR address. SVCall handler is vector 11. Check if the address of SVCall handler looks right.

-Martin

635 Views
mruetti
Contributor III

Hi Martin

Than you for the idea. This leads me to change the MQX_ROM_VECTORS from 0 to 1 to exclude a vector copy problem. Now I end up in the _mqx_idle_task function but my own task gets never started.

Any other ideas?

Mario

0 Kudos