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.

How to create memory segment in RAM using .cmd file

Hi,

Any idea how to create new RAM segment in linker file and access the same in code?

I have gone through document TI-RTOS Kernel Users Guide: www.ti.com/.../spruex3p.pdf for detailed information,it gives more input on usage point of view, but how to define the that, i mean how to declare the specific section in ROM and RAM area is not found.

 Could any one please help out 

Thanks in advance
Nitesh

  • This is an RTOS question, so this thread is moving to the RTOS forum.  Please indicate the device you use and the version of SYS/BIOS you use.  

    Thanks and regards,

    -George

  • Hello Nitesh,

    One way is to copy linker command file, add your segment similar to existing sections and give path to that file in BIOS .cfg file.

    e2e.ti.com/.../988154

    The problem with above is every time your memory map changes you have repeat above steps.

    Another way is to use config.bld which includes memory segment definition file.

    1. To use config file add compiler flag -b (like -b cfg_file.bld)
    2. Include memseg.xs file in the config.bld file.
    var MemSegDefine = xdc.loadCapsule("mem_segment_definition_bios.xs");
    3. Memseg.xs file should have your memory segment definitions like below
    memory[index++] = ["IPU1_1_CODE_MEM", {
    comment : "IPU1_1_CODE_MEM",
    name : "IPU1_1_CODE_MEM",
    base : IPU1_1_CODE_ADDR,
    len : IPU1_1_CODE_SIZE
    }];

    4. Create your memory map file in config.bld using memseg defination file
    externalMemoryMap: MemSegDefine.getMemSegmentDefinition(),
    5. To use newly created segments you can use pragma directives.

    Regards,
    Prasad
  • hi Prasad,

    Thanks for the input , i got the first one

    i tried changing the .cmd file with new section. But could you please help me how to use that segment dynamically

    where i have created RAM3 section in memory , After that i did allocation for that section as shown below. Please correct me if i did any wrong thing.

    suggest me how to use that dynamically. Please guide me.

    For using config.bld usage for the memory section handling, i did not understand how to get the .bld file,

    I am using CCS for MSP430f56559 controller.

    Thanks in advance

    Nitesh

  • Hello Nitesh,

    The section allocation looks good. For using newly allocated section you can use pragma directives.
    For example to use RAM3 section in your example application you can use pragma like below

    #pragma DATA_ALIGN(variable_name, 128);
    #pragma DATA_SECTION(variable_name, ".bss:MEM_SECTION_NAME")
    uint32_t variable_name[size];

    Make sure to add section in .cfg file using .sectmap
    Program.sectMap[".bss:MEM_SECTION_NAME)"] = "RAM3";

    Regards,
    Prasad
  • Hi Prasad,

    Thanks for your help.

    One question why we need the DATA_ALIGN here?

    My usage is, i want to have align my 16 byte 64 pages of EEPROM into RAM3 (My segment ), so i just want to know can i do that ?

    Thanks in advance.

    Nitesh 

     

  • Hello Nitesh,

    Use of  DATA_ALIGN is not mandatory. You may use it if need to align your data.

    For 16 byte alignment you can use  DATA_ALIGN pragma like below for have array 64 pages

    #pragma DATA_ALIGN(variable_name, 16);

    You can read more about data alignment at

    http://www.songho.ca/misc/alignment/dataalign.html

    Regards,

    Prasad