Skip to content

Commit f844952

Browse files
authored
Merge branch 'espressif:release/v5.1' into release/v5.1
2 parents ccc4028 + 64849cb commit f844952

File tree

363 files changed

+15817
-7045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

363 files changed

+15817
-7045
lines changed

.gitlab-ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ variables:
5454
BATCH_BUILD: "1"
5555
V: "0"
5656
CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py"
57-
PYTHON_VER: 3.7.10
5857

5958
# Docker images
6059
BOT_DOCKER_IMAGE_TAG: ":latest"

.gitlab/ci/rules.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -430,15 +430,6 @@
430430
- <<: *if-dev-push
431431
changes: *patterns-python-files
432432

433-
.rules:patterns:static-code-analysis-preview:
434-
rules:
435-
- <<: *if-dev-push
436-
changes: *patterns-c-files
437-
- <<: *if-dev-push
438-
changes: *patterns-python-files
439-
- <<: *if-dev-push
440-
changes: *patterns-sonarqube-files
441-
442433
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
443434
# DO NOT place comments or maintain any code from this line
444435
#

.gitlab/ci/static-code-analysis.yml

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -36,85 +36,3 @@ check_pylint:
3636
export files=$(find . -iname "*.py" -print);
3737
fi
3838
- pylint --rcfile=.pylintrc $files -r n --output-format=parseable > pylint-report.txt || exit 0
39-
40-
# build stage
41-
# Sonarqube related jobs put here for this reason:
42-
# Here we have two jobs. code_quality_check and code_quality_report.
43-
#
44-
# code_quality_check will analyze the code changes between your MR and
45-
# code repo stored in sonarqube server. The analysis result is only shown in
46-
# the comments under this MR and won't be transferred to the server.
47-
#
48-
# code_quality_report will analyze and transfer both of the newly added code
49-
# and the analysis result to the server.
50-
#
51-
# Put in the front to ensure that the newly merged code can be stored in
52-
# sonarqube server ASAP, in order to avoid reporting unrelated code issues
53-
.sonar_scan_template:
54-
stage: build
55-
extends: .pre_check_template
56-
image:
57-
name: $SONARQUBE_SCANNER_IMAGE
58-
before_script:
59-
- source tools/ci/utils.sh
60-
- export PYTHONPATH="$CI_PROJECT_DIR/tools:$CI_PROJECT_DIR/tools/ci/python_packages:$PYTHONPATH"
61-
- fetch_submodules
62-
# Exclude the submodules, all paths ends with /**
63-
- submodules=$(get_all_submodules)
64-
# get all exclude paths specified in tools/ci/sonar_exclude_list.txt | ignore lines start with # | xargs | replace all <space> to <comma>
65-
- custom_excludes=$(cat $CI_PROJECT_DIR/tools/ci/sonar_exclude_list.txt | grep -v '^#' | xargs | sed -e 's/ /,/g')
66-
# Exclude the report dir as well
67-
- export EXCLUSIONS="$custom_excludes,$submodules"
68-
- export SONAR_SCANNER_OPTS="-Xmx2048m"
69-
variables:
70-
GIT_DEPTH: 0
71-
REPORT_PATTERN: clang_tidy_reports/*.txt
72-
artifacts:
73-
when: always
74-
paths:
75-
- $REPORT_PATTERN
76-
expire_in: 1 week
77-
dependencies: # Here is not a hard dependency relationship, could be skipped when only python files changed. so we do not use "needs" here.
78-
- clang_tidy_check
79-
- check_pylint
80-
81-
code_quality_check:
82-
extends:
83-
- .sonar_scan_template
84-
- .rules:patterns:static-code-analysis-preview
85-
allow_failure: true # since now it's using exit code to indicate the code analysis result,
86-
# we don't want to block ci when critical issues founded
87-
script:
88-
- export CI_MERGE_REQUEST_COMMITS=$(python ${CI_PROJECT_DIR}/tools/ci/ci_get_mr_info.py commits ${CI_COMMIT_REF_NAME} | tr '\n' ',')
89-
# test if this branch have merge request, if not, exit 0
90-
- test -n "$CI_MERGE_REQUEST_IID" || exit 0
91-
- test -n "$CI_MERGE_REQUEST_COMMITS" || exit 0
92-
- sonar-scanner
93-
-Dsonar.analysis.mode=preview
94-
-Dsonar.branch.name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
95-
-Dsonar.cxx.clangtidy.reportPath=$REPORT_PATTERN
96-
-Dsonar.exclusions=$EXCLUSIONS
97-
-Dsonar.gitlab.ci_merge_request_iid=$CI_MERGE_REQUEST_IID
98-
-Dsonar.gitlab.commit_sha=$CI_MERGE_REQUEST_COMMITS
99-
-Dsonar.gitlab.merge_request_discussion=true
100-
-Dsonar.gitlab.ref_name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
101-
-Dsonar.host.url=$SONAR_HOST_URL
102-
-Dsonar.login=$SONAR_LOGIN
103-
-Dsonar.python.pylint.reportPath=pylint-report.txt
104-
105-
code_quality_report:
106-
extends:
107-
- .sonar_scan_template
108-
- .rules:protected
109-
allow_failure: true # since now it's using exit code to indicate the code analysis result,
110-
# we don't want to block ci when critical issues founded
111-
script:
112-
- sonar-scanner
113-
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
114-
-Dsonar.cxx.clangtidy.reportPath=$REPORT_PATTERN
115-
-Dsonar.exclusions=$EXCLUSIONS
116-
-Dsonar.gitlab.commit_sha=$PIPELINE_COMMIT_SHA
117-
-Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
118-
-Dsonar.host.url=$SONAR_HOST_URL
119-
-Dsonar.login=$SONAR_LOGIN
120-
-Dsonar.python.pylint.reportPath=pylint-report.txt

components/bootloader_support/bootloader_flash/src/bootloader_flash.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -643,7 +643,7 @@ void bootloader_spi_flash_reset(void)
643643
******************************************************************************/
644644

