This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

J721EXCPXEVM: Re-Load the code to C7x via CCS not possible after MMU was activated

Part Number: J721EXCPXEVM

We are developing an APP for C7x on J721E_EMV.  We use CCS 11.0.0.00012 , ti-processor-sdk-rtos-j721e-evm-08_01_00_13.

Our code doesn't use any SCI services. Loading code (program) using CCS works only once in the debug session. It is not possible to re-load the code (after a bug was fixed etc.) again.

That means:

1. Stop debug session
2. Lauch configuration
3. Start the "launch.js" script
4. Connect to C7x,
5. Load, debug
6. Pray the code works otherwise swear and go to step 1 after fixing bugs.

every time.

I have narrowed it down to the MMU Initialization. If the code was started and the MMU was activated,it somehow blocks CCS to load the code normally again. It takes minutes to reload. Even after that long load, the code doesn't run, CCS not able to connect to C7x anymore. Swear and reopen debug session.

We are using default C7x MMU configuration coming with the PDK/IPC example.

I have tried to disable MMU before second reload, looks like CCS is able to re-load the code normally (as fast as usual) , but the code doesn't start and crashes somewhere (no idea where, because CCS loses the connection).

It is not a problem to re-load and run the same code on C66 multiple times, which makes sense, because C66 has no MMU.

The non existing possibility to reload code on C7 makes the debugging a very time consuming and frustrating experience. Please help me with the MMU config so multiple code reloads would be possible.

  • Dusan, can you provide the "default C7x MMU configuration coming with the PDK/IPC example" ?

  • static void IpcInitMmu(Bool isSecure)
    {
        Mmu_MapAttrs    attrs;

        Mmu_initMapAttrs(&attrs);
        attrs.attrIndx = Mmu_AttrIndx_MAIR0;

        if(TRUE == isSecure)
        {
            attrs.ns = 0;
        }
        else
        {
            attrs.ns = 1;
        }

        /* Register region */
        (void)Mmu_map(0x00000000U, 0x00000000U, 0x20000000U, &attrs, isSecure);
        (void)Mmu_map(0x20000000U, 0x20000000U, 0x20000000U, &attrs, isSecure);
        (void)Mmu_map(0x40000000U, 0x40000000U, 0x20000000U, &attrs, isSecure);
        (void)Mmu_map(0x60000000U, 0x60000000U, 0x10000000U, &attrs, isSecure);
        (void)Mmu_map(0x78000000U, 0x78000000U, 0x08000000U, &attrs, isSecure); /* CLEC */

        attrs.attrIndx = Mmu_AttrIndx_MAIR7;
        (void)Mmu_map(0x80000000U, 0x80000000U, 0x20000000U, &attrs, isSecure); /* DDR */
        (void)Mmu_map(0xA0000000U, 0xA0000000U, 0x20000000U, &attrs, isSecure); /* DDR */
    #if defined(SOC_J721S2)
        (void)Mmu_map(0x70000000U, 0x70000000U, 0x00400000U, &attrs, isSecure); /* MSMC - 4MB */
    #elif defined(SOC_J721E)
        (void)Mmu_map(0x70000000U, 0x70000000U, 0x00800000U, &attrs, isSecure); /* MSMC - 8MB */
    #endif
        (void)Mmu_map(0x41C00000U, 0x41C00000U, 0x00100000U, &attrs, isSecure); /* OCMC - 1MB */

        /*
         * DDR range 0xA0000000 - 0xAA000000 : Used as RAM by multiple
         * remote cores, no need to mmp_map this range.
         * IPC VRing Buffer - uncached
         */
        attrs.attrIndx =  Mmu_AttrIndx_MAIR4;
    #if defined(SOC_J721S2)
        (void)Mmu_map(0xA8000000U, 0xA8000000U, 0x02000000U, &attrs, isSecure); /* VRING DDR */
    #  if defined(BUILD_C7X_1)
        (void)Mmu_map(0xA6000000U, 0xA6000000U, 0x00100000U, &attrs, isSecure); /* C7X_1 DDR */
    #  elif defined(BUILD_C7X_2)
        (void)Mmu_map(0xA7000000U, 0xA7000000U, 0x00100000U, &attrs, isSecure); /* C7X_2 DDR */
    #  endif
    #elif defined(SOC_J721E)
        (void)Mmu_map(0xAA000000U, 0xAA000000U, 0x02000000U, &attrs, isSecure); /* VRING DDR */
        (void)Mmu_map(0xA8000000U, 0xA8000000U, 0x00100000U, &attrs, isSecure); /* C7X_1 DDR */
    #endif

        return;
    }

    void InitMmu(void)
    {
        IpcInitMmu(FALSE);
        IpcInitMmu(TRUE);
        OsalCfgClecAccessCtrl(false);

    }
    #endif
  • Dusan,

    Are you warm resetting the C7x before you re-download the code?

    Also, is it intentional that you have back-to-back calls to the IpcInitMmu function - first marking the mmu pages as non-secure then immediately changing those same mmu pages to secure?

    -- Daniel

  • I have already tried to warm reset C7x via CCS,  (Run/Reset/CPU Reset). No effect.

    the "IpcInitMmu()" is taken from TI's  PDK example :

    ti-processor-sdk-rtos-j721e-evm-08_01_00_13\pdk_jacinto_08_01_00_36\packages\ti\drv\ipc\examples\common\src\main_rtos.c

    and out of my scope.

    I'll appreciate any MMU settings or hint to be able to re-load the program...

  • Husan,

    Sorry for the delayed response. Have you tried removing this line of code "IpcInitMmu(FALSE);" , and also making sure you are resetting the C7x before you try downloading the code again? Also, there should be some additional code to configure the C7x MMU hardware. Maybe it is in the  Mmu_initMapAttrs function call. The rest of the code you provided is only setting up the mmu page table entries for specific memory regions and attributes.