Преглед изворни кода

esp_system: Place ipc_task semaphores on DRAM
- For CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL < 92, the ipc_task semaphores
were allocated on SPIRAM rather than internal RAM
- SemaphoreHandle_t has a size of 92, thus the failure

Laukik Hase пре 4 година
родитељ
комит
6f9fc0ba8e
1 измењених фајлова са 7 додато и 3 уклоњено
  1. 7 3
      components/esp_system/esp_ipc.c

+ 7 - 3
components/esp_system/esp_ipc.c

@@ -19,6 +19,10 @@
 
 #if !defined(CONFIG_FREERTOS_UNICORE) || defined(CONFIG_APPTRACE_GCOV_ENABLE)
 
+static DRAM_ATTR StaticSemaphore_t s_ipc_mutex_buffer[portNUM_PROCESSORS];
+static DRAM_ATTR StaticSemaphore_t s_ipc_sem_buffer[portNUM_PROCESSORS];
+static DRAM_ATTR StaticSemaphore_t s_ipc_ack_buffer[portNUM_PROCESSORS];
+
 static TaskHandle_t s_ipc_task_handle[portNUM_PROCESSORS];
 static SemaphoreHandle_t s_ipc_mutex[portNUM_PROCESSORS];    // This mutex is used as a global lock for esp_ipc_* APIs
 static SemaphoreHandle_t s_ipc_sem[portNUM_PROCESSORS];      // Two semaphores used to wake each of ipc tasks
@@ -104,9 +108,9 @@ static void esp_ipc_init(void)
 
     for (int i = 0; i < portNUM_PROCESSORS; ++i) {
         snprintf(task_name, sizeof(task_name), "ipc%d", i);
-        s_ipc_mutex[i] = xSemaphoreCreateMutex();
-        s_ipc_ack[i] = xSemaphoreCreateBinary();
-        s_ipc_sem[i] = xSemaphoreCreateBinary();
+        s_ipc_mutex[i] = xSemaphoreCreateMutexStatic(&s_ipc_mutex_buffer[i]);
+        s_ipc_ack[i] = xSemaphoreCreateBinaryStatic(&s_ipc_ack_buffer[i]);
+        s_ipc_sem[i] = xSemaphoreCreateBinaryStatic(&s_ipc_sem_buffer[i]);
         portBASE_TYPE res = xTaskCreatePinnedToCore(ipc_task, task_name, CONFIG_ESP_IPC_TASK_STACK_SIZE, (void*) i,
                                                     configMAX_PRIORITIES - 1, &s_ipc_task_handle[i], i);
         assert(res == pdTRUE);