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

mcu/nrf5340: Add secure functions package #2899

Merged
merged 2 commits into from Oct 13, 2022

Conversation

kasjer
Copy link
Contributor

@kasjer kasjer commented Oct 11, 2022

New package will contain secure functions.
Those functions will allow access to secure only peripherals.

To start MCU assignment to GPIO function tfm_gpio_pin_mcu_select
allows to redirect PIN to net core.

tfm_uicr_otp_read() allows to read UICR->OTP from non-secure code.

When tfm package build with bootloader or secure application
functions are treated as every other function.

When tfm is build with non-secure application function bodies
are not present in the build and are expected to be linked with
library that provides secure gateways.

tfm can be also build into bootloader in this case it's the
bootloader that provides secure functions.

ELF that provides implementation of secure functions must be
build with TFM_EXPORT_NSC: 1 syscfg value.

Signed-off-by: Jerzy Kasenberg jerzy.kasenberg@codecoup.pl

@kasjer kasjer requested a review from sjanc October 11, 2022 07:38
@@ -126,6 +126,13 @@ syscfg.defs:
Application code to runs in secure mode.
This settings must have same value for bootloader and application build.
value: 1
MCU_NET_GPIO:
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm there is already MCU_GPIO_NET

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, old MCU_GPIO_NET reused. Old code from startup that used it is now removed.

New package will contain secure functions.
Those functions will allow access to secure only peripherals.

To start MCU assignment to GPIO function tfm_gpio_pin_mcu_select
allows to redirect PIN to net core.

tfm_uicr_otp_read() allows to read UICR->OTP from non-secure code.

When tfm package build with bootloader or secure application
functions are treated as every other function.

When tfm is build with non-secure application function bodies
are not present in the build and are expected to be linked with
library that provides secure gateways.

tfm can be also build into bootloader in this case it's the
bootloader that provides secure functions.

ELF that provides implementation of secure functions must be
build with TFM_EXPORT_NSC: 1 syscfg value.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
It was possible to assign GPIO pins to network core.
It was done in ipc driver or for unsecure code it in bootloader
code from hal_system_start.c.

Now pin assignment to net core is done in nrf5340_periph_create()
which is called in hal_bsp_init().
With this change pin assigment can be done:
- in bootloader (regardless if it is secure or not)
- in application build with MCU_APP_SECURE
- in non-secure application when tfm functionality is provided by
  bootloader or other secure code. In this case bootloader does
  not redirect pins during startup but allows change from
  non-secure application at runtime.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
@apache-mynewt-bot
Copy link

Style check summary

No suggestions at this time!

@kasjer kasjer merged commit 1ccc0a2 into apache:master Oct 13, 2022
@kasjer kasjer deleted the kasjer/nrf5340-tfm branch October 13, 2022 08:56
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.

None yet

3 participants