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

When a volatile data object is initialized with a non-volatile designated initializer, the PREAD instruction is correctly used.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Not Prioritized Not Prioritized
    • Code Generation Tools
    • CODEGEN-11609
    • C2000_22.6.0.LTS
    • default
    • Hide
      This is not a bug, however, we will be updating the user guide wording to better clarify below subtlety.

      Struct assigns from non-volatile to volatile can use RPT with PREAD which uses the program bus for reading the non-volatile source operand:
             RPT #4
      || PREAD *XAR4++,*XAR7
        
      Struct assigns from volatile to non-volatile can use RPT with PWRITE which uses the program bus for writing to the non-volatile destination operand:
             RPT #4
      || PWRITE *XAR7,*XAR4++
        
      The provided test case that generates an RPT with PREAD is doing a struct assign from a non-volatile instance of non-volatile struct tsArray to a volatile struct.
      Show
      This is not a bug, however, we will be updating the user guide wording to better clarify below subtlety. Struct assigns from non-volatile to volatile can use RPT with PREAD which uses the program bus for reading the non-volatile source operand:        RPT #4 || PREAD *XAR4++,*XAR7    Struct assigns from volatile to non-volatile can use RPT with PWRITE which uses the program bus for writing to the non-volatile destination operand:        RPT #4 || PWRITE *XAR7,*XAR4++    The provided test case that generates an RPT with PREAD is doing a struct assign from a non-volatile instance of non-volatile struct tsArray to a volatile struct.

      The attached file has these lines ...

      __attribute__((far)) volatile tsVar Global;
      ...
          Global.var = (tsArray) { .array = {0, 1, 2, 3, 4} };
      

      Build it, then search the assembly code for the instruction PREAD.

      $ cl2000 -s -o --unified_memory file.c
      
      $ findstr PREAD file.asm
      ||     PREAD     *XAR4++,*XAR7         ; [CPU_ALU] |19|
      ||     PREAD     *XAR4++,*XAR7         ; [CPU_ALU] |19|
      

      The compiler manual states a volatile far data object like Global should not be accessed with the instructions like PREAD, even if --unified_memory is used.

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

              Created:
              Updated:
              Resolved: