aboutsummaryrefslogtreecommitdiff
path: root/applications/trustzone_inference/secure/main_secure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'applications/trustzone_inference/secure/main_secure.cpp')
-rw-r--r--applications/trustzone_inference/secure/main_secure.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/applications/trustzone_inference/secure/main_secure.cpp b/applications/trustzone_inference/secure/main_secure.cpp
index 24d7dfb..09e1638 100644
--- a/applications/trustzone_inference/secure/main_secure.cpp
+++ b/applications/trustzone_inference/secure/main_secure.cpp
@@ -24,9 +24,9 @@
#include "ethosu_driver.h"
// Trustzone defines and MPC driver
-#include "trustzone.h"
-#include "mpc_sie_drv.h"
#include "../common/secure_entries.hpp"
+#include "mpc_sie_drv.h"
+#include "trustzone.h"
#include "inference_process.hpp"
@@ -54,8 +54,8 @@ InferenceProcess::InferenceProcess inferenceProcess(TFLuTensorArena, TENSOR_AREN
namespace {
-#include "model.h"
#include "input.h"
+#include "model.h"
#include "output.h"
} // namespace
@@ -136,20 +136,16 @@ static int setup_bram_mpc(const uint32_t baseaddr_s, /* Secure base address */
const char *mem_name = "BRAM";
/* Secure range */
- const struct mpc_sie_memory_range_t mpc_range_s = {
- .base = BRAM_BASE_S,
- .limit = BRAM_BASE_S + BRAM_TOTAL_SIZE - 1,
- .range_offset = 0,
- .attr = MPC_SIE_SEC_ATTR_SECURE
- };
+ const struct mpc_sie_memory_range_t mpc_range_s = {.base = BRAM_BASE_S,
+ .limit = BRAM_BASE_S + BRAM_TOTAL_SIZE - 1,
+ .range_offset = 0,
+ .attr = MPC_SIE_SEC_ATTR_SECURE};
/* Non secure range */
- const struct mpc_sie_memory_range_t mpc_range_ns = {
- .base = BRAM_BASE_NS,
- .limit = BRAM_BASE_NS + BRAM_TOTAL_SIZE - 1,
- .range_offset = 0,
- .attr = MPC_SIE_SEC_ATTR_NONSECURE
- };
+ const struct mpc_sie_memory_range_t mpc_range_ns = {.base = BRAM_BASE_NS,
+ .limit = BRAM_BASE_NS + BRAM_TOTAL_SIZE - 1,
+ .range_offset = 0,
+ .attr = MPC_SIE_SEC_ATTR_NONSECURE};
/* Consolidated ranges */
const struct mpc_sie_memory_range_t *mpc_range_list[N_MEM_RANGES] = {&mpc_range_s, &mpc_range_ns};
@@ -215,7 +211,7 @@ void setup_xtgu_ns(uint32_t xtgu_base, uint32_t xtcm_start, uint32_t xtcm_size)
xtcm_start &= 0x00ffffff;
/* Read out xTGU configuration */
- uint32_t BLKSZ = 1 << (((xtgu->cfg) & 0xf) + 5);
+ uint32_t BLKSZ = 1 << (((xtgu->cfg) & 0xf) + 5);
if (xtcm_start % BLKSZ != 0)
printf("XTCM: start address %08x not on block size boundary\n", xtcm_start);
@@ -360,8 +356,14 @@ int run_inference(void) {
vector<InferenceProcess::DataPtr> expected;
expected.push_back(InferenceProcess::DataPtr(expectedData, sizeof(expectedData)));
- InferenceProcess::InferenceJob job(
- "secure", InferenceProcess::DataPtr(networkModelData, sizeof(networkModelData)), input, output, expected, 512, std::vector<uint8_t>(4), false);
+ InferenceProcess::InferenceJob job("secure",
+ InferenceProcess::DataPtr(networkModelData, sizeof(networkModelData)),
+ input,
+ output,
+ expected,
+ 512,
+ std::vector<uint8_t>(4),
+ false);
bool failed = inferenceProcess.runJob(job);
printf("Status of executing the job: ");