From c40bbc5c420dcafb8232d8826ab3c678500260b9 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Fri, 30 Jun 2017 09:39:54 +1000 Subject: [PATCH] ipc task: Allow configuration of IPC task stack size Fixes regression in 3fe0022ef --- components/esp32/Kconfig | 18 +++++++++++++++++- components/esp32/include/esp_ipc.h | 4 ++++ components/esp32/ipc.c | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 3625ce59e0..d08d359e55 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -199,8 +199,24 @@ config MAIN_TASK_STACK_SIZE int "Main task stack size" default 4096 help - Config system event task stack size in different application. + Configure the "main task" stack size. This is the stack of the task + which calls app_main(). If app_main() returns then this task is deleted + and its stack memory is freed. +config IPC_TASK_STACK_SIZE + int "Inter-Processor Call (IPC) task stack size" + default 1024 + range 512 65536 if !ESP32_APPTRACE_ENABLE + range 2048 65536 if ESP32_APPTRACE_ENABLE + help + Configure the IPC tasks stack size. One IPC task runs on each core + (in dual core mode), and allows for cross-core function calls. + + See IPC documentation for more details. + + The default stack size should be enough for most common use cases. + It can be shrunk if you are sure that you do not use any custom + IPC functionality. config NEWLIB_STDOUT_ADDCR bool "Standard-out output adds carriage return before newline" diff --git a/components/esp32/include/esp_ipc.h b/components/esp32/include/esp_ipc.h index 7759e49d9d..28b17a9a3e 100644 --- a/components/esp32/include/esp_ipc.h +++ b/components/esp32/include/esp_ipc.h @@ -57,6 +57,10 @@ void esp_ipc_init(); * * In single-core mode, returns ESP_ERR_INVALID_ARG for cpu_id 1. * + * For complex functions, you may need to increase the stack size of the "IPC task" + * which runs the function must be sufficient. See the "Inter-Processor Call (IPC) + * task stack size" setting in menuconfig. + * * @param cpu_id CPU where function should be executed (0 or 1) * @param func pointer to a function which should be executed * @param arg arbitrary argument to be passed into function diff --git a/components/esp32/ipc.c b/components/esp32/ipc.c index fce3fd430a..41f7b8573f 100644 --- a/components/esp32/ipc.c +++ b/components/esp32/ipc.c @@ -80,7 +80,7 @@ void esp_ipc_init() const char* task_names[2] = {"ipc0", "ipc1"}; for (int i = 0; i < portNUM_PROCESSORS; ++i) { s_ipc_sem[i] = xSemaphoreCreateBinary(); - xTaskCreatePinnedToCore(ipc_task, task_names[i], configMINIMAL_STACK_SIZE, (void*) i, + xTaskCreatePinnedToCore(ipc_task, task_names[i], CONFIG_IPC_TASK_STACK_SIZE, (void*) i, configMAX_PRIORITIES - 1, &s_ipc_tasks[i], i); } }