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

Bluetooth: Mesh: add tf-m support for ble mesh #10

Closed
wants to merge 1 commit into from

Conversation

alxelax
Copy link
Owner

@alxelax alxelax commented Jun 6, 2023

This PR adds ability to build mesh with tf-m psa
for platforms those support tf-m.

@alxelax alxelax requested a review from PavelVPV as a code owner June 6, 2023 14:24
@alxelax alxelax changed the base branch from refactor_key_usage_2 to main June 6, 2023 14:26
@alxelax alxelax changed the base branch from main to refactor_key_usage_2 June 6, 2023 14:26
Copy link
Collaborator

@Andrewpini Andrewpini left a comment

Choose a reason for hiding this comment

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

Couple of clarifications and nitpics

samples/bluetooth/hci_rpmsg/bt_mesh_overlay.conf Outdated Show resolved Hide resolved
samples/bluetooth/mesh/nrf53_cpuapp_ns_overlay.conf Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/Kconfig Outdated Show resolved Hide resolved
@alxelax alxelax force-pushed the mesh_with_tfm_2 branch from 856e3e4 to 3b84a51 Compare June 8, 2023 10:24
@alxelax alxelax requested a review from Andrewpini June 8, 2023 10:25
subsys/bluetooth/mesh/Kconfig Show resolved Hide resolved
samples/bluetooth/mesh_demo/sample.yaml Outdated Show resolved Hide resolved
samples/bluetooth/mesh/prj.conf Show resolved Hide resolved
samples/bluetooth/hci_rpmsg/bt_mesh_overlay.conf Outdated Show resolved Hide resolved
samples/bluetooth/hci_rpmsg/bt_mesh_overlay.conf Outdated Show resolved Hide resolved
samples/bluetooth/mesh_provisioner/sample.yaml Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

Board specific files can be moved under boards folder and keep board name in the file name without _overlay suffix: nrf5340dk_nrf5340_cpuapp_ns.conf. Then the sample can be build with just specifying board name. The file will be picked up by build system and merged with prf.conf of the sample. Same works for the network core I think. This will also not require special configuration (extra_args) for twister.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I really want this option for any platform (including potential new Nordic's platforms), not only for nrf53 to avoid creation files for every new one. Probably it's worth to remove platform from file name and add tfm instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But this is what we do even between thingy53 and nrf5340dk: https://github.com/nrfconnect/sdk-nrf/tree/main/samples/bluetooth/mesh/light_ctrl/boards

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we want mesh always compile with CONFIG_BT_MESH_USES_TFM_PSA when TFM is supported, then default value for BT_MESH_CRYPTO_LIB choice should be updated, e.g.:

choice BT_MESH_CRYPTO_LIB
	prompt "Crypto library selection for mesh security"
	default BT_MESH_USES_TFM_PSA if BUILD_WITH_TFM
	default BT_MESH_USES_TINYCRYPT

Not sure though if it is correct to use BUILD_WITH_TFM but not some other option.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The overlay config will still be needed to disable settings and this should be fine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I still disagree with using any names other than the board name because this is how it is designed in Zephyr currently. You also won't need another target for twister and can just add nrf5340dk_nrf5340_cpuapp_ns to platform_allow.

@alxelax alxelax force-pushed the mesh_with_tfm_2 branch 2 times, most recently from 839e000 to e397e2d Compare June 9, 2023 12:56
@alxelax alxelax requested a review from PavelVPV June 9, 2023 13:05
Copy link
Collaborator

Choose a reason for hiding this comment

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

I still disagree with using any names other than the board name because this is how it is designed in Zephyr currently. You also won't need another target for twister and can just add nrf5340dk_nrf5340_cpuapp_ns to platform_allow.

@alxelax alxelax force-pushed the mesh_with_tfm_2 branch 2 times, most recently from af9cf8b to fab0814 Compare June 14, 2023 11:43
@alxelax alxelax requested a review from PavelVPV June 14, 2023 12:03
Comment on lines 47 to 48
To run the application on nRF5340DK, a Bluetooth controller application must
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
Copy link

Choose a reason for hiding this comment

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

Suggested change
To run the application on nRF5340DK, a Bluetooth controller application must
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
To run the application on an :ref:`nrf5340dk_nrf5340`, a Bluetooth controller application must
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample

Comment on lines 58 to 59
To run the application on nRF5340DK, a Bluetooth controller application must
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
Copy link

Choose a reason for hiding this comment

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

Suggested change
To run the application on nRF5340DK, a Bluetooth controller application must
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
To run the application on an :ref:`nrf5340dk_nrf5340`, a Bluetooth controller application must
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample

Comment on lines 56 to 57
To run the application on nRF5340DK, a Bluetooth controller application must
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
Copy link

Choose a reason for hiding this comment

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

Suggested change
To run the application on nRF5340DK, a Bluetooth controller application must
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
To run the application on an :ref:`nrf5340dk_nrf5340`, a Bluetooth controller application must
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample

This PR adds ability to build mesh with tf-m psa
for platforms those support tf-m.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
@alxelax
Copy link
Owner Author

alxelax commented Jun 19, 2023

I close this PR.
Since the parent PR has been merged and upstream is unfrozen, I created PR to upstream with all fixes from this PR. Please take a look it there: zephyrproject-rtos#59347
@mia-ko, I cannot find you in the reviewer list in upstream. Please join to PR and check my changes to your comments.

@alxelax alxelax closed this Jun 19, 2023
@alxelax alxelax deleted the mesh_with_tfm_2 branch June 22, 2023 07:12
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