Merge branch 'bugfix/linux_build_errors' into 'master'

fix(linux): fix build errors without --skip-setting-flags

See merge request espressif/esp-idf!22063
This commit is contained in:
Martin Vychodil 2023-01-20 14:46:36 +08:00
commit a2b0068478
17 changed files with 54 additions and 107 deletions

View File

@ -382,6 +382,7 @@ test_pytest_qemu:
test_pytest_linux:
extends:
- .host_test_template
- .before_script_build_jobs
artifacts:
when: always
paths:
@ -391,13 +392,8 @@ test_pytest_linux:
junit: XUNIT_RESULT.xml
expire_in: 1 week
script:
# TODO: fix the warnings in build flags and ignore-warning-str: IDF-6637
# Record the warnings regexes in file tools/ci/ignore_build_warnings_linux.txt to avoid using parentheses and
# doublequotes with bash.
# Please remove that file while fixing all the warnings.
- run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -vv
--target linux
--pytest-apps
-m host_test
--ignore-warning-file tools/ci/ignore_build_warnings_linux.txt
- run_cmd pytest --target linux -m host_test --junitxml=XUNIT_RESULT.xml

View File

@ -8,8 +8,6 @@ set(srcs "default_event_loop.c"
if(${target} STREQUAL "linux")
list(APPEND requires "linux")
# Temporary fix until esp_system is available for linux, too
list(APPEND priv_include_dirs "$ENV{IDF_PATH}/tools/mocks/esp_system/include")
else()
list(APPEND priv_requires esp_timer)
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
*/
@ -14,7 +14,7 @@
static const char* TAG = "esp-random";
static void __attribute__((constructor)) esp_random_init()
static void __attribute__((constructor)) esp_random_init(void)
{
srand(time(NULL));
ESP_LOGW(TAG, "esp_random do not provide a cryptographically secure numbers on Linux, and should never be used for anything security related");

View File

@ -102,7 +102,7 @@ esp_err_t esp_partition_file_munmap(void);
* @brief Clears statistics gathered by emulated partition read/write/erase operations
*
*/
void esp_partition_clear_stats();
void esp_partition_clear_stats(void);
/**
* @brief Returns number of read operations called
@ -112,7 +112,7 @@ void esp_partition_clear_stats();
* @return
* - number of calls to esp_partition_read since recent esp_partition_clear_stats
*/
size_t esp_partition_get_read_ops();
size_t esp_partition_get_read_ops(void);
/**
* @brief Returns number of write operations called
@ -122,7 +122,7 @@ size_t esp_partition_get_read_ops();
* @return
* - number of calls to esp_partition_write since recent esp_partition_clear_stats
*/
size_t esp_partition_get_write_ops();
size_t esp_partition_get_write_ops(void);
/**
* @brief Returns number of erase operations performed on behalf of calls to esp_partition_erase_range
@ -132,7 +132,7 @@ size_t esp_partition_get_write_ops();
* @return
* - total number of emulated sector erase operations on behalf of esp_partition_erase_range since recent esp_partition_clear_stats
*/
size_t esp_partition_get_erase_ops();
size_t esp_partition_get_erase_ops(void);
/**
* @brief Returns total number of bytes read on behalf of esp_partition_read
@ -142,7 +142,7 @@ size_t esp_partition_get_erase_ops();
* @return
* - total number of bytes read on behalf of esp_partition_read since recent esp_partition_clear_stats
*/
size_t esp_partition_get_read_bytes();
size_t esp_partition_get_read_bytes(void);
/**
* @brief Returns total number of bytes written on behalf of esp_partition_write
@ -152,7 +152,7 @@ size_t esp_partition_get_read_bytes();
* @return
* - total number of bytes written on behalf of esp_partition_write since recent esp_partition_clear_stats
*/
size_t esp_partition_get_write_bytes();
size_t esp_partition_get_write_bytes(void);
/**
* @brief Returns estimated total time spent on partition operations.
@ -163,7 +163,7 @@ size_t esp_partition_get_write_bytes();
* @return
* - estimated total time spent in read/write/erase operations in miliseconds
*/
size_t esp_partition_get_total_time();
size_t esp_partition_get_total_time(void);
/**
* @brief Initializes emulation of failure caused by wear on behalf of write/erase operations

View File

@ -176,7 +176,7 @@ esp_err_t esp_partition_file_mmap(const uint8_t **part_desc_addr_start)
return ESP_OK;
}
esp_err_t esp_partition_file_munmap()
esp_err_t esp_partition_file_munmap(void)
{
if (s_spiflash_mem_file_buf == NULL) {
return ESP_ERR_NO_MEM;
@ -445,7 +445,7 @@ static bool esp_partition_hook_erase(const void *dstAddr, const size_t size)
return true;
}
void esp_partition_clear_stats()
void esp_partition_clear_stats(void)
{
s_esp_partition_stat_read_bytes = 0;
s_esp_partition_stat_write_bytes = 0;
@ -457,32 +457,32 @@ void esp_partition_clear_stats()
memset(s_esp_partition_stat_sector_erase_count, 0, sizeof(s_esp_partition_stat_sector_erase_count));
}
size_t esp_partition_get_read_ops()
size_t esp_partition_get_read_ops(void)
{
return s_esp_partition_stat_read_ops;
}
size_t esp_partition_get_write_ops()
size_t esp_partition_get_write_ops(void)
{
return s_esp_partition_stat_write_ops;
}
size_t esp_partition_get_erase_ops()
size_t esp_partition_get_erase_ops(void)
{
return s_esp_partition_stat_erase_ops;
}
size_t esp_partition_get_read_bytes()
size_t esp_partition_get_read_bytes(void)
{
return s_esp_partition_stat_read_bytes;
}
size_t esp_partition_get_write_bytes()
size_t esp_partition_get_write_bytes(void)
{
return s_esp_partition_stat_write_bytes;
}
size_t esp_partition_get_total_time()
size_t esp_partition_get_total_time(void)
{
return s_esp_partition_stat_total_time;
}

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
*/
@ -16,18 +16,13 @@
#include <stdlib.h> // This is for malloc(), used by portmacro.h
#include "sdkconfig.h"
#include "esp_attr.h"
#include "esp_task.h"
#include "spinlock.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ESP_TASK_PRIO_MAX (configMAX_PRIORITIES)
#define ESP_TASK_PRIO_MIN (0)
#define ESP_TASK_MAIN_PRIO (ESP_TASK_PRIO_MIN + 1)
#define ESP_TASK_MAIN_STACK (CONFIG_ESP_MAIN_TASK_STACK_SIZE)
#define ESP_TASK_MAIN_CORE CONFIG_ESP_MAIN_TASK_AFFINITY
// interrupt module will mask interrupt with priority less than threshold
#define RVHAL_EXCM_LEVEL 4

View File

@ -44,7 +44,7 @@ struct event
bool event_triggered;
};
struct event * event_create()
struct event * event_create(void)
{
struct event * ev = malloc( sizeof( struct event ) );

View File

@ -39,7 +39,7 @@
struct event;
struct event * event_create();
struct event * event_create(void);
void event_delete( struct event * );
bool event_wait( struct event * ev );
bool event_wait_timed( struct event * ev,

View File

@ -720,8 +720,8 @@ TEST_CASE("nvs iterators tests", "[nvs]")
nvs_iterator_t it;
nvs_entry_info_t info;
nvs_handle handle_1;
nvs_handle handle_2;
nvs_handle_t handle_1;
nvs_handle_t handle_2;
const uint32_t blob = 0x11223344;
const char *name_1 = "namespace1";
const char *name_2 = "namespace2";
@ -860,7 +860,7 @@ TEST_CASE("nvs iterators tests", "[nvs]")
SECTION("Iterating over multiple pages works correctly") {
nvs_handle handle_3;
nvs_handle_t handle_3;
const char *name_3 = "namespace3";
const int entries_created = 250;
@ -885,7 +885,7 @@ TEST_CASE("nvs iterators tests", "[nvs]")
}
SECTION("Iterating over multi-page blob works correctly") {
nvs_handle handle_3;
nvs_handle_t handle_3;
const char *name_3 = "namespace3";
const uint8_t multipage_blob[4096 * 2] = { 0 };
const int NUMBER_OF_ENTRIES_PER_PAGE = 125;
@ -1740,7 +1740,7 @@ TEST_CASE("Multi-page blob erased using nvs_erase_key should not be found when p
size_t read_size = blob_size;
PartitionEmulationFixture f(0, 5);
TEST_ESP_OK(nvs::NVSPartitionManager::get_instance()->init_custom(f.part(), 0, 5));
nvs_handle handle;
nvs_handle_t handle;
TEST_ESP_OK(nvs_open("Test", NVS_READWRITE, &handle));
TEST_ESP_OK(nvs_set_blob(handle, "abc", blob, blob_size));
TEST_ESP_OK(nvs_erase_key(handle, "abc"));

View File

@ -149,7 +149,7 @@ static void check_spiffs_files(spiffs *fs, const char *base_path, char *cur_path
fseek(f, 0, SEEK_SET);
char *f_contents = (char *) malloc(sz);
fread(f_contents, 1, sz, f);
TEST_ASSERT(fread(f_contents, 1, sz, f) == sz);
fclose(f);
s32_t spiffs_res;
@ -247,7 +247,7 @@ TEST(spiffs, can_read_spiffs_image)
fseek(img_file, 0, SEEK_SET);
char *img = (char *) malloc(img_size);
fread(img, 1, img_size, img_file);
TEST_ASSERT(fread(img, 1, img_size, img_file) == img_size);
fclose(img_file);
TEST_ASSERT_TRUE(partition->size == img_size);

View File

@ -1,16 +1,22 @@
/* GPIO C++ unit tests
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: CC0-1.0
*
* GPIO C++ unit tests
*
* This example code is in the Public Domain (or CC0 licensed, at your option.)
*
* Unless required by applicable law or agreed to in writing, this
* software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied.
*/
#define CATCH_CONFIG_MAIN
#include <stdio.h>
#include "esp_err.h"
#include "unity.h"
#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "gpio_cxx.hpp"
#include "test_fixtures.hpp"

View File

@ -14,6 +14,7 @@
#define CATCH_CONFIG_MAIN
#include <stdio.h>
#include "unity.h"
#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "driver/i2c.h"
#include "i2c_cxx.hpp"

View File

@ -1,7 +1,7 @@
/*
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: CC0
* SPDX-License-Identifier: CC0-1.0
*
* This test code is in the Public Domain (or CC0 licensed, at your option.)
*
@ -13,6 +13,7 @@
#define CATCH_CONFIG_MAIN
#include <stdio.h>
#include "unity.h"
#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "spi_host_cxx.hpp"
#include "spi_host_private_cxx.hpp"

View File

@ -1439,7 +1439,6 @@ examples/cxx/experimental/experimental_cpp_component/esp_event_cxx.cpp
examples/cxx/experimental/experimental_cpp_component/esp_exception.cpp
examples/cxx/experimental/experimental_cpp_component/esp_timer_cxx.cpp
examples/cxx/experimental/experimental_cpp_component/host_test/esp_timer/main/esp_timer_test.cpp
examples/cxx/experimental/experimental_cpp_component/host_test/gpio/main/gpio_cxx_test.cpp
examples/cxx/experimental/experimental_cpp_component/include/esp_event_api.hpp
examples/cxx/experimental/experimental_cpp_component/include/esp_timer_cxx.hpp
examples/cxx/experimental/experimental_cpp_component/test/test_cxx_exceptions.cpp

View File

@ -1,6 +0,0 @@
the hex symbol ESP_MAIN_TASK_AFFINITY \(defined at .+\) has a non-hex default FREERTOS_NO_AFFINITY \(undefined\)
"CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE" redefined
No function prototypes found!
-Wdeprecated-declarations
-Wno-enum-conversion
-Wunused-result

View File

@ -1,51 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Notes:
* 1. Put all task priority and stack size definition in this file
* 2. If the task priority is less than 10, use ESP_TASK_PRIO_MIN + X style,
* otherwise use ESP_TASK_PRIO_MAX - X style
* 3. If this is a daemon task, the macro prefix is ESP_TASKD_, otherwise
* it's ESP_TASK_
* 4. If the configMAX_PRIORITIES is modified, please make all priority are
* greater than 0
* 5. Make sure esp_task.h is consistent between wifi lib and idf
* 6. If changing system task priorities, please check the values documented in /api-guides/performance/speed.rst
* are up to date
*/
#ifndef _ESP_TASK_H_
#define _ESP_TASK_H_
#include "sdkconfig.h"
#define ESP_TASK_PRIO_MAX (configMAX_PRIORITIES)
#define ESP_TASK_PRIO_MIN (0)
/* Temporary define until system is properly buildable on Linux */
#define CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE 10
/* Bt contoller Task */
/* controller */
#define ESP_TASK_BT_CONTROLLER_PRIO (ESP_TASK_PRIO_MAX - 2)
#ifdef CONFIG_NEWLIB_NANO_FORMAT
#define TASK_EXTRA_STACK_SIZE (0)
#else
#define TASK_EXTRA_STACK_SIZE (512)
#endif
#define BT_TASK_EXTRA_STACK_SIZE TASK_EXTRA_STACK_SIZE
#define ESP_TASK_BT_CONTROLLER_STACK (3584 + TASK_EXTRA_STACK_SIZE)
/* Ping Task */
#define ESP_TASK_PING_STACK (2048 + TASK_EXTRA_STACK_SIZE)
/* idf task */
#define ESP_TASKD_EVENT_PRIO (ESP_TASK_PRIO_MAX - 5)
#define ESP_TASKD_EVENT_STACK (2048)
#endif

View File

@ -29,4 +29,12 @@ menu "FreeRTOS"
However, task notifications in general are more light weight compared to alternatives
such as semaphores.
endmenu
config FREERTOS_NO_AFFINITY
# This invisible config value sets the value of tskNO_AFFINITY in task.h.
# Intended to be used as a constant from other Kconfig files.
# Value is (32-bit) INT_MAX.
hex
default 0x7FFFFFFF if !FREERTOS_SMP
default 0xFFFFFFFF if FREERTOS_SMP
endmenu