This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2632: Reading of MSP register

Part Number: AM2632


Hello, I'm in the middle of debugging. And I want to catch stack frame, when issue occurs.

I found interesting MSP register values. Page 25 in this document. sprad28.pdf

I did try that example. But I failed even with building of my project.

Here are the errors:

Please help

  • Hi Alex,

    Which AM263x MCU+ SDK version you are using? The latest one is 09.01.00.

    Best regards,

    Ming

  • Hello,

    I'm using this version - mcu_plus_sdk_am263x_08_06_00_14.

  • I'm facing issue with watch dog reset. During long term testing the board can be reseted. I want to know the state of stack at this point and any additional information, which can help to identify what is causing the watchdog reset.

  • I've connected the USART and want to print this information there before reset

  • Hi Alex,

    The MSP is for M4F core. For R5F core, you should use the code in 5.3 Fetching Core Registers Inside an Abort Handler: 

    HwiP_armv7r_handlers_nortos.c

    volatile uint32_t lrVal, pcVal, spVal;
    __attribute__((naked)) void HwiP_data_abort_handler(void)
    {
    //When data abort occurs, the processor first halts here
    /* Store Core Registers */
    __asm volatile ( "mov %0, lr" : "=r" ( lrVal ) );
    __asm volatile ( "mov %0, pc" : "=r" ( pcVal ) );
    __asm volatile ( "mov %0, sp" : "=r" ( spVal ) );
    /* Call the C version of the abort handler */
    __asm ("B HwiP_data_abort_handler_c");
    }

    Best regards,

    Ming

  • I've tried to print data from HwiP_data_abort_handler_c function, and it doesn't work. Function either is not called or printed data is equal to zero

  • Hi Alex,

    The HwiP_data_abort_handler only gets called when the data abortion happens.

    You should put the following ASM code in the event handler (HwiP_event_handler):

    __asm volatile ( "mov %0, lr" : "=r" ( lrVal ) );
    __asm volatile ( "mov %0, pc" : "=r" ( pcVal ) );
    __asm volatile ( "mov %0, sp" : "=r" ( spVal ) );

    then call the event handler in C:

    /* Call the C version of the abort handler */
    __asm ("B HwiP_event_handler_c"); 

    Best regards,

    Ming

  • I've simulated data abort, and did like this:

    ----------------------------------------------------------------------------

    void HwiP_data_abort_handler_c(uint32_t *pMSP)
    {
        volatile uint32_t loop = 1;
        DebugP_log("\nUsageFault Exception\n");

        DebugP_log("LR = %lx\n", lrVal);
        DebugP_log("PC = %lx\n", pcVal);
        DebugP_log("xPSR = %lx\n", spVal);

        while(loop)
            ;
    }


    void __attribute__((interrupt("ABORT"), section(".text.hwi"))) HwiP_data_abort_handler(void)
    {
        /* Store Core Registers */
        __asm volatile ( "mov %0, lr" : "=r" ( lrVal ) );
        __asm volatile ( "mov %0, pc" : "=r" ( pcVal ) );
        __asm volatile ( "mov %0, sp" : "=r" ( spVal ) );
        /* Call the C version of the abort handler */
        __asm ("B HwiP_data_abort_handler_c");

    --------------------------------

    but it doen't work, values are not printed

  • Hi Alex,

    How did you set up your Debug_Log in example.syscfg?

    Make sure "Enable UART Log" is checked and the COM port for UART0 is connected to the UART emulator (Tera Term).

    Best regards,

    Ming

  • I think this ticket can be closed, I switched to another way of debugging