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.

RTOS/66AK2H12: MSMC Caching attributes

Part Number: 66AK2H12
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

We have the following configuration:

K2H12 processor with DDR3 SDRAM

Main application running on ARM-0 under TI-RTOS

Support functions running on 2 DSP cores

Processors use IPC to pass data

A small amount of control data is passed in MSMC.

The ARM software writes to MSMC, flushes cache, and signals the target processor.  The target processor invalidates memory before reading.  The DSPs also pass data back to the ARM:  they define MSMC as non-cached.  They write to MSMC and then signal.  The ARM invalidates the cache area before reading results.

The DSPs turn disable caching for the MSMC space using:

CACHE_invAllL1dWait();

CACHE_invL2Wait();

CACHE_disableCaching (MSMC_ADDRESS >> 24);

Where MSMC_ADDRESS is 0x0c000000.

Observations:

- From the debugger, on the DSP, we can see the writes to MSMC. They are consistent between the local memory and physical memory views; cache appears to be disabled on the DSPs as desired.

- When running ARM code compiled as target configuration = debug, both local memory and physical memory show the values written by the DSP, whether we invalidate or not.

- When running the same ARM application compiled as target configuration as release, the debug pod with the ARM0 target shows that the local and physical memory contents, but neither agrees with what the DSP wrote.  (All processors were stopped and we stepped through the DSP code to perform the writes, and stepped through the ARM code to confirm invalidates).  Also, the ARM's view of memory is no different before the cache invalidate than after.  The invalidate call on the ARM is:

Cache_inv (addr, sizeof(data area), Cache_Type_ALLD, TRUE).

The data area is within MSMC, and agrees with the address used by the DSPs.  It is 12 floats long, and is aligned to a 256 byte boundary.  We have confirmed addresses and lengths by stepping into the invalidate routines and examining register values; they are correct.

1) Is this a correct procedure for passing data between the DSPs and ARM cores?  Are there better alternatives?

2) We would like the ARM to treat MSMC as non-cached.  With no caching on either processor, our understanding is that we may have to do something to flush the pipelines during stores, and that the data passing should work. However, we are not sure how to declare that MSMC is non-cacheable from the ARM's perspective.  We appear to have achieved this from the DSP side.  How does one configure MSMC address space as non-cachable from within the ARM?

Thanks and regards,

Tim

  • Hi Tim,

    I've notified the RTOS team. They will post their feedback directly here.

    Best Regards,
    Yordan
  • Hi,

    We have the IPC framework between A15 and C66x, running RTOS. This is the alternative for you writing code to maintain cache coherency or disable cache when using a shared buffer in MSMC or DDR3.

    The examples can be found in .\ipc_3_47_00_00\examples\TCI6636_bios_elf and can be built from top-level makefile. We have messageQ and ping examples. The messageQ example sends messages between two cores. The ping example sends a message between all cores and threads.

    The readme for each example explains them in more detail.
    .\ipc_3_47_00_00\examples\TCI6636_bios_elf\ex02_messageq\readme.txt
    .\ipc_3_47_00_00\examples\TCI6636_bios_elf\ex11_ping\readme.txt

    The examples use DDR but they should be able to use MSMC as long as there is enough space.

    To disable/enable cache on DSP, you would set the MAR bits like below:

    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
    Cache.setMarMeta(base_address, length, Cache.Mar_DISABLE)


    For the ARM side, we need to configure the MMU:

    For example, to disable cache for region 0x8E000000 - 0x8F000000:

    /* Enable the MMU (Required for L1 data caching) */
    var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu');
    Mmu.enableMMU = true;

    /* Initialize MMU Descriptor Attributes */
    var attrs = new Mmu.DescriptorAttrs();
    Mmu.initDescAttrsMeta(attrs);

    /* Configure MMU attributes:
    * See details of parameters in ti.sysbios.family.arm.a15.MMU API manual.
    * ( Part of SYSBIOS release documentation).
    * Type set to Block descriptor, set noexecute bit, allow read/write at PL1
    */
    attrs.type = Mmu.DescriptorType_BLOCK;
    attrs.noExecute = true;
    attrs.accPerm = 0;

    /* Set IO Delay configuration areas as non-cached:
    NOTE: attrIndx 1 by default in Sysbios is configured as non-cached */
    attrs.attrIndx = 1;

    // Define the base address of the 2 MB page
    // the peripheral resides in.
    // Configures 0x8E000000 - 0x8F000000 as noncached.
    Mmu.setSecondLevelDescMeta(0x8E000000, 0x8E000000, attrs);
    Mmu.setSecondLevelDescMeta(0x8E200000, 0x8E200000, attrs);
    Mmu.setSecondLevelDescMeta(0x8E400000, 0x8E400000, attrs);
    Mmu.setSecondLevelDescMeta(0x8E600000, 0x8E600000, attrs);
    Mmu.setSecondLevelDescMeta(0x8E800000, 0x8E800000, attrs);
    Mmu.setSecondLevelDescMeta(0x8EA00000, 0x8EA00000, attrs);
    Mmu.setSecondLevelDescMeta(0x8EC00000, 0x8EC00000, attrs);
    Mmu.setSecondLevelDescMeta(0x8EE00000, 0x8EE00000, attrs);


    To enable cache:


    /* Enable the MMU (Required for L1 data caching) */
    var Mmu = xdc.useModule('ti.sysbios.family.arm.a15.Mmu');
    Mmu.enableMMU = true;

    /* Enable the cache*/
    var Cache = xdc.useModule('ti.sysbios.family.arm.a15.Cache');
    Cache.enableCache = true;

    /* Initialize MMU Descriptor Attributes */
    var attrs = new Mmu.DescriptorAttrs();
    Mmu.initDescAttrsMeta(attrs);

    /* Configure MMU attributes:
    * See details of parameters in ti.sysbios.family.arm.a15.MMU API manual.
    * ( Part of SYSBIOS release documentation).
    * Type set to Block descriptor,
    */
    attrs.type = Mmu.DescriptorType_BLOCK;
    attrs.shareable = 2; // outer-shareable (3=inner, 0=none)
    attrs.accPerm = 1;

    /* Set IO Delay configuration areas as non-cached:
    NOTE: attrIndx 2 by default in Sysbios is configured as cached */
    attrs.attrIndx = 2;

    // Define the base address of the 2 MB page
    // the peripheral resides in.
    // Configures 0x8E000000 - 0x8F000000 as noncached.
    Mmu.setSecondLevelDescMeta(0x8E000000, 0x8E000000, attrs);
    Mmu.setSecondLevelDescMeta(0x8E200000, 0x8E200000, attrs);
    Mmu.setSecondLevelDescMeta(0x8E400000, 0x8E400000, attrs);
    Mmu.setSecondLevelDescMeta(0x8E600000, 0x8E600000, attrs);
    Mmu.setSecondLevelDescMeta(0x8E800000, 0x8E800000, attrs);
    Mmu.setSecondLevelDescMeta(0x8EA00000, 0x8EA00000, attrs);
    Mmu.setSecondLevelDescMeta(0x8EC00000, 0x8EC00000, attrs);
    Mmu.setSecondLevelDescMeta(0x8EE00000, 0x8EE00000, attrs);


    More examples and details are at: software-dl.ti.com/.../Mmu.html

    Regards, Eric
  • I believe we have a handle on this now thanks to another post. Thanks.