From 8dab090d4f1292ab188df2fc56fbd367adcaa6cd Mon Sep 17 00:00:00 2001 From: Li Junru Date: Tue, 2 Apr 2024 17:35:27 +0800 Subject: [PATCH] feat: Update idf_build_apps --- .gitlab/ci/build.yml | 31 ++++++++++--------- .../ble_profiles/esp/ble_ota/src/ble_ota.c | 8 ++++- .../bluetooth/ble_remote_control/main/main.c | 8 ++++- tools/build_apps.py | 15 +++++---- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/.gitlab/ci/build.yml b/.gitlab/ci/build.yml index 7a92035b0..47da108ad 100644 --- a/.gitlab/ci/build.yml +++ b/.gitlab/ci/build.yml @@ -36,7 +36,7 @@ EXAMPLE_CONFIG: "=" script: - pip install "idf-component-manager<1.5" - - pip install "idf_build_apps<2.0" + - pip install idf_build_apps - python tools/build_apps.py ${EXAMPLE_DIR} --config ${EXAMPLE_CONFIG} -t all -vv build_example_audio_wav_player: @@ -58,6 +58,7 @@ build_example_bluetooth_ble_conn_mgr_ble_periodic_adv: matrix: - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_conn_mgr/ble_periodic_adv @@ -69,6 +70,7 @@ build_example_bluetooth_ble_conn_mgr_ble_periodic_sync: matrix: - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_conn_mgr/ble_periodic_sync @@ -78,10 +80,10 @@ build_example_bluetooth_ble_conn_mgr_ble_spp_client: - .rules:build:example_bluetooth_ble_conn_mgr parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_conn_mgr/ble_spp/spp_client @@ -91,10 +93,10 @@ build_example_bluetooth_ble_conn_mgr_ble_spp_server: - .rules:build:example_bluetooth_ble_conn_mgr parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_conn_mgr/ble_spp/spp_server @@ -104,10 +106,10 @@ build_example_bluetooth_ble_anp: - .rules:build:example_bluetooth_ble_anp parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_profiles/ble_anp @@ -117,10 +119,10 @@ build_example_bluetooth_ble_hrp: - .rules:build:example_bluetooth_ble_hrp parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_profiles/ble_hrp @@ -130,10 +132,10 @@ build_example_bluetooth_ble_htp: - .rules:build:example_bluetooth_ble_htp parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_profiles/ble_htp @@ -143,10 +145,10 @@ build_example_bluetooth_ble_services_ble_ans: - .rules:build:example_bluetooth_ble_services parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_services/ble_ans @@ -156,10 +158,10 @@ build_example_bluetooth_ble_services_ble_bas: - .rules:build:example_bluetooth_ble_services parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_services/ble_bas @@ -169,10 +171,10 @@ build_example_bluetooth_ble_services_ble_dis: - .rules:build:example_bluetooth_ble_services parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_services/ble_dis @@ -182,10 +184,10 @@ build_example_bluetooth_ble_services_ble_hrs: - .rules:build:example_bluetooth_ble_services parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_services/ble_hrs @@ -195,10 +197,10 @@ build_example_bluetooth_ble_services_ble_hts: - .rules:build:example_bluetooth_ble_services parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_services/ble_hts @@ -208,10 +210,10 @@ build_example_bluetooth_ble_services_ble_tps: - .rules:build:example_bluetooth_ble_services parallel: matrix: - - IMAGE: espressif/idf:release-v4.3 - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_services/ble_tps @@ -224,6 +226,7 @@ build_example_bluetooth_ble_ota: - IMAGE: espressif/idf:release-v4.4 - IMAGE: espressif/idf:release-v5.0 - IMAGE: espressif/idf:release-v5.1 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_ota @@ -234,6 +237,7 @@ build_example_bluetooth_ble_remote_control: parallel: matrix: - IMAGE: espressif/idf:release-v5.0 + - IMAGE: espressif/idf:release-v5.2 variables: EXAMPLE_DIR: examples/bluetooth/ble_remote_control @@ -410,8 +414,7 @@ build_example_get_started_button_power_save: parallel: matrix: - IMAGE: espressif/idf:release-v4.4 - - IMAGE: espressif/idf:release-v5.0 - - IMAGE: espressif/idf:latest + - IMAGE: espressif/idf:release-v5.1 variables: EXAMPLE_DIR: examples/get-started/button_power_save diff --git a/components/bluetooth/ble_profiles/esp/ble_ota/src/ble_ota.c b/components/bluetooth/ble_profiles/esp/ble_ota/src/ble_ota.c index 4054ad50e..485ec725a 100644 --- a/components/bluetooth/ble_profiles/esp/ble_ota/src/ble_ota.c +++ b/components/bluetooth/ble_profiles/esp/ble_ota/src/ble_ota.c @@ -1,11 +1,12 @@ /* - * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #include #include "freertos/FreeRTOS.h" +#include "esp_idf_version.h" #include "esp_log.h" #include "ble_ota.h" @@ -1076,7 +1077,12 @@ esp_err_t esp_ble_ota_recv_fw_data_callback(esp_ble_ota_recv_fw_cb_t callback) esp_err_t esp_ble_ota_host_init(void) { esp_err_t ret; +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0) + esp_bluedroid_config_t cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT(); + ret = esp_bluedroid_init_with_cfg(&cfg); +#else ret = esp_bluedroid_init(); +#endif if (ret) { ESP_LOGE(TAG, "%s init bluetooth failed: %s\n", __func__, esp_err_to_name(ret)); return ret; diff --git a/examples/bluetooth/ble_remote_control/main/main.c b/examples/bluetooth/ble_remote_control/main/main.c index b4451a069..6912e62ed 100644 --- a/examples/bluetooth/ble_remote_control/main/main.c +++ b/examples/bluetooth/ble_remote_control/main/main.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -17,6 +17,7 @@ #include "freertos/task.h" #include "freertos/queue.h" #include "freertos/event_groups.h" +#include "esp_idf_version.h" // Example includes #include "controller.h" @@ -167,7 +168,12 @@ esp_err_t ble_config(void) return ESP_FAIL; } +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0) + esp_bluedroid_config_t cfg = BT_BLUEDROID_INIT_CONFIG_DEFAULT(); + ret = esp_bluedroid_init_with_cfg(&cfg); +#else ret = esp_bluedroid_init(); +#endif if (ret) { ESP_LOGE(HID_DEMO_TAG, "%s init bluedroid failed\n", __func__); return ESP_FAIL; diff --git a/tools/build_apps.py b/tools/build_apps.py index dfd51735a..50b2bc3f9 100644 --- a/tools/build_apps.py +++ b/tools/build_apps.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # # SPDX-License-Identifier: Apache-2.0 @@ -10,10 +10,13 @@ import sys import os import re +import logging from pathlib import Path from typing import List -from idf_build_apps import LOGGER, App, build_apps, find_apps, setup_logging +from idf_build_apps import App, build_apps, find_apps, setup_logging + +logger = logging.getLogger('idf_build_apps') PROJECT_ROOT = Path(__file__).parent.parent.absolute() APPS_BUILD_PER_JOB = 30 @@ -59,8 +62,8 @@ def get_cmake_apps( target=target, build_dir=f'{idf_ver}/build_@t_@w', config_rules_str=config_rules_str, - build_log_path='build_log.txt', - size_json_path='size.json', + build_log_filename='build_log.txt', + size_json_filename='size.json', check_warnings=True, preserve=True, default_build_targets=default_build_targets, @@ -81,8 +84,8 @@ def main(args): # type: (argparse.Namespace) -> None else: apps_to_build = apps[:] - LOGGER.info('Found %d apps after filtering', len(apps_to_build)) - LOGGER.info( + logger.info('Found %d apps after filtering', len(apps_to_build)) + logger.info( 'Suggest setting the parallel count to %d for this build job', len(apps_to_build) // APPS_BUILD_PER_JOB + 1, )