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.

Compiler/RM57L843: Addition of a new memory section in linker .

Part Number: RM57L843

Tool/software: TI C/C++ Compiler

Hello,

I want to create a separate memory section of around 500 bytes in RAM and keep all the desired variables in that memory region. 

How can i do it using linker script file. Or is there any other way to do it.?

Thank You.

  • Hello,

    The DATA_SECTION pragma can be used to allocate space for the symbol in a section called section name. The syntax for the pragma in C code is:

    #pragma DATA_SECTION(symbol, "section name");

    In Linker cmd file, you can allocate this output section to a specified memory defined using MEMORY Directive:

    Example of pragma in C code:

    #pragma DATA_SECTION(variable1, ".infoA")

    #pragma DATA_SECTION(variable2, ".infoB")

    Example of Linker Cmd file:

    MEMORY

    {

        ...

        INFOA  : origin = 0x0800_4000, length = 0x100

        INFOB  : origin = 0x0800_5000, length = 0x20

    }

    SECTIONS

    {

       ... ...

       .infoA  : {} > INFOA

     .infoB  : {} > INFOB
    

    }

    So varibale1 is placed in INFOA memory range, and variable1 is placed in INFOB memory range.