From 7663782e8d2184a2aa97268217cceb19b7e716b9 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 2 May 2018 15:39:39 +0800 Subject: [PATCH] unity: allow test task stack size to be configured --- tools/unit-test-app/components/unity/Kconfig | 15 +++++++++++++++ .../components/unity/include/unity_config.h | 6 ++++-- tools/unit-test-app/configs/libsodium | 1 + tools/unit-test-app/main/app_main.c | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tools/unit-test-app/components/unity/Kconfig diff --git a/tools/unit-test-app/components/unity/Kconfig b/tools/unit-test-app/components/unity/Kconfig new file mode 100644 index 000000000..642d76f9d --- /dev/null +++ b/tools/unit-test-app/components/unity/Kconfig @@ -0,0 +1,15 @@ +menu "Unity test framework" + +config UNITY_FREERTOS_PRIORITY + int "Priority of Unity test task" + default 5 + +config UNITY_FREERTOS_CPU + int "CPU to run Unity test task on" + default 0 + +config UNITY_FREERTOS_STACK_SIZE + int "Stack size of Unity test task, in bytes" + default 8192 + +endmenu diff --git a/tools/unit-test-app/components/unity/include/unity_config.h b/tools/unit-test-app/components/unity/include/unity_config.h index bb672ccc9..19f73b1ce 100644 --- a/tools/unit-test-app/components/unity/include/unity_config.h +++ b/tools/unit-test-app/components/unity/include/unity_config.h @@ -8,10 +8,12 @@ // Adapt Unity to our environment, disable FP support #include +#include /* Some definitions applicable to Unity running in FreeRTOS */ -#define UNITY_FREERTOS_PRIORITY 5 -#define UNITY_FREERTOS_CPU 0 +#define UNITY_FREERTOS_PRIORITY CONFIG_UNITY_FREERTOS_PRIORITY +#define UNITY_FREERTOS_CPU CONFIG_UNITY_FREERTOS_CPU +#define UNITY_FREERTOS_STACK_SIZE CONFIG_UNITY_FREERTOS_STACK_SIZE #define UNITY_EXCLUDE_FLOAT #define UNITY_EXCLUDE_DOUBLE diff --git a/tools/unit-test-app/configs/libsodium b/tools/unit-test-app/configs/libsodium index fa3c2d5ee..f43b22a4c 100644 --- a/tools/unit-test-app/configs/libsodium +++ b/tools/unit-test-app/configs/libsodium @@ -1 +1,2 @@ TEST_COMPONENTS=libsodium +CONFIG_UNITY_FREERTOS_STACK_SIZE=12288 diff --git a/tools/unit-test-app/main/app_main.c b/tools/unit-test-app/main/app_main.c index f1c18fcbf..1dbcdd3b0 100644 --- a/tools/unit-test-app/main/app_main.c +++ b/tools/unit-test-app/main/app_main.c @@ -19,6 +19,6 @@ void app_main() // Note: if unpinning this task, change the way run times are calculated in // unity_platform - xTaskCreatePinnedToCore(unityTask, "unityTask", 8192, NULL, + xTaskCreatePinnedToCore(unityTask, "unityTask", UNITY_FREERTOS_STACK_SIZE, NULL, UNITY_FREERTOS_PRIORITY, NULL, UNITY_FREERTOS_CPU); }