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/TMS320F28335: LOAD and RUN address is same in .MAP output but different in the linker directives

Part Number: TMS320F28335


Tool/software: TI C/C++ Compiler

My linker directives specify that global initialized data is loaded in flash, but is accessed (run) from L0 SARAM. However, the linker is assigning the L0 SARAM address to the specified LOAD address which should be in flash.

Below is the output redacted from the link map:

address       name

--------------   -------

00008000   _APP_DATA_LOAD

00008000   _APP_DATA_RUN

0000045a   _APP_DATA_SIZE

 

Corresponding linker directives:

MEMORY

{

   PAGE 0:

      APP_ROM: origin = 0x300320, length = 0xA500

 

   PAGE 1:

      APP_RAM: origin = 0x008000, length = 0x4000

}

SECTIONS

{

    GROUP (GLOBAL_STATIC_INIT_DATA)

    {

       .data :

       .ebss :

 

    } LOAD = APP_ROM, PAGE = 0,

      RUN  = APP_RAM, PAGE = 1,

      LOAD_START(_APP_DATA_LOAD),

      RUN_START(_APP_DATA_RUN),

      RUN_SIZE(_APP_DATA_SIZE)

}

  • The .data section is probably empty.  The .ebss section is uninitialized.  That means the GROUP is uninitialized.  An uninitialized GROUP or section does not need a load address, only a run address.

    For more background on the kinds of sections produce by the compiler, see the sub-chapter titled Specifying Where to Allocate Sections in Memory in the C28x compiler manual.

    Thanks and regards,

    -George

  • For my TMS570 project I find my initialized file scope globals placed in the .data segment. The linker directives produce a map file showing the .data section LOADed at a flash address I've chosen and accessed (RUN) out of the SARAM address I've chosen. For my TMS320 project of the same source and the same linker directives (plus the PAGE attributes), I find that same initialized data placed into the .ebss segment. I agree with your assessment that it appears this data is being considered as uninitialized and therefore need not be allocated space in flash. However, would not the variables, x, y, z, and nameCopyright seen below be considered initialized global data? They definitely are considered initialized data for the TMS570LS 3137 linker. I guess technically those litterals go into the .cinit section.

    :

    int x = -1;
    int y = -100;
    int z=300;
    char *nameCopyright = "Don't copy this or else! 2018 all rights extended";


    void main (void)
    {
    int fewResources = 3;
    ...
    do_amazing_stuff (fewResources);
    ...
    }
  • When you define a global variable and initialize it ...

    int global_variable = 10;

    ... the compiler takes a series of steps to create a variable in read/write memory, and initialize it before main begins.  The details of how this is done are governed by the application binary interface (ABI).  The ARM compiler uses EABI.  The C2000 compiler uses a different ABI called COFF ABI.  In this post, I only discuss how COFF ABI for C2000 handles this detail.

    The variable global_variable is allocated space in an uninitialized section named .ebss.  An entry is created in the initialized section .cinit.  The .cinit section is typically allocated to read-only memory like FLASH.  The .cinit section is processed by the startup code.  Processing this entry in .cinit causes global_variable to be initialized with the value 10 before main begins.

    For further details on how global variables are initialized on C2000, please see the section titled Automatic Initialization of Variables in the C28x compiler manual.

    Thanks and regards,

    -George