So here's the code for each (based on your post and digging into CY_SYS_PIN_READ_PIN
Alias_Read() (uint8)((Pin_1_PS & Pin_1_MASK) >> Pin_1_SHIFT)
CyPins_Read() *(reg32 *)(Pin_1_PS) |= (0x01u << (Pin_1_SHIFT))
You're right in that it looks like there is something wrong here.
Please file a case with the support team.
As a work around, you could try the following:
#define MyCyPins_ReadPin(name) (name ## _Read())
Then call MyCyPins_ReadPin(Alias) instead. When this is fixed, you simply redefine your macro to be: (Granted the return value is a little different, make sure you check against 0 for false, not 0 for true.)
#define MyCyPins_ReadPin(name) (CyPins_ReadPin(name))
As you've seen in the assembly, there's no overhead in calling the function instead.
Thanks. Where can I file a case with support? When I looked for that earlier, all I found was this community.
Thanks. I'd found that page before - but under the Technical Support section, it says: "We've evolved from one-to-one technical support to a community model. Find answers verified by Cypress experts and interact with your peers to solve problems."
There is, however, an email address for "other questions" - so I'll try that...
Sorry, I didn't realize that had changed.
I've talked with my contacts, this is a known issue. While easy to fix, and workaround, it is a lower priority at this point.
Can you please attach this header file "mcu_v897.h".I can't find this header file in the archive attached and it is giving build error in Creator4.2 because it is included in main.c.
Just comment out that #include. Any code that may have referenced that has been removed.
Weird that it compiled OK on my system, though...
Please use "dummy = CyPins_ReadPin(Pin_1_0);" instead of "dummy = CyPins_ReadPin(Pin_1);"
"Pin_1_0" is defined in Pin_1_aliases.h file.
This is not causing any exception, I checked in Creator4.2
Thanks. That's what I said in my first post.
I wasn't looking for a fix. I was just making sure people (and Cypress) were aware of this bug.
In your first post you have mentioned:
"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."
The alias that you are mentioning in CyPins_ReadPin(alias) is not same as used in alias_Read().
What I mean is CyPins_ReadPin(alias_0) and alias_Read() are equivalent.
It's a workaround only.