refer to these
https://devzone.nordicsemi.com/f/nordic-q-a/27855/using-swo-with-nrf52-redux
i found
~/ncs/modules/tee/tfm/trusted-firmware-m/platform/ext/target/nordic_nrf/common/core/nrfx/mdk/system_nrf9160.c
and
~/ncs/modules/hal/nordic/nrfx/mdk/system_nrf9160.c
#if defined (ENABLE_TRACE)
// Enable Trace And Debug peripheral
NRF_TAD_S->ENABLE = TAD_ENABLE_ENABLE_Msk;
NRF_TAD_S->CLOCKSTART = TAD_CLOCKSTART_START_Msk;
// Set up Trace pads SPU firewall
NRF_SPU_S->GPIOPORT[0].PERM &= ~(1 << TRACE_TRACECLK_PIN);
NRF_SPU_S->GPIOPORT[0].PERM &= ~(1 << TRACE_TRACEDATA0_PIN);
NRF_SPU_S->GPIOPORT[0].PERM &= ~(1 << TRACE_TRACEDATA1_PIN);
NRF_SPU_S->GPIOPORT[0].PERM &= ~(1 << TRACE_TRACEDATA2_PIN);
NRF_SPU_S->GPIOPORT[0].PERM &= ~(1 << TRACE_TRACEDATA3_PIN);
// Configure trace port pads
NRF_P0_S->PIN_CNF[TRACE_TRACECLK_PIN] = TRACE_PIN_CNF_VALUE;
NRF_P0_S->PIN_CNF[TRACE_TRACEDATA0_PIN] = TRACE_PIN_CNF_VALUE;
NRF_P0_S->PIN_CNF[TRACE_TRACEDATA1_PIN] = TRACE_PIN_CNF_VALUE;
NRF_P0_S->PIN_CNF[TRACE_TRACEDATA2_PIN] = TRACE_PIN_CNF_VALUE;
NRF_P0_S->PIN_CNF[TRACE_TRACEDATA3_PIN] = TRACE_PIN_CNF_VALUE;
// Select trace pins
NRF_TAD_S->PSEL.TRACECLK = TRACE_TRACECLK_PIN;
NRF_TAD_S->PSEL.TRACEDATA0 = TRACE_TRACEDATA0_PIN;
NRF_TAD_S->PSEL.TRACEDATA1 = TRACE_TRACEDATA1_PIN;
NRF_TAD_S->PSEL.TRACEDATA2 = TRACE_TRACEDATA2_PIN;
NRF_TAD_S->PSEL.TRACEDATA3 = TRACE_TRACEDATA3_PIN;
// Set trace port speed to 32 MHz
NRF_TAD_S->TRACEPORTSPEED = TAD_TRACEPORTSPEED_TRACEPORTSPEED_32MHz;
*((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;
/* Rom table does not list ETB, or TPIU base addresses.
* Some debug probes may require manual configuration of these peripherals to enable tracing.
* ETB_BASE = 0xE0051000
* TPIU_BASE = 0xE0054000
*/
#endif
1. can i use swo and /opt/SEGGER/JLink_V688a/JLinkSWOViewer in nrf9160 dk
to see the log?
2. can use swo in non-secure mode?