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

LFU: const variables should not default preserve and instead should require attribute

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-11025
    • C2000_22.6.0.LTS
    • Hide
      C2000_22.6.1.LTS
      C2000_21.6.2.LTS*
      Show
      C2000_22.6.1.LTS C2000_21.6.2.LTS*
    • default
    • The only work around is to use --lfu_default=none and then explicitly mark all variables that need to be "preserved" using __attribute__((preserve)). This will avoid the default preserve behavior preserving the constant variables.

      Bank0 App project ->

      In .cmd: .const           : > FLASH_BANK0_SEC3     , ALIGN(8)      // address is 0x83000

      In Bank0.map: (CORRECT)

      .const     0    00083000    00000026    

                        00083000    00000026     buck.obj (.const)

      Bank1 App project ->

      In .cmd: .const           : > FLASH_BANK1_SEC3,     ALIGN(8)       // address is 0x93000

      But still, in Bank1.map:

      .TI.bound:$P$T19$2

      *          0    00083000    00000026    

                        00083000    0000000a     buck.obj (.TI.bound:$P$T19$2)

                        0008300a    0000000a     buck.obj (.TI.bound:$P$T20$3)

                        00083014    00000012     buck.obj (.TI.bound:$P$T18$1)

      The compiler is "preserving" constant variables by default without requiring explicit "preserve" attribute.  And when treating the constant variables as "preserve", the compiler is maintaining their addresses.

      This is a problem because the Bank1 image is now writing not to Bank1 alone, but also Bank0. So it can lead to an issue of the same Bank being Erased/Programmed and Executed simultaneously, leading to unpredictable/incorrect behavior

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

              Created:
              Updated:
              Resolved: