Enabling Segger RTT when developing M4 application

Hello,

I’m developing M4 application on my iMX8-MM SoM. freeRTOS scheduler deals with lot of tasks and I would like to enable Segger real time terminal for debugging purposes. This is my current setup:

int main(void)
{
    /* Initialize standard SDK demo application pins */
    /* Application specific */
    BOARD_RdcInit();

    BOARD_InitBootPins();
    BOARD_BootClockRUN();
    BOARD_InitDebugConsole();
    BOARD_InitMemory();
    copyResourceTable();
    SPI_Init();

    /* Segger stuff */
    SEGGER_RTT_Init();
    SEGGER_RTT_printf(0, "RTT is working\n");

    PRINTF("Hello \n");
    ...

I successfully built the code above and flash it to Verdin M4 (i paused uboot before Linux boot), J-Link RTT Viewer attaches to J-Link connection, but program doesn’t sends anything to RTT when gets to
SEGGER_RTT_printf line.
My Verdin SoM is connected to Verdin development board and Im using Segger JLink 11.0 version for debugging.

Any ideas what am I doing wrong here ?

Greetings @spasoye!

I never tried SEGGER RTT with the M4 on our SoCs but I would start by trying some of their sample code on SEGGER`s documentation. I don’t think that’ll immediately solve your issues but perhaps starting by using their API calls and that only will output something useful.
Are you also starting the regular J-Link debugger here (JLinkExe)? Which product name/part number are you using on the J-Link configuration?

Hey @gustavo.tx,

we decided to give up M4 approach for our application, sorry for late reply.
Im using VScode and Cortex-Debug extension for development and debugging.
Device Im using is MIMX8MM1_M4. I think Im allowed to, at least share my launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "jlink debug",
            "cwd": "${workspaceFolder}",
            "executable": "${workspaceRoot}/build/${input:target}/rpmsg_echo.elf",
            "linux": {
                "serverpath": "/usr/bin/JLinkGDBServer", 
                "armToolchainPath":"/usr/bin/"
            },
            "windows": {
                "serverpath": "${env:JLINK_DIR}\\JLinkGDBServer", 
                "armToolchainPath": "${env:ARMGCC_DIR}\\bin"
            },
            "servertype": "jlink",
            "device": "MIMX8MM1_M4",
            "interface": "jtag",
            "type": "cortex-debug",
            "runToMain": true,
            "request": "launch",
            "postLaunchCommands": [
                "flush regs",
                "load"
            ],
            "postRestartCommands": [
                "flush regs",
                "load"
            ]
        }
    ],
    "inputs": [
        {
          "type": "pickString",
          "id": "target",
          "description": "Debug target?",
          "options": [
            "debug",
            "release",
            "ddr_debug",
            "ddr_release",
            "flash_debug",
            "flash_release"
        ],
        "default": "debug"
        }
    ]
}