aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLior Dekel <lior.dekel@arm.com>2021-08-10 17:06:16 +0300
committerLior Dekel <Lior.dekel@arm.com>2021-08-12 10:44:52 +0000
commitedaf2f8cb3ed557c655ef414f135f4a4a9f50526 (patch)
tree8eb873fe2949d171b3eb0333ff2293d1e4603726
parent489e40be5d744966d5e5b704ed7c164d1aa234ae (diff)
downloadethos-u-core-platform-edaf2f8cb3ed557c655ef414f135f4a4a9f50526.tar.gz
small fixes to FreeRTOS app.
Change-Id: Ib1e59fda457edc90ceb324f35252c3def451c751
-rw-r--r--applications/freertos/main.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/applications/freertos/main.cpp b/applications/freertos/main.cpp
index 5abcca2..1c1821d 100644
--- a/applications/freertos/main.cpp
+++ b/applications/freertos/main.cpp
@@ -46,7 +46,7 @@ using namespace InferenceProcess;
// Nr. of tasks to process inferences with. Task reserves driver & runs inference (Normally 1 per NPU, but not a must)
#define NUM_INFERENCE_TASKS 1
// Nr. of tasks to create jobs and recieve responses
-#define NUM_JOB_TASKS 1
+#define NUM_JOB_TASKS 2
// Nr. of jobs to create per job task
#define NUM_JOBS_PER_TASK 1
@@ -62,7 +62,7 @@ using namespace InferenceProcess;
****************************************************************************/
struct ProcessTaskParams {
- ProcessTaskParams() {}
+ ProcessTaskParams() : queueHandle(nullptr), tensorArena(nullptr), arenaSize(0) {}
ProcessTaskParams(QueueHandle_t _queue, uint8_t *_tensorArena, size_t _arenaSize) :
queueHandle(_queue), tensorArena(_tensorArena), arenaSize(_arenaSize) {}
@@ -71,11 +71,18 @@ struct ProcessTaskParams {
size_t arenaSize;
};
+namespace {
// Number of total completed jobs, needed to exit application correctly if NUM_JOB_TASKS > 1
-static int totalCompletedJobs = 0;
+int totalCompletedJobs = 0;
// TensorArena static initialisation
-static const size_t arenaSize = TENSOR_ARENA_SIZE_PER_INFERENCE;
+const size_t arenaSize = TENSOR_ARENA_SIZE_PER_INFERENCE;
+
+// Declare below variables in global scope to avoid stack since FreeRTOS resets stack when the scheduler is started
+QueueHandle_t inferenceProcessQueue;
+ProcessTaskParams taskParams[NUM_INFERENCE_TASKS];
+} // namespace
+
__attribute__((section(".bss.tensor_arena"), aligned(16)))
uint8_t inferenceProcessTensorArena[NUM_INFERENCE_TASKS][arenaSize];
@@ -210,11 +217,6 @@ void inferenceSenderTask(void *pvParameters) {
/****************************************************************************
* Application
****************************************************************************/
-
-// Declare variables in global scope to avoid stack since FreeRTOS resets stack when the scheduler is started
-static QueueHandle_t inferenceProcessQueue;
-static ProcessTaskParams taskParams[NUM_INFERENCE_TASKS];
-
// FreeRTOS application. NOTE: Additional tasks may require increased heap size.
int main() {
BaseType_t ret;
@@ -246,4 +248,4 @@ int main() {
exit(1);
return 0;
-} \ No newline at end of file
+}