diff --git a/components/freertos/test_apps/freertos/kernel/tasks/test_yielding.c b/components/freertos/test_apps/freertos/kernel/tasks/test_yielding.c index 6052a0157c..6da218976f 100644 --- a/components/freertos/test_apps/freertos/kernel/tasks/test_yielding.c +++ b/components/freertos/test_apps/freertos/kernel/tasks/test_yielding.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -75,7 +75,7 @@ static void yield_task2(void *arg) /* Wait for the other task to run for the test to begin */ while (!task_sequence_ready) { - taskYIELD(); + vTaskDelay(10); }; /* Store task_id in the sequence array */ @@ -272,7 +272,7 @@ static void test_critical_task2(void *arg) /* Wait for the other task to run for the test to begin */ while (!task_sequence_ready) { - taskYIELD(); + vTaskDelay(10); }; /* Store task_id in the sequence array */ @@ -474,7 +474,7 @@ static void other_core_task2(void *arg) /* Wait for the other task to run for the test to begin */ while (!task_sequence_ready) { - taskYIELD(); + vTaskDelay(10); }; /* Store task_id in the sequence array */ @@ -594,7 +594,7 @@ static void other_core_critical_task2(void *arg) /* Wait for the other task to run for the test to begin */ while (!task_sequence_ready) { - taskYIELD(); + vTaskDelay(10); }; /* Store task_id in the sequence array */ diff --git a/components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c b/components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c index d0f4e3361b..1d7e5efe93 100644 --- a/components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c +++ b/components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c @@ -31,7 +31,7 @@ static void test_task_1(void *arg) for (;;) { context->before_sched = esp_cpu_get_cycle_count(); - vPortYield(); + taskYIELD(); } vTaskDelete(NULL); @@ -44,11 +44,11 @@ static void test_task_2(void *arg) vTaskPrioritySet(NULL, CONFIG_UNITY_FREERTOS_PRIORITY + 1); vTaskPrioritySet(context->t1_handle, CONFIG_UNITY_FREERTOS_PRIORITY + 1); - vPortYield(); + taskYIELD(); for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) { accumulator += (esp_cpu_get_cycle_count() - context->before_sched); - vPortYield(); + taskYIELD(); } context->cycles_to_sched = accumulator / NUMBER_OF_ITERATIONS; @@ -65,8 +65,8 @@ TEST_CASE("scheduling time test", "[freertos]") TEST_ASSERT(context.end_sema != NULL); #if !CONFIG_FREERTOS_UNICORE - xTaskCreatePinnedToCore(test_task_1, "test1", 4096, &context, 1, &context.t1_handle, 1); - xTaskCreatePinnedToCore(test_task_2, "test2", 4096, &context, 1, NULL, 1); + xTaskCreatePinnedToCore(test_task_1, "test1", 4096, &context, CONFIG_UNITY_FREERTOS_PRIORITY - 1, &context.t1_handle, 1); + xTaskCreatePinnedToCore(test_task_2, "test2", 4096, &context, CONFIG_UNITY_FREERTOS_PRIORITY - 1, NULL, 1); #else xTaskCreatePinnedToCore(test_task_1, "test1", 4096, &context, CONFIG_UNITY_FREERTOS_PRIORITY - 1, &context.t1_handle, 0); xTaskCreatePinnedToCore(test_task_2, "test2", 4096, &context, CONFIG_UNITY_FREERTOS_PRIORITY - 1, NULL, 0); @@ -75,4 +75,7 @@ TEST_CASE("scheduling time test", "[freertos]") BaseType_t result = xSemaphoreTake(context.end_sema, portMAX_DELAY); TEST_ASSERT_EQUAL_HEX32(pdTRUE, result); TEST_PERFORMANCE_LESS_THAN(SCHEDULING_TIME, "%"PRIu32" cycles", context.cycles_to_sched); + + /* Cleanup */ + vSemaphoreDelete(context.end_sema); } diff --git a/components/freertos/test_apps/freertos/port/test_spinlocks.c b/components/freertos/test_apps/freertos/port/test_spinlocks.c index e26887a88e..ab2a3e53eb 100644 --- a/components/freertos/test_apps/freertos/port/test_spinlocks.c +++ b/components/freertos/test_apps/freertos/port/test_spinlocks.c @@ -49,7 +49,7 @@ TEST_CASE("portMUX spinlocks (no contention)", "[freertos]") } BENCHMARK_END("no contention lock"); -#ifdef CONFIG_FREERTOS_UNICORE +#if CONFIG_FREERTOS_UNICORE TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE, "%"PRIu32" cycles/op", ((end - start) / REPEAT_OPS)); #else #if CONFIG_SPIRAM @@ -76,6 +76,16 @@ TEST_CASE("portMUX recursive locks (no contention)", "[freertos]") } } BENCHMARK_END("no contention recursive"); + +#if CONFIG_FREERTOS_UNICORE + TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE, "%"PRIu32" cycles/op", ((end - start) / REPEAT_OPS)); +#else +#if CONFIG_SPIRAM + TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP_PSRAM, "%"PRIu32" cycles/op", ((end - start) / REPEAT_OPS)); +#else + TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP, "%"PRIu32" cycles/op", ((end - start) / REPEAT_OPS)); +#endif +#endif } #if CONFIG_FREERTOS_NUMBER_OF_CORES == 2