645645
#define XMC_SUPPORT CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT
646-
#define XMC_VENDOR_ID 0x20
646+
#define XMC_VENDOR_ID_1 0x20
647647

648648
#if BOOTLOADER_BUILD
649649
#define BOOTLOADER_FLASH_LOG(level, ...) ESP_EARLY_LOG##level(TAG, ##__VA_ARGS__)
@@ -660,7 +660,7 @@ static IRAM_ATTR bool is_xmc_chip_strict(uint32_t rdid)
660660
uint32_t mfid = BYTESHIFT(rdid, 1);
661661
uint32_t cpid = BYTESHIFT(rdid, 0);
662662

663-
if (vendor_id != XMC_VENDOR_ID) {
663+
if (vendor_id != XMC_VENDOR_ID_1) {
664664
return false;
665665
}
666666

@@ -693,7 +693,7 @@ esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
693693
// Check the Manufacturer ID in SFDP registers (JEDEC standard). If not XMC chip, no need to run the flow
694694
const int sfdp_mfid_addr = 0x10;
695695
uint8_t mf_id = (bootloader_flash_read_sfdp(sfdp_mfid_addr, 1) & 0xff);
696-
if (mf_id != XMC_VENDOR_ID) {
696+
if (mf_id != XMC_VENDOR_ID_1) {
697697
BOOTLOADER_FLASH_LOG(D, "non-XMC chip detected by SFDP Read (%02X), skip.", mf_id);
698698
return ESP_OK;
699699
}
@@ -725,7 +725,7 @@ esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
725725
static IRAM_ATTR bool is_xmc_chip(uint32_t rdid)
726726
{
727727
uint32_t vendor_id = (rdid >> 16) & 0xFF;
728-
return (vendor_id == XMC_VENDOR_ID);
728+
return (vendor_id == XMC_VENDOR_ID_1);
729729
}
730730

731731
esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)

components/bt/CMakeLists.txt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ if(CONFIG_BT_ENABLED)
2424
elseif(CONFIG_IDF_TARGET_ESP32C2)
2525
list(APPEND srcs "controller/esp32c2/bt.c")
2626
list(APPEND include_dirs include/esp32c2/include)
27+
if(CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY)
28+
list(APPEND srcs "controller/esp32c2/dummy.c")
29+
endif()
2730
set(ldscripts "linker_esp32c2.lf")
2831

2932
elseif(CONFIG_IDF_TARGET_ESP32C6)
@@ -781,16 +784,28 @@ if(CONFIG_BT_ENABLED)
781784
elseif(CONFIG_IDF_TARGET_ESP32C3)
782785
target_link_directories(${COMPONENT_LIB} INTERFACE
783786
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32c3")
784-
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
787+
if(CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY)
788+
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app_flash)
789+
else()
790+
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
791+
endif()
785792
elseif(CONFIG_IDF_TARGET_ESP32S3)
786793
target_link_directories(${COMPONENT_LIB} INTERFACE
787794
"${CMAKE_CURRENT_LIST_DIR}/controller/lib_esp32c3_family/esp32s3")
788-
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
795+
if(CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY)
796+
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app_flash)
797+
else()
798+
target_link_libraries(${COMPONENT_LIB} PUBLIC btdm_app)
799+
endif()
789800
elseif(CONFIG_BT_CONTROLLER_ENABLED)
790801
if(CONFIG_IDF_TARGET_ESP32C6)
791802
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/esp32c6/libble_app.a")
792803
else()
793-
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app.a")
804+
if(CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY)
805+
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app_flash.a")
806+
else()
807+
add_prebuilt_library(libble_app "controller/lib_${target}/${target}-bt-lib/libble_app.a")
808+
endif()
794809
endif()
795810
target_link_libraries(${COMPONENT_LIB} PRIVATE libble_app)
796811
endif()

