Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-12197

lfu: for variables with lfu attribute(preserve), the linker incorrectly combines sections with initialized variables with sections for variables that have attribute(persistent).

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-12362
    • Hide
      C2000_22.6.0.LTS
      C2000_21.6.0.LTS
      Show
      C2000_22.6.0.LTS C2000_21.6.0.LTS
    • Hide
      C2000_25.3.0.LTS*
      C2000_22.6.2.LTS*
      C2000_21.6.2.LTS*
      Show
      C2000_25.3.0.LTS* C2000_22.6.2.LTS* C2000_21.6.2.LTS*
    • default
    • Avoid using attribute(persistent) with lfu attribute(preserve)

      During an lfu compile/link, for variables with attribute(preserve), the linker incorrectly combines sections with initialized variables with sections for variables that have attribute(persistent).

      This could result in the persistent variable being incorrectly initialized at restart.
       
      This may generate an error like below:
       

      <Linking> error #10367-D: output section ".TI.bound:gvar_pre_init" cannot mix noinit sections with sections that require initialization.
          NOINIT sections:
          - .TI.bound:gvar_pre_pers:test.obj
          Sections not specified as NOINIT:
          - .TI.bound:gvar_pre_init:test.obj 
      error #10010: errors encountered during linking; "test.out" not built

       
       
      Note: for CLA, initializing global/static data is not supported.
       
      Example with C code and map files.
      For lfu attributes preserve/update with attributes noinit/persistent:
       

      __attribute__((preserve))                             int gvar_pre_init = 200; __attribute__((preserve)) __attribute__((persistent)) int gvar_pre_pers = 100; __attribute__((preserve)) __attribute__((noinit))     int gvar_pre_noinit;  

       
      Current incorrect behavior: "preserve" variable gvar_pre_init is incorrectly combined into a section with "preserve"/"persistent" variable gvar_pre_pers.
       

      .TI.bound:gvar_pre_init
        *          0    0000013d    00000003     UNINITIALIZED
                        0000013d    00000001     test.obj (.TI.bound:gvar_pre_init)
                        0000013e    00000001     --HOLE--
                        0000013f    00000001     test.obj (.TI.bound:gvar_pre_pers)

       
       
      With the fix, above 2 "preserve" variables are in separate sections.
       

      .TI.bound:gvar_pre_init
        *          0    0000013d    00000001     UNINITIALIZED
                        0000013d    00000001     test.obj (.TI.bound:gvar_pre_init) .TI.bound:gvar_pre_pers
        *          0    0000013f    00000001
                        0000013f    00000001     test.obj (.TI.bound:gvar_pre_pers)

       
       

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: