Merge branch 'bugfix/freertos-fix-ignored-warnings' into 'master'

freertos: fix and re-enable no-format warnings

Closes IDF-6798

See merge request espressif/esp-idf!22638
This commit is contained in:
Zim Kalinowski 2023-03-10 13:58:45 +08:00
commit 44df8624ed
10 changed files with 25 additions and 31 deletions

View File

@ -21,6 +21,3 @@ idf_component_register(SRC_DIRS ${src_dirs}
PRIV_INCLUDE_DIRS ${priv_include_dirs} PRIV_INCLUDE_DIRS ${priv_include_dirs}
PRIV_REQUIRES test_utils esp_timer driver PRIV_REQUIRES test_utils esp_timer driver
WHOLE_ARCHIVE) WHOLE_ARCHIVE)
# Todo: Fix no-format errors
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -10,6 +10,7 @@
#include <esp_types.h> #include <esp_types.h>
#include <stdio.h> #include <stdio.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
@ -77,7 +78,7 @@ TEST_CASE("Yield from lower priority task, same CPU", "[freertos]")
TEST_ASSERT( flag ); TEST_ASSERT( flag );
delta = now_ccount - yield_ccount; delta = now_ccount - yield_ccount;
printf("Yielding from lower priority task took %u cycles\n", delta); printf("Yielding from lower priority task took %"PRIu32" cycles\n", delta);
TEST_ASSERT(delta < MAX_YIELD_COUNT); TEST_ASSERT(delta < MAX_YIELD_COUNT);
vTaskDelete(sender_task); vTaskDelete(sender_task);
@ -114,7 +115,7 @@ TEST_CASE("Yield from lower priority task, other CPU", "[freertos]")
TEST_ASSERT( flag ); TEST_ASSERT( flag );
delta = now_ccount - trigger_ccount; delta = now_ccount - trigger_ccount;
printf("Yielding from task on other core took %u cycles\n", delta); printf("Yielding from task on other core took %"PRIu32" cycles\n", delta);
TEST_ASSERT(delta < MAX_YIELD_COUNT); TEST_ASSERT(delta < MAX_YIELD_COUNT);
vQueueDelete(queue); vQueueDelete(queue);

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -7,6 +7,7 @@
/* Tests for FreeRTOS task suspend & resume */ /* Tests for FreeRTOS task suspend & resume */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <inttypes.h>
#include "sdkconfig.h" #include "sdkconfig.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
@ -341,7 +342,7 @@ static void test_scheduler_suspend2(int cpu)
vTaskDelay(waiting_ms * 2 / portTICK_PERIOD_MS); vTaskDelay(waiting_ms * 2 / portTICK_PERIOD_MS);
esp_deregister_freertos_tick_hook(tick_hook); esp_deregister_freertos_tick_hook(tick_hook);
printf("tick_hook_ms[cpu0] = %d, tick_hook_ms[cpu1] = %d\n", tick_hook_ms[0], tick_hook_ms[1]); printf("tick_hook_ms[cpu0] = %"PRIu32", tick_hook_ms[cpu1] = %"PRIu32"\n", tick_hook_ms[0], tick_hook_ms[1]);
TEST_ASSERT_INT_WITHIN(portTICK_PERIOD_MS * 2, waiting_ms * 2, tick_hook_ms[0]); TEST_ASSERT_INT_WITHIN(portTICK_PERIOD_MS * 2, waiting_ms * 2, tick_hook_ms[0]);
TEST_ASSERT_INT_WITHIN(portTICK_PERIOD_MS * 2, waiting_ms * 2, tick_hook_ms[1]); TEST_ASSERT_INT_WITHIN(portTICK_PERIOD_MS * 2, waiting_ms * 2, tick_hook_ms[1]);

View File

@ -5,6 +5,3 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_REQUIRES test_utils PRIV_REQUIRES test_utils
WHOLE_ARCHIVE) WHOLE_ARCHIVE)
# Todo: Fix no-format errors
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@ -5,6 +5,3 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_REQUIRES test_utils PRIV_REQUIRES test_utils
WHOLE_ARCHIVE) WHOLE_ARCHIVE)
# Todo: Fix no-format errors
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@ -1,11 +1,12 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <esp_types.h> #include <esp_types.h>
#include <stdio.h> #include <stdio.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
@ -71,5 +72,5 @@ TEST_CASE("scheduling time test", "[freertos]")
BaseType_t result = xSemaphoreTake(context.end_sema, portMAX_DELAY); BaseType_t result = xSemaphoreTake(context.end_sema, portMAX_DELAY);
TEST_ASSERT_EQUAL_HEX32(pdTRUE, result); TEST_ASSERT_EQUAL_HEX32(pdTRUE, result);
TEST_PERFORMANCE_LESS_THAN(SCHEDULING_TIME , "%d cycles" ,context.cycles_to_sched); TEST_PERFORMANCE_LESS_THAN(SCHEDULING_TIME , "%"PRIu32" cycles" ,context.cycles_to_sched);
} }

View File

@ -1,11 +1,12 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <esp_types.h> #include <esp_types.h>
#include <stdio.h> #include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h" #include "sdkconfig.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
@ -94,8 +95,8 @@ TEST_CASE("isr latency test vport-yield-from-isr with no parameter", "[freertos]
vTaskDelay(100); vTaskDelay(100);
BaseType_t result = xSemaphoreTake(end_sema, portMAX_DELAY); BaseType_t result = xSemaphoreTake(end_sema, portMAX_DELAY);
TEST_ASSERT_EQUAL_HEX32(pdTRUE, result); TEST_ASSERT_EQUAL_HEX32(pdTRUE, result);
TEST_PERFORMANCE_LESS_THAN(ISR_ENTER_CYCLES, "%d cycles" ,delta_enter_cycles); TEST_PERFORMANCE_LESS_THAN(ISR_ENTER_CYCLES, "%"PRIu32" cycles" ,delta_enter_cycles);
TEST_PERFORMANCE_LESS_THAN(ISR_EXIT_CYCLES, "%d cycles" ,delta_exit_cycles); TEST_PERFORMANCE_LESS_THAN(ISR_EXIT_CYCLES, "%"PRIu32" cycles" ,delta_exit_cycles);
esp_intr_free(handle); esp_intr_free(handle);
} }
@ -113,8 +114,8 @@ TEST_CASE("isr latency test vport-yield-from-isr with parameter", "[freertos][ig
xTaskCreatePinnedToCore(test_task, "tst" , 4096, NULL, configMAX_PRIORITIES - 1, NULL, 0); xTaskCreatePinnedToCore(test_task, "tst" , 4096, NULL, configMAX_PRIORITIES - 1, NULL, 0);
BaseType_t result = xSemaphoreTake(end_sema, portMAX_DELAY); BaseType_t result = xSemaphoreTake(end_sema, portMAX_DELAY);
TEST_ASSERT_EQUAL_HEX32(pdTRUE, result); TEST_ASSERT_EQUAL_HEX32(pdTRUE, result);
TEST_PERFORMANCE_LESS_THAN(ISR_ENTER_CYCLES, "%d cycles" ,delta_enter_cycles); TEST_PERFORMANCE_LESS_THAN(ISR_ENTER_CYCLES, "%"PRIu32" cycles" ,delta_enter_cycles);
TEST_PERFORMANCE_LESS_THAN(ISR_EXIT_CYCLES, "%d cycles" ,delta_exit_cycles); TEST_PERFORMANCE_LESS_THAN(ISR_EXIT_CYCLES, "%"PRIu32" cycles" ,delta_exit_cycles);
esp_intr_free(handle); esp_intr_free(handle);
} }

View File

@ -5,6 +5,3 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_REQUIRES test_utils PRIV_REQUIRES test_utils
WHOLE_ARCHIVE) WHOLE_ARCHIVE)
# Todo: Fix no-format errors
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -10,6 +10,7 @@
#include <esp_types.h> #include <esp_types.h>
#include <stdio.h> #include <stdio.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
@ -32,7 +33,7 @@ static uint32_t start, end;
#define BENCHMARK_END(OPERATION) do { \ #define BENCHMARK_END(OPERATION) do { \
end = esp_cpu_get_cycle_count(); \ end = esp_cpu_get_cycle_count(); \
printf("%s took %d cycles/op (%d cycles for %d ops)\n", \ printf("%s took %"PRIu32" cycles/op (%"PRIu32" cycles for %d ops)\n", \
OPERATION, (end - start)/REPEAT_OPS, \ OPERATION, (end - start)/REPEAT_OPS, \
(end - start), REPEAT_OPS); \ (end - start), REPEAT_OPS); \
} while(0) } while(0)
@ -49,12 +50,12 @@ TEST_CASE("portMUX spinlocks (no contention)", "[freertos]")
BENCHMARK_END("no contention lock"); BENCHMARK_END("no contention lock");
#ifdef CONFIG_FREERTOS_UNICORE #ifdef CONFIG_FREERTOS_UNICORE
TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE, "%d cycles/op", ((end - start)/REPEAT_OPS)); TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE, "%"PRIu32" cycles/op", ((end - start)/REPEAT_OPS));
#else #else
#if CONFIG_SPIRAM #if CONFIG_SPIRAM
TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP_PSRAM, "%d cycles/op", ((end - start)/REPEAT_OPS)); TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP_PSRAM, "%"PRIu32" cycles/op", ((end - start)/REPEAT_OPS));
#else #else
TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP, "%d cycles/op", ((end - start)/REPEAT_OPS)); TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP, "%"PRIu32" cycles/op", ((end - start)/REPEAT_OPS));
#endif #endif
#endif #endif
} }

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -11,6 +11,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <esp_types.h> #include <esp_types.h>
#include <inttypes.h>
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
@ -51,7 +52,7 @@ static void task_test_tls(void *arg)
GET_THREADPTR(tp); GET_THREADPTR(tp);
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
printf("Task[%x]: var = 0x%x 0x%x step=%d\n", tp, tl_test_var1, tl_test_var2, step); printf("Task[%"PRIx32"]: var1 = %d var2 = 0x%"PRIx8" step=%d\n", tp, tl_test_var1, tl_test_var2, step);
if (i == 0) { if (i == 0) {
TEST_ASSERT_EQUAL(0, tl_test_var1); TEST_ASSERT_EQUAL(0, tl_test_var1);
TEST_ASSERT_EQUAL(55, tl_test_var2); TEST_ASSERT_EQUAL(55, tl_test_var2);