How to enable trace feature on i.MX RT
From SomLabs Wiki
How to enable trace feature on i.MX RT
By default, trace pins are configured as GPIO. To use trace functionality, it is necessary to configure pinmux and enable clock to trace unit. This operation has to be done as early as possibly in init code.
The best way is to use SystemInitHook function, which is called in early init steps. By default, there is an empty SystemInitHook defined in CMSIS files, with __weak__ linking attribute. If linker finds SystemInitHook in any user files it will be used instead of the default one.
So, to enable trace support, we need to define following function in any *.c file:
void SystemInitHook (void) { // configure trace port // configure pinmux IOMUXC_SetPinMux(IOMUXC_GPIO_B0_04_ARM_CM7_TRACE00, 0U); IOMUXC_SetPinMux(IOMUXC_GPIO_B0_05_ARM_CM7_TRACE01, 0U); IOMUXC_SetPinMux(IOMUXC_GPIO_B0_06_ARM_CM7_TRACE02, 0U); IOMUXC_SetPinMux(IOMUXC_GPIO_B0_07_ARM_CM7_TRACE03, 0U); IOMUXC_SetPinMux(IOMUXC_GPIO_B0_12_ARM_CM7_TRACE_CLK, 0U); // enable clock CLOCK_EnableClock(kCLOCK_Trace); }
Segger J-Trace trace functionality is supported by Ozone debugger from Segger.
It is important to properly configure trace parameters in Ozone to make it working, this could be done in menu Tools->Trace settings. Recommended settings are shown on picture below.