From 687fe7636439a5e988218ed941012019033b29d0 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 29 Jun 2026 14:00:38 +0800 Subject: [PATCH] fix(linux): fixed compile issues for freertos basic example on linux target --- .../main/basic_freertos_smp_usage.c | 3 +-- .../main/create_task_example.c | 2 +- .../basic_freertos_smp_usage/main/lock_example.c | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/system/freertos/basic_freertos_smp_usage/main/basic_freertos_smp_usage.c b/examples/system/freertos/basic_freertos_smp_usage/main/basic_freertos_smp_usage.c index d20016e1cd1..c18e639df23 100644 --- a/examples/system/freertos/basic_freertos_smp_usage/main/basic_freertos_smp_usage.c +++ b/examples/system/freertos/basic_freertos_smp_usage/main/basic_freertos_smp_usage.c @@ -73,8 +73,7 @@ static void config_console(void) */ repl_config.prompt = PROMPT_STR ">"; repl_config.max_cmdline_length = 1024; - esp_console_dev_uart_config_t uart_config = ESP_CONSOLE_DEV_UART_CONFIG_DEFAULT(); - ESP_ERROR_CHECK(esp_console_new_repl_uart(&uart_config, &repl_config, &repl)); + ESP_ERROR_CHECK(esp_console_new_repl_stdio(&repl_config, &repl)); esp_console_register_help_command(); diff --git a/examples/system/freertos/basic_freertos_smp_usage/main/create_task_example.c b/examples/system/freertos/basic_freertos_smp_usage/main/create_task_example.c index a3cdf56a025..2d7f04baed1 100644 --- a/examples/system/freertos/basic_freertos_smp_usage/main/create_task_example.c +++ b/examples/system/freertos/basic_freertos_smp_usage/main/create_task_example.c @@ -31,7 +31,7 @@ static void spin_task(void *arg) int task_id = (intptr_t)arg; ESP_LOGI(TAG, "created task#%d", task_id); while (!timed_out) { - int core_id = esp_cpu_get_core_id(); + int core_id = xPortGetCoreID(); ESP_LOGI(TAG, "task#%d is running on core#%d", task_id, core_id); // consume some CPU cycles to keep Core#0 a little busy, so task3 has opportunity to be scheduled on Core#1 spin_iteration(SPIN_ITER); diff --git a/examples/system/freertos/basic_freertos_smp_usage/main/lock_example.c b/examples/system/freertos/basic_freertos_smp_usage/main/lock_example.c index 4d32518798b..f37194b58d3 100644 --- a/examples/system/freertos/basic_freertos_smp_usage/main/lock_example.c +++ b/examples/system/freertos/basic_freertos_smp_usage/main/lock_example.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -26,7 +26,7 @@ const static char *TAG = "lock example"; // when the mutex is available, FreeRTOS will reschedule this task and this task can further access the shared resource static void inc_num_mutex_iter(void *arg) { - int core_id = esp_cpu_get_core_id(); + int core_id = xPortGetCoreID(); int64_t start_time, end_time, duration = 0; start_time = esp_timer_get_time(); while (s_global_num < ITERATION_NUMBER) { @@ -47,7 +47,7 @@ static void inc_num_mutex_iter(void *arg) // and reschedule the task. static void inc_num_spinlock_iter(void *arg) { - int core_id = esp_cpu_get_core_id(); + int core_id = xPortGetCoreID(); int64_t start_time, end_time, duration = 0; start_time = esp_timer_get_time(); while (s_global_num < ITERATION_NUMBER) { @@ -64,7 +64,7 @@ static void inc_num_spinlock_iter(void *arg) static void inc_num_atomic_iter(void *arg) { - int core_id = esp_cpu_get_core_id(); + int core_id = xPortGetCoreID(); int64_t start_time, end_time, duration = 0; start_time = esp_timer_get_time(); while (atomic_load(&s_atomic_global_num) < ITERATION_NUMBER) { @@ -85,7 +85,7 @@ static void inc_num_mutex(void *arg) while (!timed_out) { xSemaphoreTake(s_mutex, portMAX_DELAY); // == pdTRUE - int core_id = esp_cpu_get_core_id(); + int core_id = xPortGetCoreID(); ESP_LOGI(TAG, "task%d read value = %d on core #%d", task_index, s_global_num, core_id); s_global_num++; // delay for 500 ms