You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an issue with the size of the union pd_fixed_supply_pdo_sink from usbc_pd.h. The size of the union should be 4 bytes, but I'm getting a size of 8 bytes, which is causing the raw_data in the union to be corrupted when using the member of the struct to assign the values in the union.
I found that if the enum pd_frs_type is packed or its type is changed to uint32_t, the size of the union becomes 4 bytes.
I was thinking it might be an alignment issue, but after testing with added alignment to the union, it doesn't seem to be the case.
I've built the code using west on Linux, Mac, and Windows, all with the same result.
Does anyone have an idea of what the issue could be?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone,
I'm encountering an issue with the size of the union
pd_fixed_supply_pdo_sink
fromusbc_pd.h
. The size of the union should be 4 bytes, but I'm getting a size of 8 bytes, which is causing theraw_data
in the union to be corrupted when using the member of the struct to assign the values in the union.I found that if the enum
pd_frs_type
is packed or its type is changed touint32_t
, the size of the union becomes 4 bytes.I was thinking it might be an alignment issue, but after testing with added alignment to the union, it doesn't seem to be the case.
I've built the code using
west
on Linux, Mac, and Windows, all with the same result.Does anyone have an idea of what the issue could be?
I'm using an STM32 processor.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions