10 Replies Latest reply on Jan 30, 2019 7:45 PM by AnkitaS_51

    CyPins_ReadPin Bug Report (?)


      I recently encountered what looks like either a bug in the compiler or the generated code from PSoC Creator 4.0 (on a CY8C4124PVI-432).

      As far as I know, I'm using the latest version of all the tools.


      The bug is this:

      I've defined a pin as a GPIO Input.

      If I call CyPins_ReadPin(alias) then the generated code executes an extra "ldr r3,[r3]" - which usually causes an exception.

      If I call alias_Read(), it works as expected.


      I've attached an Archive of a sample project that demonstrates the problem.


      If you look at the main.lst file, you'll see the following generated code:

        29:main.c        ****     dummy = CyPins_ReadPin(Pin_1);

        61              .loc 1 29 0

        62 0024 0B4B      ldr r3, .L3+4

        63 0026 1B68      ldr r3, [r3]

        64 0028 1B68      ldr r3, [r3]     <--- extra instruction!

      Meanwhile, the good code looks like this:

      138:Generated_Source\PSoC4/Pin_1.c ****     return (uint8)((Pin_1_PS & Pin_1_MASK) >> Pin_1_SHIFT);

      142              .loc 1 138 0

      143 0004 044B      ldr r3, .L9

      144 0006 1B68      ldr r3, [r3]     <--- only one "ldr" here

      Is this a known problem?