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.

Move the placement of memory section from *.cfg to *.cmd

Hi All,

I am working on CCS5.0 and C6670. I want to place all my memory configuration in cmd file instead of cfg file

The memory section in the project i am working is defined in *.cfg file, whereas i need to place all my memory sections in *.cmd file. Also, i need to create a single 'cmd' file for all the cores. For this activity i have made some changes in my cfg file and cmd file.

I have commented out the ".stack" section in cfg file and placed it in cmd file.

The code below was written in cfg file for the placement of stack section in CORE2_L2SRAM

// Program.sectMap[".stack"] = new prog.SectionSpec();

// Program.sectMap[".stack"].loadSegment = 'CORE2_L2SRAM';

and now the code which i have written in cmd file for the placement of stack section in CORE2_L2SRAM is

MEMORY
{
CORE2_L2SRAM : origin = 0x12800000 len = 0x100000
}

SECTIONS
{
.stack: load >> CORE2_L2SRAM

}

The problem which i am facing is that the stack section is getting placed in L2SRAM i.e. at location 0x00800000 instead of CORE2_L2SRAM.

Kindly suggest me the solution to move the code from cfg file to cmd file for the placement of memory sections

Regards,

Deepain Nayyar

  • Deepain,

    The reason is that out of the *.cfg is a bunch of generated files of which one of them is a linker.cmd file.  In this linker.cmd file, its placing .stack for you.
    Doing:

    Program.sectMap[".stack"] = xxx;  in your .cfg file simply lets you override the default.  By commenting these lines out, you are still getting the default placement.

    To do what you want, I think you need to create your own platform and specify your memory map that overrides the default.

    You can try searching in CCS help on "creating platform".

    Juddah

  • Hi Juddah,

    While trying to resolve the problem, i found out that if i am writing the command 

    Program.sectionsExclude = "^\\."; 

    The above command will exclude all sections starting with a period, and it also resolves my problem of overriding the autogenerated linker file with my own linker file.

    Kindly suggest me which is the better option to use

    Program.sectMap[".stack"] = xxx; or

    Program.sectionsExclude = "^\\."; 

    Regards,

    Deepain Nayyar

  • Deepain,

    You are correct about Program.sectionsExclude.  Sorry, I was unaware of this feature.

    If you only want to exclude the .stack then do that with Program.sectionsExclude = ".stack".

    If you want to exclude more sections you might have to do what you suggest, but just realize that
    whatever sections you exclude, you will need to add that into your own linker command file.

    Judah

  • Hi Juddah,

    I have created a new platform and now working on it with my own linker.cmd file.

    Thanks for your help. I'll let you know if i face any other issue in this.

    Regards,

    Deepain Nayyar

  • Hi Juddah,

    I have created a new platform and when i am trying to load *.out file in the debug session, it automatically goes into the running state. When I was running the same project with the original platform, everything was working fine.

    Can you please let me know the reason for the above behavior and can you please suggest some solution for the same?

    Regards,

    Deepain Nayyar

  • Deepain,

    Did your previous solution work?  I thought you were going to try to exclude some sections and define them in your own *.cmd file?

    What's the difference between your new platform and old platform?  Where's the program stuck with new platform?  Does it ever get to main?

    Judah

  • Deepain --

    By default, CCS runs programs to 'main' after loading the program.   For some reason, your program is not getting to main() for your new platform.   You can disable this "auto-go-main" feature in CCS and step thru some of the boot code to see where it gets off the tracks.

    In debug perspective, use the Run->Debug Configuration option and you should get a page like this where you can disable that go-main feature.

    -Karl-

  • Hi Juddah,

    My previous solution is working absolutely fine. I had created a new platform by excluding some of the sections and including all the sections in *.cmd file.

    Also, I am able to resolve my current query as well. Actually after creating a new platform, when i tried to load the program, it never goes to main and "Resource conflict exception" was coming. It was due to the problem in the memory organization between L2SRAM and Core0 L2SRAM. Actually, by mistake i had define some of the sections in L2SRAM and some of the sections in Core0 L2SRAM. May be that was creating some problem. When i had moved all the sections into Core0 L2SRAM, everything is working fine.

    Regards,

    Deepain Nayyar

  • If you could kindly mark this thread as answered...that would be much appreciated!

    Judah

  • Hi Judah,

    While moving the memory sections from cfg file to cmd file, I came across one more problem. I want to shift my shared memory region from cfg file to cmd file.

    1) Is this possible to shift shared memory region from cfg file to cmd file?

    2) If  yes, kindly let me know what i have to do in cmd file to shift share memory region from cfg file?

    The code shich i have written in cfg file for creating a shared memory region is :

    var SHAREDMEM = 0x83000000;
    var SHAREDMEMSIZE = 0x00600000;

    var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');

    SharedRegion.numEntries = 1; 
    SharedRegion.translate = false;

    SharedRegion.setEntryMeta(0,
    { base: SHAREDMEM,
    len: SHAREDMEMSIZE,
    ownerProcId: 0,
    isValid: true,
    createHeap: true,
    name: "MessageQ_SR",
    });

    Thanks,

    Deepain Nayyar

  • Deepain,

    The SharedRegion must be specified in the *.cfg file.  What's the thought behind wanting this in the cmd file?

    Judah

  • Hi Judah,

    Actually i want to keep all my memory related configurations in cmd file, if possible. That is why i was thinking of to move to move shared memory region section into cmd file  if there is any method available.

    Regards,

    Deepain Nayyar

  • Deepain,

    You can specify the memory segment in *.cmd just like your other segments but you still need to configure SharedRegion in your *.cfg.
    I don't know if I'm answering your question.  If you could give an example that would help.

    Judah

  • Hi Judah,

    I am writing an example code to explain you what exactly i am trying to do. 

    The code written in cfg is 

    var SHAREDMEM = 0x83000000;
    var SHAREDMEMSIZE = 0x00600000;

    SharedRegion.setEntryMeta(0,
    { base: SHAREDMEM,
    len: SHAREDMEMSIZE,
    ownerProcId: 0,
    isValid: true,
    createHeap: true,
    name: "MessageQ_SR",
    });

    and the equivalent code, which i am writing in cmd after commenting the above code in cfg is

    SECTIONS
    {
    ti.sdo.ipc.SharedRegion_0: { . += 0x600000;} run > 0x83000000, type = NOLOAD
    }

    After doing this, the code is getting compiled without any error, but during runtime i get the message "ipc start failed" "error code -11".

    Even i am not sure whether such kind of experimentation will work or not. 

    Kindly let me know if its possible.

    Regards,

    Deepain Nayyar

  • Deepain,

    You still need to configure SharedRegion in *.cfg file.  The output section is just one thing that comes from SharedRegion but its not the only thing.
    So unfortunately you can't just put that section in your cmd file.

    Judah

  • Hi Judah,

    Thanks a lot for your support !!

    Regards,

    Deepain Nayyar

  • Hi Judah,

    Again one more query!!!

    I am running the application on multicore. Initially i have implemented the placement of memory section from cmd to cfg on Core2 and now i am implementing the same on all the four cores. After implementing this, i am getting the memory map on all the cores almost the same as the previous memory map(all the memory section in cfg), but when i try to run it in a multicore environment ipc_start() does not take place at Core 0. I am not getting why it is happening.

    Initially everything was working fine.

    I am attaching the snapshot of the screen i am getting after i run 

    Thanks,

    Deepain Nayyar