mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(linux): fixed compile issues for freertos basic example on linux target
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user