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.

Building XDC Modules and Specifying Data locations

Hello,

In continuing my experimentation with XDC, I have two modules: one which receives data from a messageq, and places it in a data buffer, and a second which processes the gathered data from the messageq. My issue is that I want to maintain two modules, who both need access to this data buffer. On top of that, the majority of the data for my program can reside in LL2SRAM, but I want the data buffer to reside in L1DSRAM. If someone (once I'm off the project) wants to change sections, and move things around, I would like all that info to reside in one central location. For example, if I can help it I don't want a global buffer in one module's C file with specific pragmas, and then Program.sectMap code in the .cfg which needs to know about the pragmas in the C file. Ideally I'd like everything to be defined through the .cfg file if possible. For examples I was looking through the RTDX modules which I know define global buffers and place them in some known location somehow, but I quickly got lost. @Templates, and the docs at the RTSCPedia were not 100% clear to me.

I'm targeting a C6472, BIOS 6.32.01.38, xdctools 3.22.02.27, and IPC 1.23.01.26

Thanks

  • You can do everything in the .cfg file, but that means you'll have to repeat these steps in every .cfg file that uses those modules. There are many ways how you can do it, and here is one of them. Please let me know if some assumption I made does not work for you.

    Let's say ModA owns the buffer. This doesn't change much because both modules will access the buffer through their own pointer, and the memory allocation is done by XDCtools.

    ModA.xdc:
    ================
    module ModA {
        config Char bfr[];
        ...
    }

    ModB.xdc:
    ================
    module ModB {
        config Char* bfrA;
        ...
    }

    app.cfg:
    ================
    var Memory = xdc.useModule("xdc.runtime.Memory");
    var ModA = xdc.useModule("buffers.ModA");
    var ModB = xdc.useModule("buffers.ModB");
    ModA.bfr.length = 34;                                        // set the buffer size
    Memory.staticPlace(ModA.bfr, 0, ".myBuffer");                // allocate the buffer to a separate section ".myBuffer"
    Program.sectMap[".myBuffer"] = new Program.SectionSpec();
    Program.sectMap[".myBuffer"].loadSegment = "L1DSRAM";        // allocate ".myBuffer" to L1DSRAM
    ModB.bfrA = ModA.bfr.$addrof(0);                             // set the pointer in ModB to the buffer in ModA

    After you set up all this, you should be able to access the buffer through ModA_bfr in ModA, and ModB_bfrA in ModB. If you wanted multiple instances of ModA and ModB, you would create the buffer and the pointer to it as instance config parameters.
    Here are the links for more information about Memory.staticPlace and use of $addrof operator.

  • Thanks! That is exactly what I was looking for.