This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Run problem on the Corstone SSE-300 (MPS3) simulator

Hi,

Could someone tell me, please, what could be the issue if everything works on the -O3 optimization, but on the -O0 it stops working at the entrance to the "main()" function (freeze)?

Thanks.

Parents Reply Children
  • My apologies - I copied an incorrect version, try this:

    #define CM_DEMCR               (*((volatile uint32_t*)0xE000EDFC))
    #define CM_TRCENA_BIT          (1UL<<24)
    
    #define CM_DWT_LAR             (*((volatile uint32_t*)0xE0001FB0))
    
    #define CM_DWT_CONTROL         (*((volatile uint32_t*)0xE0001000))
    #define CM_DWT_CYCCNTENA_BIT   (1UL<<0)
    
    #define CM_DWT_CYCCNT          (*((volatile uint32_t*)0xE0001004))
    
    void start_cyccnt()
    {
        CM_DEMCR |= CM_TRCENA_BIT;
        CM_DWT_LAR = 0xC5ACCE55;
        CM_DWT_CONTROL |= CM_DWT_CYCCNTENA_BIT; 
        CM_DWT_CYCCNT = 0;
    
    }
    void stop_cyccnt()
    {
        CM_DWT_CONTROL &= ~CM_DWT_CYCCNTENA_BIT;
    }

    I tested the attached with Arm Development Studio 2021.1, and it works well.

    this is a function that does something
    Function took 3131 cycles

    m55_cyclecount.zip