Revert "FreeRTOS app bug fix."

This reverts commit 43834ab8967d1e8f063533c8c8cbf84be8ccc1b0.

Reason for revert: Temporarily backing out change to fix compilation issue for Cortex-M4.

Change-Id: I98a4ba8ce44e0ca396b7eb052cec4adecb9fe0ad
diff --git a/applications/freertos/main.cpp b/applications/freertos/main.cpp
index ae4bc38..1c1821d 100644
--- a/applications/freertos/main.cpp
+++ b/applications/freertos/main.cpp
@@ -21,7 +21,6 @@
  ****************************************************************************/
 
 #include "FreeRTOS.h"
-#include "portmacro.h"
 #include "queue.h"
 #include "semphr.h"
 #include "task.h"
@@ -121,60 +120,31 @@
 extern "C" {
 
 void *ethosu_mutex_create(void) {
-    SemaphoreHandle_t sem = xSemaphoreCreateMutex();
-    if (sem == NULL) {
-        printf("Error: Failed to create mutex.\n");
-    }
-    return (void *)sem;
+    return xSemaphoreCreateMutex();
 }
 
 void ethosu_mutex_lock(void *mutex) {
     SemaphoreHandle_t handle = reinterpret_cast<SemaphoreHandle_t>(mutex);
-    if (xSemaphoreTake(handle, portMAX_DELAY) != pdTRUE) {
-        printf("Error: Failed to lock mutex.\n");
-    }
+    xSemaphoreTake(handle, portMAX_DELAY);
 }
 
 void ethosu_mutex_unlock(void *mutex) {
     SemaphoreHandle_t handle = reinterpret_cast<SemaphoreHandle_t>(mutex);
-    if (xSemaphoreGive(handle) != pdTRUE) {
-        printf("Error: Failed to unlock mutex.\n");
-    }
+    xSemaphoreGive(handle);
 }
 
 void *ethosu_semaphore_create(void) {
-    SemaphoreHandle_t sem = xSemaphoreCreateBinary();
-    if (sem == NULL) {
-        printf("Error: Failed to create semaphore.\n");
-    }
-    return (void *)sem;
+    return xSemaphoreCreateBinary();
 }
 
 void ethosu_semaphore_take(void *sem) {
     SemaphoreHandle_t handle = reinterpret_cast<SemaphoreHandle_t>(sem);
-    if (xSemaphoreTake(handle, portMAX_DELAY) != pdTRUE) {
-        printf("Error: Failed to take semaphore.\n");
-    }
+    xSemaphoreTake(handle, portMAX_DELAY);
 }
 
 void ethosu_semaphore_give(void *sem) {
     SemaphoreHandle_t handle = reinterpret_cast<SemaphoreHandle_t>(sem);
-    BaseType_t ret;
-
-    if (xPortIsInsideInterrupt()) {
-        ret = xSemaphoreGiveFromISR(handle, NULL);
-        if (ret != pdTRUE) {
-            printf("Error: Failed to give semaphore from ISR. ret - 0x%08x\n", ret);
-        }
-    } else {
-        ret = xSemaphoreGive(handle);
-        if (ret != pdTRUE) {
-            /* The next line is in comment because xSemaphoreGive returns pdFAIL when
-               calling it twice in a row during this application run.
-               This failure doesn't affect the final result of the FreeRTOS application. */
-            /* printf("Error: Failed to give semaphore. ret - 0x%08x\n", ret); */
-        }
-    }
+    xSemaphoreGive(handle);
 }
 }
 
@@ -191,17 +161,10 @@
     for (;;) {
         xInferenceJob *xJob;
 
-        if (xQueueReceive(params.queueHandle, &xJob, portMAX_DELAY) != pdPASS) {
-            printf("Error: inferenceProcessTask failed in receive from Q.\n");
-            exit(1);
-        }
-
+        xQueueReceive(params.queueHandle, &xJob, portMAX_DELAY);
         bool status  = inferenceProcess.runJob(*xJob);
         xJob->status = status;
-        if (xQueueSend(xJob->responseQueue, &xJob, portMAX_DELAY) != pdPASS) {
-            printf("Error: inferenceProcessTask failed in send to Q.\n");
-            exit(1);
-        }
+        xQueueSend(xJob->responseQueue, &xJob, portMAX_DELAY);
     }
     vTaskDelete(nullptr);
 }
@@ -226,20 +189,14 @@
         job->expectedOutput.push_back(DataPtr(expectedOutputData, sizeof(expectedOutputData)));
         job->responseQueue = senderQueue;
         // Send job
-        printf("inferenceSenderTask: Sending inference job: job=%p, name=%s\n", job, job->name.c_str());
-        if (xQueueSend(inferenceProcessQueue, &job, portMAX_DELAY) != pdPASS) {
-            printf("Error: inferenceSenderTask failed in send to Q.\n");
-            exit(1);
-        }
+        printf("Sending inference job: job=%p, name=%s\n", job, job->name.c_str());
+        xQueueSend(inferenceProcessQueue, &job, portMAX_DELAY);
     }
 
     // Listen for completion status
     do {
         xInferenceJob *pSendJob;
-        if (xQueueReceive(senderQueue, &pSendJob, portMAX_DELAY) != pdPASS) {
-            printf("Error: inferenceSenderTask failed in receive from Q.\n");
-            exit(1);
-        }
+        xQueueReceive(senderQueue, &pSendJob, portMAX_DELAY);
         printf("inferenceSenderTask: received response for job: %s, status = %u\n",
                pSendJob->name.c_str(),
                pSendJob->status);
@@ -269,7 +226,7 @@
     for (int n = 0; n < NUM_JOB_TASKS; n++) {
         ret = xTaskCreate(inferenceSenderTask, "inferenceSenderTask", 2 * 1024, inferenceProcessQueue, 2, nullptr);
         if (ret != pdPASS) {
-            printf("Error: Failed to create 'inferenceSenderTask%i'\n", n);
+            printf("FreeRTOS: Failed to create 'inferenceSenderTask%i'\n", n);
             exit(1);
         }
     }
@@ -279,7 +236,7 @@
         taskParams[n] = ProcessTaskParams(inferenceProcessQueue, inferenceProcessTensorArena[n], arenaSize);
         ret           = xTaskCreate(inferenceProcessTask, "inferenceProcessTask", 8 * 1024, &taskParams[n], 3, nullptr);
         if (ret != pdPASS) {
-            printf("Error: Failed to create 'inferenceProcessTask%i'\n", n);
+            printf("FreeRTOS: Failed to create 'inferenceProcessTask%i'\n", n);
             exit(1);
         }
     }
@@ -287,7 +244,7 @@
     // Start Scheduler
     vTaskStartScheduler();
 
-    printf("Error: FreeRTOS application failed to initialise.\n");
+    printf("FreeRTOS application failed to initialise \n");
     exit(1);
 
     return 0;