This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ENABLE_TRACE

I have a Segger J-Trace Pro and am attempting to enable trace debugging of my application. I have a custom board that breakout out the appropriate Trace Clk and Trace Data[] signals. I have been reviewing the code to enable the ETM trace functionality. There seems to be support as part of the HAL:

https://github.com/NordicPlayground/fw-nrfconnect-zephyr/blob/master/ext/hal/nordic/nrfx/mdk/system_nrf9160.c#L164

The first issue was NRF_TAD_S->CLOCKSTART = TAD_CLOCKSTART_START_Msk not being defined. I found the definitions in both the manual and this file:

http://developer.nordicsemi.com/nRF_MDK/MDK_8_25_0/BSD/Files/nrf9160_bitfields.h

Then, ran into an issue with, (GPIO_PIN_CNF_MCUSEL_TND << GPIO_PIN_CNF_MCUSEL_Pos)

https://github.com/NordicPlayground/fw-nrfconnect-zephyr/blob/master/ext/hal/nordic/nrfx/mdk/system_nrf9160.c#L41

I could not find a definition for GPIO_PIN_CNF_MCUSEL_TND  anywhere including the nrf9160 product specification manual. Could you assist me in configuring the Trace properly to work with J-Trace and the Segger Ozone debugger?

Thank you,

Jonathan Mohlenhoff

Parents
  • I have tested this in the latest release of nRF Connect SDK, v1.2.0 and was able to get ARM ETM working. I added the ENABLE_TRACE define for the SPM and had to disable GCC optimization for the SystemInit function of system_nrf9160.c:

    #pragma GCC push_options
    #pragma GCC optimize ("O0")
    void SystemInit(void)
    {
        ....
    }
    #pragma GCC pop_options

    I believe the issue has to do with this section of code requiring order of execution:

                *((uint32_t *)(0xE0053000ul)) = 0x00000001ul;
                
                *((uint32_t *)(0xE005AFB0ul))  = 0xC5ACCE55ul;
                *((uint32_t *)(0xE005A000ul)) &= 0xFFFFFF00ul;
                *((uint32_t *)(0xE005A004ul))  = 0x00000009ul;
                *((uint32_t *)(0xE005A000ul))  = 0x00000303ul;
                *((uint32_t *)(0xE005AFB0ul))  = 0x00000000ul;
    
                *((uint32_t *)(0xE005BFB0ul))  = 0xC5ACCE55ul;
                *((uint32_t *)(0xE005B000ul)) &= 0xFFFFFF00ul;
                *((uint32_t *)(0xE005B004ul))  = 0x00003000ul;
                *((uint32_t *)(0xE005B000ul))  = 0x00000308ul;
                *((uint32_t *)(0xE005BFB0ul))  = 0x00000000ul;
    
                *((uint32_t *)(0xE0058FB0ul)) = 0xC5ACCE55ul;
                *((uint32_t *)(0xE0058000ul)) = 0x00000000ul;
                *((uint32_t *)(0xE0058004ul)) = 0x00000000ul;
                *((uint32_t *)(0xE0058FB0ul)) = 0x00000000ul;

    Following the tracing sample from Segger helped configuring Ozone for streaming trace, https://wiki.segger.com/nRF91_Series_Devices.

    Next, get Ozone to be Zephyr RTOS aware. I will mark this as solved, thanks Nordic and Segger!

Reply
  • I have tested this in the latest release of nRF Connect SDK, v1.2.0 and was able to get ARM ETM working. I added the ENABLE_TRACE define for the SPM and had to disable GCC optimization for the SystemInit function of system_nrf9160.c:

    #pragma GCC push_options
    #pragma GCC optimize ("O0")
    void SystemInit(void)
    {
        ....
    }
    #pragma GCC pop_options

    I believe the issue has to do with this section of code requiring order of execution:

                *((uint32_t *)(0xE0053000ul)) = 0x00000001ul;
                
                *((uint32_t *)(0xE005AFB0ul))  = 0xC5ACCE55ul;
                *((uint32_t *)(0xE005A000ul)) &= 0xFFFFFF00ul;
                *((uint32_t *)(0xE005A004ul))  = 0x00000009ul;
                *((uint32_t *)(0xE005A000ul))  = 0x00000303ul;
                *((uint32_t *)(0xE005AFB0ul))  = 0x00000000ul;
    
                *((uint32_t *)(0xE005BFB0ul))  = 0xC5ACCE55ul;
                *((uint32_t *)(0xE005B000ul)) &= 0xFFFFFF00ul;
                *((uint32_t *)(0xE005B004ul))  = 0x00003000ul;
                *((uint32_t *)(0xE005B000ul))  = 0x00000308ul;
                *((uint32_t *)(0xE005BFB0ul))  = 0x00000000ul;
    
                *((uint32_t *)(0xE0058FB0ul)) = 0xC5ACCE55ul;
                *((uint32_t *)(0xE0058000ul)) = 0x00000000ul;
                *((uint32_t *)(0xE0058004ul)) = 0x00000000ul;
                *((uint32_t *)(0xE0058FB0ul)) = 0x00000000ul;

    Following the tracing sample from Segger helped configuring Ozone for streaming trace, https://wiki.segger.com/nRF91_Series_Devices.

    Next, get Ozone to be Zephyr RTOS aware. I will mark this as solved, thanks Nordic and Segger!

Children
No Data
Related