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/TMS320F28388D: COFF vs EABI format

Part Number: TMS320F28388D

Tool/software: TI C/C++ Compiler

When I am compiling my code for EABI format, it is combining multiple section in one section which is causing an issue when I am trying to program the .out file. This does not happens in COFF format.

Below is the example -

I have following section in cmd file -

B0_DCSM_OTP_Z1_LINKPOINTER : origin = 0x78000, length = 0x00000C

/* B0 Z1 OTP. GPREG1/GPREG2 */

B0_DCSM_OTP_Z1_GPREG : origin = 0x7800C, length = 0x000004

/* B0 Z1 OTP. PSWDLOCK/RESERVED */

B0_DCSM_OTP_Z1_PSWDLOCK : origin = 0x78010, length = 0x000004

/* B0 Z1 OTP. CRCLOCK/RESERVED */

B0_DCSM_OTP_Z1_CRCLOCK : origin = 0x78014, length = 0x000004

/* B0 Z1 OTP. GPREG3/BOOTCTRL */

B0_DCSM_OTP_Z1_BOOTCTRL : origin = 0x7801C, length = 0x000004

After I compile the code in EABI format, below is what I get

 Program Segment Table

    id type    load addr  run addr   file size mem size flags align
    -- ----    ---------  --------   --------- -------- ----- -----
    0  PT_LOAD 0x00078000 0x00078000 0x18      0x18     r--   2   

Below is what I get incase of COFF -

     id name                      page load addr  run addr      size align alloc
     -- ----                      ---- ---------  --------      ---- ----- -----
      1 $build.attributes            0 0x00000000 0x00000000    0x30     1   N 
      2 b0_dcsm_otp_z1_linkpoi...    0 0x00078000 0x00078000     0xc     2   Y 
      3 b0_dcsm_otp_z1_gpreg         0 0x0007800c 0x0007800c     0x4     2   Y 
      4 b0_dcsm_otp_z1_pswdlock      0 0x00078010 0x00078010     0x4     2   Y 
      5 b0_dcsm_otp_z1_crclock       0 0x00078014 0x00078014     0x4     2   Y 
      6 b0_dcsm_otp_z1_bootctrl      0 0x0007801c 0x0007801c     0x4     2   Y 

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

Question is, how can I tell compiler to not combine different sections in cmd file into one for EABI format?

Regards,

Vivek Singh

  • As a point of terminology this ...

    Vivek Singh said:

    I have following section in cmd file -

    B0_DCSM_OTP_Z1_LINKPOINTER : origin = 0x78000, length = 0x00000C

    ... is not a section, but a memory range.  Sections are formed in the SECTIONS directive of the linker command file.  Please read the first part of the article Linker Command File Primer.  Focus on understanding the terms input section, output section, and memory range.

    I have to introduce another new term.  This ...

    Vivek Singh said:

     Program Segment Table

        id type    load addr  run addr   file size mem size flags align
        -- ----    ---------  --------   --------- -------- ----- -----
        0  PT_LOAD 0x00078000 0x00078000 0x18      0x18     r--   2   

    ... is a segment.  As you have seen, segments can span sections and memory ranges.  Speaking generally, a loader can be implemented to work in terms of segments.  Though a loader can also be implemented to work in terms of sections.  Especially on large programs, loading segment by segment is often more efficient than loading section by section.

    (Side note for those following along ... You do not see the segments in the linker map file, but in the output of the object file display utility ofd2000.)

    However, linker command files are still written in terms of memory ranges and sections.  I recommend you ignore the segments.  The sections in the linker command file work the same way in both COFF and ELF object formats.

    Thanks and regards,

    -George

  • Hi George,

    Thanks for the detail. Loader is already looking as the segment and we can not change that. What I am looking for is an compile option to have same segments for EABI same as in case of COFF.

    Regards,

    Vivek Singh

  • There is no mechanism by which you can control how segments are formed.  Furthermore, segments are not a concept in COFF object file format, but only ELF object file format.  

    Just for the moment, ignore terms like segment and section.  What is the overarching problem you need to solve?

    Thanks and regards,

    -George

  • We have a loader which has been working with COFF without any issue. We changed the format to EABI and it does not work. After some debug we found that it is because in EABI multiple sections are combined into one segment (I have to call this something). Below is how we have defined section in cmd file (it is same as memory range) -

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

    SECTIONS

    {

    b0_dcsm_otp_z1_linkpointer : > B0_DCSM_OTP_Z1_LINKPOINTER PAGE = 0//, type = DSECT

    b0_dcsm_otp_z1_gpreg : > B0_DCSM_OTP_Z1_GPREG PAGE = 0//, type = DSECT

    b0_dcsm_otp_z1_pswdlock : > B0_DCSM_OTP_Z1_PSWDLOCK PAGE = 0//, type = DSECT

    b0_dcsm_otp_z1_crclock : > B0_DCSM_OTP_Z1_CRCLOCK PAGE = 0//, type = DSECT

    b0_dcsm_otp_z1_bootctrl : > B0_DCSM_OTP_Z1_BOOTCTRL PAGE = 0//, type = DSECT

    b0_dcsm_zsel_z1 : > B0_DCSM_ZSEL_Z1_P0 PAGE = 0//, type = DSECT

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

    The loader check the start address for each segment and sets some attribute. Difference sections in cmd file have different attribute. Since everything is getting combined in one in EABI, wrong attributes is getting set for some sections. 

    Regards,

    Vivek Singh 

  • Hi George,

    Any suggestion on how to resolve this? We have a big customer who is stuck with this issue and looking for quick solution.

    Regards,

    Vivek Singh

  • This issue is being handled outside the forum.

    Thanks and regards,

    -George