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/MSP432E401Y: What is the relationship between .cinit & .data

Part Number: MSP432E401Y
Other Parts Discussed in Thread: CCSTUDIO

Tool/software: Code Composer Studio

1 . I check CCS ARM assembly manual, it seems some typo in the manual. the .cinit table should be copy to .data for initialized global variables. Can you please help confirm?

2. Can you please describe more about relationship between .cinit table and .data?  From link command file, .data is just allocated to RAM and its load address = run address. But if you are using GNU tool chains,  .data section is loaded to Flash and run at RAM.  Can we use gnu way to load .data from Flash to RAM and skip load initial value from .cinit ?

CCStudio link command file:


SECTIONS
{
.intvecs: > 0x00000000
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH

.vtable : > 0x20000000
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM
}

GNU linkscript:

.data : ALIGN(4)

{
FILL(0xFF)
/* This is used by the startup code to initialise the .data section */

__data_start__ = . ;
*(.data_begin .data_begin.*)

*(.data .data.*)

*(.data_end .data_end.*)
. = ALIGN(4);

/* This is used by the startup code to initialise  the .data section */
__data_end__ = . ;

} >RAM AT>FLASH

  • AndreTseng said:
    I check CCS ARM assembly manual, it seems some typo in the manual.

    You are correct.  That is a typo.  The section .cinit is used to initialize .data, and not .bss.  I filed CODEGEN-5305 in the SDOWP system to have the manual corrected.  You are welcome to follow it with the SDOWP link below in my signature.

    AndreTseng said:
    Can we use gnu way to load .data from Flash to RAM and skip load initial value from .cinit ?

    There is no straightforward way to do that.  Moreover, there is no advantage in it.  The syntax 

    > RAM AT> FLASH

    is the same as this syntax in a TI linker command file ...

    run = RAM, load = FLASH

    In both cases, the section (which happens to be named .data) takes up space in two different memory ranges, RAM and FLASH. The TI variable initialization model is similar in that it takes up space in RAM (for .data) and FLASH (for .cinit).

    There are some similarities in how the startup code handles variable initialization.  In the GNU case, startup code copies the entire .data section from FLASH to RAM.  In the TI case, startup code copies .cinit from FLASH to .data in RAM.  But there is a key difference.  The .cinit section is compressed, and the startup code knows how to decompress it.  The GNU linker documentation does not say whether .data is compressed, so I presume it isn't.

    Thanks and regards,

    -George