Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise I2C HAL gating logic in tpm_to_infineon #347

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

gojimmypi
Copy link
Contributor

This PR updates the gating logic in the hal/tpm_io_infineon.c to be more consistent with other target platforms.

For example, note how the tpm_io_microchip.c is wrapped with WOLFTPM_MICROCHIP_HARMONY, disabling the entire file otherwise:

image

Without this modification, enabling WOLFTPM_INCLUDE_IO_FILE and WOLFTPM_I2C causes a compile-time error as the only gate is WOLFTPM_I2C. In my case, I'm using the Espressf I2C library, not the cyhal here:

image

Here's the content of my wolfTPM options.h:

#define WOLFTPM_ADV_IO
#define WOLFTPM_I2C
#define WOLFTPM_EXAMPLE_HAL
#define WOLFSSL_ESPIDF
#define WOLFTPM_INCLUDE_IO_FILE

Testing

I have not tested this, as I don't have the target library that is being changed.

@@ -43,6 +43,7 @@
defined(WOLFTPM_SWTPM) || \
defined(WOLFTPM_WINAPI) )

#if defined(CY_USING_HAL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be #if defined(WOLFTPM_INFINEON_TRICORE) || defined(CY_USING_HAL)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. updated.

@dgarske dgarske removed their assignment Apr 30, 2024
@gojimmypi gojimmypi changed the title Revise I2C CY_USING_HAL gating logic in tpm_to_infineon Revise I2C HAL gating logic in tpm_to_infineon Apr 30, 2024
@gojimmypi gojimmypi requested a review from dgarske April 30, 2024 21:31
@@ -51,7 +52,6 @@
#define TPM2_I2C_ADDR 0x2e
#endif

#if defined(CY_USING_HAL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't remove this code or the code below at 149-152. Thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to read that a few times to understand what's going on.

Does that mean no I2C available / implemented on Infineon Tricore?

@@ -211,6 +207,8 @@
#error Infineon I2C support on this platform not supported yet
#endif /* CY_USING_HAL or WOLFTPM_INFINEON_TRICORE */
#endif /* SPI or I2C */
#endif /* CY_USING_HAL */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update comment | WOLFTPM_INFINEON_TRICORE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch. Updated.

gojimmypi added a commit to gojimmypi/wolfTPM that referenced this pull request Apr 30, 2024
@dgarske dgarske merged commit 58d1561 into wolfSSL:master Apr 30, 2024
3 checks passed
@gojimmypi gojimmypi deleted the PR-infineon-CY_USING_HAL branch April 30, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants