Skip to content

Conversation

tpambor
Copy link

@tpambor tpambor commented Oct 8, 2025

Cherry-pick the following commits from upstream to fix a linker error and address several warnings when compiling for STM32H5:

For more details, refer to the commit messages of the individual commits.

/cc @stgloorious

@stgloorious
Copy link
Contributor

Thanks @tpambor for pulling it into Zephyr. That was still on my to-do list :)

@stgloorious
Copy link
Contributor

Would you mind cherry-picking https://review.trustedfirmware.org/c/TF-M/trusted-firmware-m/+/42128 as well? That is relevant if you use STM32H5 without hardware crypto acceleration.

Add #ifdef to make sure crypto_hw_accelerator* functions
are not called if CRYPTO_HW_ACCELERATOR is disabled.

Change-Id: I76ee3ca377caea1d3ad663c86bd3d5d187c2995d
Signed-off-by: Stefan Gloor <[email protected]>
(cherry picked from commit cc180f1d00a3ec755c922d6addd338dfd46aa7ca)
Signed-off-by: Tim Pambor <[email protected]>
Add parantheses to get rid of the -Wparentheses warning:
platform/ext/target/stm/common/stm32h5xx/secure/target_cfg.c:490:21:
warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
  490 |     if(SCB->AIRCR & SCB_AIRCR_PRIS_Msk == 0)
      |                   ^

Change-Id: Icbbe6b0393f9ac0be3600fed60e3508dfe9a40eb
Signed-off-by: Stefan Gloor <[email protected]>
(cherry picked from commit 43474c807dc5ef9aa32ce8092770428ff66bd23c)
Signed-off-by: Tim Pambor <[email protected]>
Fix the -Wunused-variable warning:
platform/ext/target/stm/common/stm32h5xx/secure/tfm_hal_isolation.c:424:29:
warning: unused variable 'plat_data_ptr' [-Wunused-variable]
  424 |     struct platform_data_t *plat_data_ptr;
      |                             ^~~~~~~~~~~~~

Change-Id: I8a48cf15302d64ba78d0aec891ec36b42a952cbd
Signed-off-by: Stefan Gloor <[email protected]>
(cherry picked from commit 50da8e161cc1d2171565e94ae5846eea95a5d6bd)
Signed-off-by: Tim Pambor <[email protected]>
Combine the #ifdef clauses of the gtzc_periph_att usages
to only instantiate the variable when it is actually used.

This fixes the -Wunused-variable warning:

/platform/ext/target/stm/common/stm32h5xx/secure/target_cfg.c:480:12:
warning: unused variable 'gtzc_periph_att' [-Wunused-variable]
  480 |   uint32_t gtzc_periph_att;
      |            ^~~~~~~~~~~~~~~

Change-Id: I04e4eebedf791e76f943557633338c115164e410
Signed-off-by: Stefan Gloor <[email protected]>
(cherry picked from commit c91f4e60f112e3f63aa35f197f00112e0d43cd7f)
Signed-off-by: Tim Pambor <[email protected]>
psa_crypto_ecp.c and psa_crypto_rsa.c reference functions from
psa_util.c, e.g., mbedtls_psa_get_random, so it should be
included in the library build to get rid of linker errors such
as

arm-zephyr-eabi/bin/ld: bl2/libbl2_crypto.a(psa_crypto_ecp.o):
in function `mbedtls_psa_ecp_load_public_part':
/modules/crypto/mbedtls/library/psa_crypto_ecp.c:447:
undefined reference to `mbedtls_psa_get_random'

Change-Id: Iacf3fb97dd87d3dcb20b9302c383f4061e1371a6
Signed-off-by: Stefan Gloor <[email protected]>
(cherry picked from commit 019755de4c86aebdae557ea59577eafd292338fb)
Signed-off-by: Tim Pambor <[email protected]>
@tpambor
Copy link
Author

tpambor commented Oct 8, 2025

Would you mind cherry-picking https://review.trustedfirmware.org/c/TF-M/trusted-firmware-m/+/42128 as well? That is relevant if you use STM32H5 without hardware crypto acceleration.

Thanks, I missed that one. I have update the PR to include it as well.

@etienne-lms
Copy link
Contributor

@tomi-font, could you have a look at this change?

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.

4 participants