Skip to content

tf-m: build: Treat warnings as errors #91157

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ceolin
Copy link
Member

@ceolin ceolin commented Jun 6, 2025

Starting in TF-M 2.2.0 there is a build option to treat warnings as errors. Lets use it.

Fixes #90864

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables the build option to treat warnings as errors in the Trusted Firmware-M module starting with TF-M 2.2.0.

  • Enable the CONFIG_TFM_WARNINGS_ARE_ERRORS flag.
  • Adjust CMake build settings for the trusted-firmware-m module.

@ceolin ceolin marked this pull request as ready for review June 9, 2025 16:39
@github-actions github-actions bot added the area: TF-M ARM Trusted Firmware-M (TF-M) label Jun 9, 2025
Copy link
Collaborator

@tomi-font tomi-font left a comment

Choose a reason for hiding this comment

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

This needs TF-M to be updated to 2.2 first?

valeriosetti
valeriosetti previously approved these changes Jun 12, 2025
d3zd3z
d3zd3z previously approved these changes Jul 11, 2025
@dkalowsk
Copy link
Collaborator

@ceolin is this a 4.2 change you want to see merged? Or a 4.3 merge?

@nashif
Copy link
Member

nashif commented Jul 11, 2025

afaik it should be, we already have 2.2 which this one targets

@nashif nashif added this to the v4.2.0 milestone Jul 11, 2025
@dkalowsk
Copy link
Collaborator

@nashif it should be but we have seen in the upgrade is that CI does not test all the TF-M and I have concerns that enabling this will slow down the release.

@ceolin
Copy link
Member Author

ceolin commented Jul 11, 2025

The feature itself is not a problem. But I have some concerns about CI, if we use CONFIG_COMPILER_WARNINGS_AS_ERRORS there we may have tests failing. As far as I can tell you there are warnings in certain tf-m builds.

@nashif
Copy link
Member

nashif commented Jul 11, 2025

interesting, this whole tf-m update thing started becuase of those issues, and they are still there :(

 The following issues were found (showing the top 10 items):
INFO    - 1) sample.kernel.synchronization on actinius_icarus@1.4.0/nrf9160/ns error (Build failure - error: implicit declaration of function 'flash_area_get_sector'; did you mean 'flash_area_get_sectors'? [-Werror=implicit-function-declaration])
INFO    - 2) sample.kernel.synchronization on actinius_icarus@2.0.0/nrf9160/ns error (Build failure - error: implicit declaration of function 'flash_area_get_sector'; did you mean 'flash_area_get_sectors'? [-Werror=implicit-function-declaration])
INFO    - 3) sample.kernel.synchronization on actinius_icarus_bee/nrf9160/ns error (Build failure - error: implicit declaration of function 'flash_area_get_sector'; did you mean 'flash_area_get_sectors'? [-Werror=implicit-function-declaration])
INFO    - 4) sample.kernel.synchronization on actinius_icarus_som/nrf9160/ns error (Build failure - error: implicit declaration of function 'flash_area_get_sector'; did you mean 'flash_area_get_sectors'? [-Werror=implicit-function-declaration])
INFO    - 5) sample.kernel.synchronization on actinius_icarus_som_dk/nrf9160/ns error (Build failure - error: implicit declaration of function 'flash_area_get_sector'; did you mean 'flash_area_get_sectors'? [-Werror=implicit-function-declaration])
INFO    - 6) sample.kernel.synchronization on b_u585i_iot02a/stm32u585xx/ns error (Build failure - error: unused variable 'plat_data_ptr' [-Werror=unused-variable])

@nashif
Copy link
Member

nashif commented Jul 11, 2025


53 | Build failure
-- | --
51 | error: implicit declaration of function 'flash_area_get_sector'; did you mean 'flash_area_get_sectors'? [-Werror=implicit-function-declaration]
1 | error: unused variable 'plat_data_ptr' [-Werror=unused-variable]
1 | error: "MBEDTLS_ECP_MAX_BYTES" redefined [-Werror]

@nashif
Copy link
Member

nashif commented Jul 11, 2025

ok, now this is associated with a blocker bug

@nashif nashif dismissed stale reviews from valeriosetti and d3zd3z via 58f1568 July 11, 2025 23:44
Copy link

github-actions bot commented Jul 11, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
trusted-firmware-m zephyrproject-rtos/trusted-firmware-m@d38260c (main) zephyrproject-rtos/trusted-firmware-m#144 zephyrproject-rtos/trusted-firmware-m#144/files

DNM label due to: 1 project with PR revision

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-trusted-firmware-m DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Jul 11, 2025
ceolin and others added 2 commits July 15, 2025 12:14
Starting in TF-M 2.2.0 there is a build option to treat warnings as
errors. Lets use it.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
Pull fix for undeclared functions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: TF-M ARM Trusted Firmware-M (TF-M) DNM (manifest) This PR should not be merged (controlled by action-manifest) manifest manifest-trusted-firmware-m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build warnings with TF-M that are not treated as errors
6 participants