aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Åstrand <per.astrand@arm.com>2022-05-18 13:56:26 +0200
committerKristofer Jonsson <kristofer.jonsson@arm.com>2022-05-19 06:07:41 +0000
commitb05507295d2c13713c03bff54b9a5effe413b7de (patch)
tree74e3765aac3a158e12a1c8c164319478dbe889e5
parentacd02323eb51f141e63681801b7aaf93ca98d72a (diff)
downloadethos-u-core-platform-b05507295d2c13713c03bff54b9a5effe413b7de.tar.gz
Move taskparams out of main stack
FreeRTOS resets the stack to the running tasks. Move the task parameters to avoid the parameters to be overwritten. Change-Id: Ib22b3d49451ea8c97c6faf24bafc8bf0952b38a9
-rw-r--r--applications/message_handler/main.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/applications/message_handler/main.cpp b/applications/message_handler/main.cpp
index 73eb398..0b4860a 100644
--- a/applications/message_handler/main.cpp
+++ b/applications/message_handler/main.cpp
@@ -173,6 +173,7 @@ int ethosu_semaphore_give(void *sem) {
/****************************************************************************
* Application
****************************************************************************/
+namespace {
struct TaskParams {
TaskParams() :
@@ -192,8 +193,6 @@ struct InferenceTaskParams {
uint8_t *arena;
};
-namespace {
-
#ifdef MHU_IRQ
void mailboxIrqHandler() {
mailbox.handleMessage();
@@ -233,6 +232,13 @@ void messageTask(void *pvParameters) {
process.run();
}
+/*
+ * Keep task parameters as global data as FreeRTOS resets the stack when the
+ * scheduler is started.
+ */
+TaskParams taskParams;
+InferenceTaskParams infParams[NUM_PARALLEL_TASKS];
+
} // namespace
// FreeRTOS application. NOTE: Additional tasks may require increased heap size.
@@ -244,8 +250,6 @@ int main() {
return 1;
}
- TaskParams taskParams;
-
// Task for handling incoming /outgoing messages from the remote host
ret = xTaskCreate(messageTask, "messageTask", 1024, &taskParams, 2, nullptr);
if (ret != pdPASS) {
@@ -253,8 +257,6 @@ int main() {
return ret;
}
- InferenceTaskParams infParams[NUM_PARALLEL_TASKS];
-
// One inference task for each NPU
for (size_t n = 0; n < NUM_PARALLEL_TASKS; n++) {
infParams[n].taskParams = &taskParams;