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

PRU compiler generates code that passes wrong value to size parameter of memcpy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-10226
    • PRU_2.3.3
    • PRU_2.3.4*
    • default
    • Hide
      Duplicate of issue EXT_EP-9623 which was already fixed in anticipation of next patch release PRU 2.3.4.LTS
      Show
      Duplicate of issue EXT_EP-9623 which was already fixed in anticipation of next patch release PRU 2.3.4.LTS

      When memcpy is called, the size parameter is passed in the register r16.  The attached code causes all 32-bits of r16 to be loaded with random value.  Then a 16-bit wide variable is passed, through multiple levels of calls, as the size parameter to memcpy.  This variable is copied into the lower 16-bits of r16, but the upper bits are never cleared.  Thus, memcpy starts with a random value in the upper 16-bits of r16, the size parameter.  This eventually causes a CPU exception to occur.

      To build the test case ...

      % clpru -@options.txt main.c
      

      main.c has several descriptive comments. Inspect the generated file main.asm.

            syncuser TI User
            syncuser TI User
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: