Skip to content

Commit

Permalink
modules: trusted-firmware-m: initialize the TF-M NS interface
Browse files Browse the repository at this point in the history
The TF-M NS interface needs to be initialized before
it is used. We add an initialization function that
calls tfm_ns_interface_init(), at boot time, so then
we can use TF-M interface calls (veneers).

Signed-off-by: Ioannis Glaropoulos <[email protected]>
  • Loading branch information
ioannisg committed Mar 26, 2021
1 parent 261a659 commit e6965b3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/trusted-firmware-m/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ function(trusted_firmware_build)
add_dependencies(tfm_api tfm)
endfunction()

zephyr_library_sources_ifdef(CONFIG_BUILD_WITH_TFM interface/interface.c)
# Non-Secure interface to request system reboot
zephyr_library_sources_ifdef(CONFIG_TFM_PARTITION_PLATFORM src/reboot.c)

Expand Down
28 changes: 28 additions & 0 deletions modules/trusted-firmware-m/interface/interface.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <device.h>
#include <init.h>
#include <kernel.h>

#include <tfm_ns_interface.h>

#if defined(TFM_PSA_API)
#include "psa_manifest/sid.h"
#endif /* TFM_PSA_API */

static int ns_interface_init(const struct device *arg)
{
ARG_UNUSED(arg);

(void)tfm_ns_interface_init();

return 0;
}

/* Initialize the TFM NS interface */
SYS_INIT(ns_interface_init, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

0 comments on commit e6965b3

Please sign in to comment.