components/bt/common/btc/core/btc_task.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static void btc_deinit_mem(void) {
310310
btc_profile_cb_tab = NULL;
311311
}
312312

313-
#if (BLE_INCLUDED == TRUE)
313+
#if (BLE_42_FEATURE_SUPPORT == TRUE)
314314
if (gl_bta_adv_data_ptr) {
315315
osi_free(gl_bta_adv_data_ptr);
316316
gl_bta_adv_data_ptr = NULL;
@@ -320,7 +320,7 @@ static void btc_deinit_mem(void) {
320320
osi_free(gl_bta_scan_rsp_data_ptr);
321321
gl_bta_scan_rsp_data_ptr = NULL;
322322
}
323-
#endif ///BLE_INCLUDED == TRUE
323+
#endif // BLE_42_FEATURE_SUPPORT
324324

325325
#if GATTS_INCLUDED == TRUE && GATT_DYNAMIC_MEMORY == TRUE
326326
if (btc_creat_tab_env_ptr) {
@@ -372,7 +372,8 @@ static bt_status_t btc_init_mem(void) {
372372
}
373373
memset((void *)btc_profile_cb_tab, 0, sizeof(void *) * BTC_PID_NUM);
374374

375-
#if (BLE_INCLUDED == TRUE)
375+
#if BTC_DYNAMIC_MEMORY == TRUE
376+
#if (BLE_42_FEATURE_SUPPORT == TRUE)
376377
if ((gl_bta_adv_data_ptr = (tBTA_BLE_ADV_DATA *)osi_malloc(sizeof(tBTA_BLE_ADV_DATA))) == NULL) {
377378
goto error_exit;
378379
}
@@ -382,7 +383,8 @@ static bt_status_t btc_init_mem(void) {
382383
goto error_exit;
383384
}
384385
memset((void *)gl_bta_scan_rsp_data_ptr, 0, sizeof(tBTA_BLE_ADV_DATA));
385-
#endif ///BLE_INCLUDED == TRUE
386+
#endif // (BLE_42_FEATURE_SUPPORT == TRUE)
387+
#endif // BTC_DYNAMIC_MEMORY == TRUE
386388

387389
#if GATTS_INCLUDED == TRUE && GATT_DYNAMIC_MEMORY == TRUE
388390
if ((btc_creat_tab_env_ptr = (esp_btc_creat_tab_t *)osi_malloc(sizeof(esp_btc_creat_tab_t))) == NULL) {

components/bt/common/hci_log/bt_hci_log.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,19 +305,27 @@ void bt_hci_log_data_show(bt_hci_log_t *p_hci_log_ctl)
305305

306306
osi_mutex_unlock(&mutex_lock);
307307
}
308+
static bool enable_hci_log_flag = true;
309+
void bt_hci_log_record_hci_enable(bool enable)
310+
{
311+
enable_hci_log_flag = enable;
312+
}
308313

309314
esp_err_t IRAM_ATTR bt_hci_log_record_hci_data(uint8_t data_type, uint8_t *data, uint8_t data_len)
310315
{
316+
if (!enable_hci_log_flag) return ESP_OK;
311317
return bt_hci_log_record_data(&g_bt_hci_log_data_ctl, NULL, data_type, data, data_len);
312318
}
313319

314320
esp_err_t IRAM_ATTR bt_hci_log_record_custom_data(char *string, uint8_t *data, uint8_t data_len)
315321
{
322+
if (!enable_hci_log_flag) return ESP_OK;
316323
return bt_hci_log_record_data(&g_bt_hci_log_data_ctl, string, HCI_LOG_DATA_TYPE_SELF_DEFINE, data, data_len);
317324
}
318325

319326
esp_err_t IRAM_ATTR bt_hci_log_record_hci_adv(uint8_t data_type, uint8_t *data, uint8_t data_len)
320327
{
328+
if (!enable_hci_log_flag) return ESP_OK;
321329
return bt_hci_log_record_data(&g_bt_hci_log_adv_ctl, NULL, data_type, data, data_len);
322330
}
323331

components/bt/common/osi/allocator.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,5 +241,8 @@ void *osi_calloc_func(size_t size)
241241

242242
void osi_free_func(void *ptr)
243243
{
244+
#if HEAP_MEMORY_DEBUG
245+
osi_mem_dbg_clean(ptr, __func__, __LINE__);
246+
#endif
244247
free(ptr);
245248
}

components/bt/common/osi/include/osi/allocator.h

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ void *osi_malloc_func(size_t size);
2929
void *osi_calloc_func(size_t size);
3030
void osi_free_func(void *ptr);
3131

32+
// Memory alloc function without print and assertion
33+
#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST
34+
#define osi_malloc_base(size) heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
35+
#define osi_calloc_base(size) heap_caps_calloc_prefer(1, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
36+
#else
37+
#define osi_malloc_base(size) malloc((size))
38+
#define osi_calloc_base(size) calloc(1, (size))
39+
#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */
40+
3241
#if HEAP_MEMORY_DEBUG
3342

3443
void osi_mem_dbg_init(void);
@@ -41,48 +50,22 @@ void osi_men_dbg_set_section_start(uint8_t index);
4150
void osi_men_dbg_set_section_end(uint8_t index);
4251
uint32_t osi_mem_dbg_get_max_size_section(uint8_t index);
4352

44-
#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST
45-
#define osi_malloc(size) \
46-
({ \
47-
void *p; \
48-
p = heap_caps_malloc_prefer(size, 2, \
49-
MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, \
50-
MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); \
51-
osi_mem_dbg_record(p, size, __func__, __LINE__); \
52-
(void *)p; \
53-
})
54-
55-
#define osi_calloc(size) \
56-
({ \
57-
void *p; \
58-
p = heap_caps_calloc_prefer(1, size, 2, \
59-
MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, \
60-
MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); \
61-
osi_mem_dbg_record(p, size, __func__, __LINE__); \
62-
(void *)p; \
63-
})
64-
65-
#else
66-
6753
#define osi_malloc(size) \
6854
({ \
6955
void *p; \
70-
p = malloc((size)); \
56+
p = osi_malloc_base(size); \
7157
osi_mem_dbg_record(p, size, __func__, __LINE__); \
7258
(void *)p; \
7359
})
7460

7561
#define osi_calloc(size) \
7662
({ \
7763
void *p; \
78-
p = calloc(1, (size)); \
64+
p = osi_calloc_base(size); \
7965
osi_mem_dbg_record(p, size, __func__, __LINE__); \
8066
(void *)p; \
8167
})
8268

83-
#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */
84-
85-
8669
#if 0
8770
#define osi_malloc(size) \
8871
do { \
@@ -122,15 +105,6 @@ do { \
122105

123106
#else
124107

125-
// Memory alloc function without print and assertion
126-
#if HEAP_ALLOCATION_FROM_SPIRAM_FIRST
127-
#define osi_malloc_base(size) heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
128-
#define osi_calloc_base(size) heap_caps_calloc_prefer(1, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL)
129-
#else
130-
#define osi_malloc_base(size) malloc((size))
131-
#define osi_calloc_base(size) calloc(1, (size))
132-
#endif /* #if HEAP_ALLOCATION_FROM_SPIRAM_FIRST */
133-
134108
// Memory alloc function with print and assertion when fails
135109
#define osi_malloc(size) osi_malloc_func((size))
136110
#define osi_calloc(size) osi_calloc_func((size))

0 commit comments

Comments
 (0)