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.

CCS/TMS320F280049C: How to create different Sections for ROM and RAM memories

Part Number: TMS320F280049C

Tool/software: Code Composer Studio

Hi,

We have a requirement on TMS320F280049C MC

we have to create a different RAM and RAM memory sections

Ex:

1. RAM Memory Sections

  • All the global Boolean Variables at one Specific RAM place.
  • Similarly for all the uint8, uint16 and uint32 and user specified structure at one Specific RAM place

2. ROM Memory Sections

  • All the Initialization functions at one Specific ROM place.
  • Similarly other interfaces at Specific ROM place.
  • And constant variables  at Specific ROM place.

Please let us know this this requirement is feasible or not?

if Yes

Please let us the procedure to implement.

if Not

Please let us the possible sections and procedure to implement.

Thanks in advance

  • These are unusual requirements.  There are no features of the tools which make this organization of code and data easy and convenient.  But it can be done. 

    Start by getting some general background.  Please read the first half of the article Linker Command File Primer.  Search the C28x compiler manual for the pragmas CODE_SECTION and DATA_SECTION.  Read the article Pragmas You Can Understand.

    I'll discuss two ways to implement ...

    Siva Sankar Chandika said:
    All the global Boolean Variables at one Specific RAM place

    These same two methods can be applied to the remaining requirements.

    One method ... Put the definition of all the boolean variables in a single C file.  Say it is called boolean_variables.c.  Then in the SECTIONS directive of the linker command file write something like ...

    boolean_variables_output_section
    {
       boolean_variables.obj
    } > BOOLEAN_VARIABLES_MEMORY_RANGE

    This creates an output section named boolean_variables_output_section.  It is made up of all the input sections from the object file boolean_variables.obj.  It is allocated to an address in the BOOLEAN_VARIABLES_MEMORY_RANGE.  If needed, BOOLEAN_VARIABLES_MEMORY_RANGE can be replaced with a hard-coded address such as 0xA000.

    Another method ... In a header file that is included by every source file that defines a boolean variable, have lines similar to these ...

    #define PRAGMA(x) _Pragma(#x)
    #define DEFINE_BOOLEAN(var)                                \
        PRAGMA(DATA_SECTION(var, "boolean_variables_section")) \
        bool var

    To define a boolean variable write ...

    DEFINE_BOOLEAN(variable_name);

    In the SECTIONS directive of the linker command file, write ...

        boolean_variables_section > BOOLEAN_VARIABLES_MEMORY_RANGE

    This creates an output section named boolean_variables_section.  It is made up of all the input sections also named boolean_variables_section.  It is allocated to an address in the BOOLEAN_VARIABLES_MEMORY_RANGE.  If needed, BOOLEAN_VARIABLES_MEMORY_RANGE can be replaced with a hard-coded address such as 0xA000.

    Thanks and regards,

    -George