Skip to content

Conversation

JordanYates
Copy link
Contributor

@JordanYates JordanYates commented Sep 6, 2025

Explicitly disable the SECURE_UART TFM define when CONFIG_TFM_LOG_LEVEL_SILENCE=y. The secure UART is only enabled by default on nRF platforms to match the current TF-M defaults.

This results in the default values from the TF-M repo being overridden, e.g:

set(SECURE_UART1                        ON         CACHE BOOL      "Enable secure UART1")

@zephyrbot zephyrbot added the area: TF-M ARM Trusted Firmware-M (TF-M) label Sep 6, 2025
@JordanYates JordanYates force-pushed the 250906_tfm_secure_uart_disable branch from 176e29d to 158d1e7 Compare September 6, 2025 06:14
Comment on lines +512 to +513
bool "TF-M configure UART instance as secure peripheral"
default y if SOC_FAMILY_NORDIC_NRF && !TFM_LOG_LEVEL_SILENCE
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to make this user selectable? What about making it an internal helper like:

Suggested change
bool "TF-M configure UART instance as secure peripheral"
default y if SOC_FAMILY_NORDIC_NRF && !TFM_LOG_LEVEL_SILENCE
default y if SOC_FAMILY_NORDIC_NRF || !TFM_LOG_LEVEL_SILENCE

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 don't see why it shouldn't be user selectable. Maybe the user still wants the secure UART (for FW updates? not sure if possible) but still doesn't want any log output. Or maybe there is some custom log output backend (RTT).

Not sure if it was a typo or not, but changing the default to || is wrong, especially in the context of the other suggestion, since it forces all nRF parts to enable secure UART, even if there is no physical connection on the board.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see why it shouldn't be user selectable. Maybe the user still wants the secure UART (for FW updates? not sure if possible) but still doesn't want any log output. Or maybe there is some custom log output backend (RTT).

Good point.

Not sure if it was a typo or not, but changing the default to || is wrong, especially in the context of the other suggestion, since it forces all nRF parts to enable secure UART, even if there is no physical connection on the board.

It seems to me that all Nordic boards set SECURE_UART1=ON in TF-M. This happens in a file which has a parent directory named common so I assume it's done for all Nordic boards.
I think that the wrong part of my proposal was that for a Nordic board it was basically ignoring !TFM_LOG_LEVEL_SILENCE which is the most relevant condition here, so I agree it was not correct. Sorry for that.

I did a quick check in TF-M on which platform enable SECURE_UART1 and it seems that Nordic are the only ones, so in conclusion the condition you wrote here mimic that part so I'm fine with that.
IMO a nice follow-up would be to remove the logic from TF-M and just reduce the condition above to simply default y if !TFM_LOG_LEVEL_SILENCE, but I guess that this would impact more platforms, so totally out of scope here.

Copy link
Member

Choose a reason for hiding this comment

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

This option should be default=y.
The user should set OFF in their own application.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, that breaks platforms by enabling the define for platforms that don't support it. If the builds are still available you can see this in the CI history.

Copy link
Member

Choose a reason for hiding this comment

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

Nak on this PR.
This should be clarify before disable the serial port for all platform except Nordic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to be clear, your NAK is because of a TF-M default that has been in place for at least 5 years?
zephyrproject-rtos/trusted-firmware-m@9ec67e6
Possibly longer, I don't care enough to search down where the option originally came from.

Copy link
Member

Choose a reason for hiding this comment

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

if I understood correctly, this change will replace the default in the TF-M boards (including all Out-Of-Tree boards).
If someone is developing a product with a board defined by a vendor inside TF-M mainline IMHO it is a big mistake! That is only a reference to make a development board run and make tests. A real TF-M application will have an OOT board with their own configuration and flash layout and this is changing the default on that boards without notice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough, added to the migration guide

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a config choice could help, to either enforce the secure UART on or off or leave it to TF-M native default config.

@valeriosetti valeriosetti self-requested a review September 11, 2025 09:31
valeriosetti
valeriosetti previously approved these changes Sep 11, 2025
Comment on lines +512 to +513
bool "TF-M configure UART instance as secure peripheral"
default y if SOC_FAMILY_NORDIC_NRF && !TFM_LOG_LEVEL_SILENCE
Copy link
Member

Choose a reason for hiding this comment

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

This option should be default=y.
The user should set OFF in their own application.

Explicitly disable the SECURE_UART TFM define when
`CONFIG_TFM_LOG_LEVEL_SILENCE=y`. The secure UART is only enabled by
default on nRF platforms to match the current TF-M defaults.

Signed-off-by: Jordan Yates <[email protected]>
@JordanYates JordanYates force-pushed the 250906_tfm_secure_uart_disable branch from 158d1e7 to c2c382a Compare September 11, 2025 11:21
@zephyrbot zephyrbot added the Release Notes To be mentioned in the release notes label Sep 11, 2025
Copy link

@nandojve
Copy link
Member

CC: @erwango , @etienne-lms

Comment on lines +235 to +236
* The ``SECURE_UART1`` TF-M define is now controlled by the Zephyr buildsystem
:kconfig:option:`CONFIG_TFM_SECURE_UART`. This option will override any platform values previously
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* The ``SECURE_UART1`` TF-M define is now controlled by the Zephyr buildsystem
:kconfig:option:`CONFIG_TFM_SECURE_UART`. This option will override any platform values previously
* The ``SECURE_UART1`` TF-M define is now controlled by the
:kconfig:option:`CONFIG_TFM_SECURE_UART` Kconfig option. This option will override any platform values previously

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 was explicit about the "Zephyr build system" comment because TF-M also uses Kconfig internally (even though Zephyr doesn't use it) and I wanted to be clear about where the option sits.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then maybe rather the following?

Suggested change
* The ``SECURE_UART1`` TF-M define is now controlled by the Zephyr buildsystem
:kconfig:option:`CONFIG_TFM_SECURE_UART`. This option will override any platform values previously
* The ``SECURE_UART1`` TF-M define is now controlled by Zephyr's
:kconfig:option:`CONFIG_TFM_SECURE_UART`. This option will override any platform values previously

@nandojve
Copy link
Member

I'll add DNM to ST have time to look on this.

@nandojve nandojve added the DNM This PR should not be merged (Do Not Merge) label Sep 18, 2025
@JordanYates
Copy link
Contributor Author

I'll add DNM to ST have time to look on this.

Why ST specifically? It doesn't look like they use the define in any of their upstream boards?

@JordanYates
Copy link
Contributor Author

Also, adding the DNM label makes the PR show up as failing CI, which is generally a pretty good way to make people not review it. If you want someone specifically to review it, please tag them, since I don't see anyone that I know is from ST on the review list anyway.

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Sorry for this late reply.
I'm fine with the idea of the change. Having more control on TF-M configuration from Zephyr configs is better IMHO.
@nandojve, you can remove the DNM label, at least from my perspective.

Comment on lines +512 to +513
bool "TF-M configure UART instance as secure peripheral"
default y if SOC_FAMILY_NORDIC_NRF && !TFM_LOG_LEVEL_SILENCE
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a config choice could help, to either enforce the secure UART on or off or leave it to TF-M native default config.

@JordanYates JordanYates removed the DNM This PR should not be merged (Do Not Merge) label Sep 18, 2025
Copy link
Contributor

@Vge0rge Vge0rge left a comment

Choose a reason for hiding this comment

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

It looks OK to me from Nordic's perspective as it does not change the default at the moment.

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) Release Notes To be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants